mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0032419: Coding Rules - revert Overlaps() methods to SelectBasics_SelectingVolumeManager as deprecated aliases
Deprecated Overlaps() methods have been moved from subclass SelectMgr_SelectingVolumeManager to the base class SelectBasics_SelectingVolumeManager, so that they are actually accessible within Select3D_SensitiveEntity::Matches() implementations. Several methods have been marked as pure virtual in the base interface. Second SelectMgr_BaseIntersector::OverlapsPolygon() has been dropped from virtual interface as useless (trivially replaceable).
This commit is contained in:
parent
1b6b8afcd0
commit
6a920e0243
@ -86,7 +86,7 @@ Standard_Boolean MeshVS_SensitivePolyhedron::Matches (SelectBasics_SelectingVolu
|
|||||||
SelectBasics_PickResult aPickResult;
|
SelectBasics_PickResult aPickResult;
|
||||||
for (MeshVS_PolyhedronVertsIter aIter (myTopology); aIter.More(); aIter.Next())
|
for (MeshVS_PolyhedronVertsIter aIter (myTopology); aIter.More(); aIter.Next())
|
||||||
{
|
{
|
||||||
if (theMgr.OverlapsPolygon (aIter.Value(), Select3D_TOS_INTERIOR, aPickResult))
|
if (theMgr.OverlapsPolygon (aIter.Value()->Array1(), Select3D_TOS_INTERIOR, aPickResult))
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasi
|
|||||||
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (aPolygIdx);
|
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (aPolygIdx);
|
||||||
Handle(TColgp_HArray1OfPnt) aPoints;
|
Handle(TColgp_HArray1OfPnt) aPoints;
|
||||||
aPolygon->Points3D (aPoints);
|
aPolygon->Points3D (aPoints);
|
||||||
return theMgr.OverlapsPolygon (aPoints, Select3D_TOS_INTERIOR, thePickResult);
|
return theMgr.OverlapsPolygon (aPoints->Array1(), Select3D_TOS_INTERIOR, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -228,7 +228,7 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume
|
|||||||
if (theMgr.GetActiveSelectionType() == SelectMgr_SelectionType_Polyline)
|
if (theMgr.GetActiveSelectionType() == SelectMgr_SelectionType_Polyline)
|
||||||
{
|
{
|
||||||
SelectBasics_PickResult aDummy;
|
SelectBasics_PickResult aDummy;
|
||||||
return theMgr.OverlapsPolygon (anArrayOfPnt, mySensType, aDummy);
|
return theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), mySensType, aDummy);
|
||||||
}
|
}
|
||||||
for (Standard_Integer aPntIdx = anArrayOfPnt->Lower(); aPntIdx <= anArrayOfPnt->Upper(); ++aPntIdx)
|
for (Standard_Integer aPntIdx = anArrayOfPnt->Lower(); aPntIdx <= anArrayOfPnt->Upper(); ++aPntIdx)
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theMgr.OverlapsPolygon (anArrayOfPnt, Select3D_TOS_INTERIOR, thePickResult))
|
if (!theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), Select3D_TOS_INTERIOR, thePickResult))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
SelectBasics.hxx
|
SelectBasics.hxx
|
||||||
SelectBasics_EntityOwner.hxx
|
SelectBasics_EntityOwner.hxx
|
||||||
SelectBasics_PickResult.hxx
|
SelectBasics_PickResult.hxx
|
||||||
|
SelectBasics_SelectingVolumeManager.cxx
|
||||||
SelectBasics_SelectingVolumeManager.hxx
|
SelectBasics_SelectingVolumeManager.hxx
|
||||||
SelectBasics_SensitiveEntity.hxx
|
SelectBasics_SensitiveEntity.hxx
|
||||||
|
43
src/SelectBasics/SelectBasics_SelectingVolumeManager.cxx
Normal file
43
src/SelectBasics/SelectBasics_SelectingVolumeManager.cxx
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) 2021 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <SelectBasics_SelectingVolumeManager.hxx>
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SelectBasics_SelectingVolumeManager
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
SelectBasics_SelectingVolumeManager::SelectBasics_SelectingVolumeManager()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : ~SelectBasics_SelectingVolumeManager
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
SelectBasics_SelectingVolumeManager::~SelectBasics_SelectingVolumeManager()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : Overlaps
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
Standard_Boolean SelectBasics_SelectingVolumeManager::Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
||||||
|
Standard_Integer theSensType,
|
||||||
|
SelectBasics_PickResult& thePickResult) const
|
||||||
|
{
|
||||||
|
return OverlapsPolygon (theArrayOfPts->Array1(), theSensType, thePickResult);
|
||||||
|
}
|
@ -20,6 +20,7 @@
|
|||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <TColgp_HArray1OfPnt.hxx>
|
#include <TColgp_HArray1OfPnt.hxx>
|
||||||
#include <SelectBasics_PickResult.hxx>
|
#include <SelectBasics_PickResult.hxx>
|
||||||
|
#include <SelectMgr_SelectionType.hxx>
|
||||||
#include <Standard_Dump.hxx>
|
#include <Standard_Dump.hxx>
|
||||||
|
|
||||||
class Bnd_Box;
|
class Bnd_Box;
|
||||||
@ -33,12 +34,17 @@ class SelectBasics_SelectingVolumeManager
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SelectBasics_SelectingVolumeManager() {}
|
//! Empty constructor.
|
||||||
|
SelectBasics_SelectingVolumeManager();
|
||||||
|
|
||||||
virtual ~SelectBasics_SelectingVolumeManager() {}
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~SelectBasics_SelectingVolumeManager();
|
||||||
|
|
||||||
|
//! Return selection type.
|
||||||
virtual Standard_Integer GetActiveSelectionType() const = 0;
|
virtual Standard_Integer GetActiveSelectionType() const = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by box theBox
|
//! Returns true if selecting volume is overlapped by box theBox
|
||||||
virtual Standard_Boolean OverlapsBox (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
virtual Standard_Boolean OverlapsBox (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
||||||
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||||
@ -59,12 +65,6 @@ public:
|
|||||||
//! helper function for inclusion test.
|
//! helper function for inclusion test.
|
||||||
virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const = 0;
|
virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
|
||||||
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
|
||||||
virtual Standard_Boolean OverlapsPolygon (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
|
||||||
Standard_Integer theSensType,
|
|
||||||
SelectBasics_PickResult& thePickResult) const = 0;
|
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
||||||
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
||||||
virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPts,
|
virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPts,
|
||||||
@ -85,12 +85,16 @@ public:
|
|||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
SelectBasics_PickResult& thePickResult) const = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//! Calculates distance from 3d projection of user-defined selection point
|
//! Calculates distance from 3d projection of user-defined selection point
|
||||||
//! to the given point theCOG
|
//! to the given point theCOG
|
||||||
virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const = 0;
|
virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const = 0;
|
||||||
|
|
||||||
|
//! Return 3D point corresponding to specified depth within picking ray.
|
||||||
virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
|
virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
|
||||||
|
|
||||||
|
//! Returns flag indicating if partial overlapping of entities is allowed or should be rejected.
|
||||||
virtual Standard_Boolean IsOverlapAllowed() const = 0;
|
virtual Standard_Boolean IsOverlapAllowed() const = 0;
|
||||||
|
|
||||||
//! Valid only for point and rectangular selection.
|
//! Valid only for point and rectangular selection.
|
||||||
@ -126,6 +130,85 @@ public:
|
|||||||
(void )theOStream;
|
(void )theOStream;
|
||||||
(void )theDepth;
|
(void )theDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsBox()")
|
||||||
|
Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
||||||
|
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||||
|
SelectBasics_PickResult& thePickResult) const
|
||||||
|
{
|
||||||
|
return OverlapsBox (theBoxMin, theBoxMax, thePickResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsBox()")
|
||||||
|
Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
||||||
|
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||||
|
Standard_Boolean* theInside = NULL) const
|
||||||
|
{
|
||||||
|
return OverlapsBox (theBoxMin, theBoxMax, theInside);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsPoint()")
|
||||||
|
Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
|
SelectBasics_PickResult& thePickResult) const
|
||||||
|
{
|
||||||
|
return OverlapsPoint (thePnt, thePickResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsPoint()")
|
||||||
|
Standard_Boolean Overlaps (const gp_Pnt& thePnt) const
|
||||||
|
{
|
||||||
|
return OverlapsPoint (thePnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsPolygon()")
|
||||||
|
Standard_EXPORT Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
||||||
|
Standard_Integer theSensType,
|
||||||
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsPolygon()")
|
||||||
|
Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
||||||
|
Standard_Integer theSensType,
|
||||||
|
SelectBasics_PickResult& thePickResult) const
|
||||||
|
{
|
||||||
|
return OverlapsPolygon (theArrayOfPts, theSensType, thePickResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsSegment()")
|
||||||
|
Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
|
const gp_Pnt& thePnt2,
|
||||||
|
SelectBasics_PickResult& thePickResult) const
|
||||||
|
{
|
||||||
|
return OverlapsSegment (thePnt1, thePnt2, thePickResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("Deprecated alias for OverlapsTriangle()")
|
||||||
|
Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
|
const gp_Pnt& thePnt2,
|
||||||
|
const gp_Pnt& thePnt3,
|
||||||
|
Standard_Integer theSensType,
|
||||||
|
SelectBasics_PickResult& thePickResult) const
|
||||||
|
{
|
||||||
|
return OverlapsTriangle (thePnt1, thePnt2, thePnt3, theSensType, thePickResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Deprecated static const class members aren't supported for Visual Studio prior to 2015 (vc14)
|
||||||
|
//! and GCC >= 5.0 and GCC < 6.3 (due to bug when warning was raised without member usage).
|
||||||
|
#if (!defined(_MSC_VER) || (_MSC_VER >= 1900)) && (!defined(__GNUC__) || (__GNUC__ != 5 && (__GNUC__ != 6 || __GNUC_MINOR__ >= 3)))
|
||||||
|
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
||||||
|
static const SelectMgr_SelectionType Point = SelectMgr_SelectionType_Point;
|
||||||
|
|
||||||
|
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
||||||
|
static const SelectMgr_SelectionType Box = SelectMgr_SelectionType_Box;
|
||||||
|
|
||||||
|
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
||||||
|
static const SelectMgr_SelectionType Polyline = SelectMgr_SelectionType_Polyline;
|
||||||
|
|
||||||
|
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
||||||
|
static const SelectMgr_SelectionType Unknown = SelectMgr_SelectionType_Unknown;
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SelectBasics_SelectingVolumeManager_HeaderFile
|
#endif // _SelectBasics_SelectingVolumeManager_HeaderFile
|
||||||
|
@ -25,6 +25,16 @@
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
SelectMgr_AxisIntersector::SelectMgr_AxisIntersector()
|
SelectMgr_AxisIntersector::SelectMgr_AxisIntersector()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : ~SelectMgr_AxisIntersector
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
SelectMgr_AxisIntersector::~SelectMgr_AxisIntersector()
|
||||||
|
{
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
Standard_EXPORT SelectMgr_AxisIntersector();
|
Standard_EXPORT SelectMgr_AxisIntersector();
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~SelectMgr_AxisIntersector() {}
|
Standard_EXPORT virtual ~SelectMgr_AxisIntersector();
|
||||||
|
|
||||||
//! Initializes selecting axis according to the input one
|
//! Initializes selecting axis according to the input one
|
||||||
Standard_EXPORT void Init (const gp_Ax1& theAxis);
|
Standard_EXPORT void Init (const gp_Ax1& theAxis);
|
||||||
@ -37,14 +37,16 @@ public:
|
|||||||
//! NOTE: it should be called after Init() method
|
//! NOTE: it should be called after Init() method
|
||||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Returns FALSE (not applicable to this volume).
|
||||||
|
virtual Standard_Boolean IsScalable() const Standard_OVERRIDE { return false; }
|
||||||
|
|
||||||
//! IMPORTANT: Scaling doesn't make sense for this intersector.
|
//! IMPORTANT: Scaling doesn't make sense for this intersector.
|
||||||
//! Returns a copy of the intersector transformed using the matrix given.
|
//! Returns a copy of the intersector transformed using the matrix given.
|
||||||
//! Builder is an optional argument that represents corresponding settings for re-constructing transformed
|
//! Builder is an optional argument that represents corresponding settings for re-constructing transformed frustum from scratch.
|
||||||
//! frustum from scratch. Can be null if reconstruction is not expected furthermore.
|
//! Can be null if reconstruction is not expected furthermore.
|
||||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector)
|
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScaleFactor,
|
||||||
ScaleAndTransform (const Standard_Integer theScaleFactor,
|
|
||||||
const gp_GTrsf& theTrsf,
|
const gp_GTrsf& theTrsf,
|
||||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder = Handle(SelectMgr_FrustumBuilder)()) const Standard_OVERRIDE;
|
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -23,8 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseFrustum, SelectMgr_BaseIntersector)
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : SelectMgr_BaseFrustum
|
// function : SelectMgr_BaseFrustum
|
||||||
// purpose : Creates new selecting volume with pixel toletance set to 2,
|
// purpose :
|
||||||
// orthographic camera and empty frustum builder
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SelectMgr_BaseFrustum::SelectMgr_BaseFrustum()
|
SelectMgr_BaseFrustum::SelectMgr_BaseFrustum()
|
||||||
: myPixelTolerance (2),
|
: myPixelTolerance (2),
|
||||||
@ -143,94 +142,6 @@ void SelectMgr_BaseFrustum::SetBuilder (const Handle(SelectMgr_FrustumBuilder)&
|
|||||||
myBuilder = theBuilder;
|
myBuilder = theBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsBox
|
|
||||||
// purpose : SAT intersection test between defined volume and
|
|
||||||
// given axis-aligned box
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsBox (const SelectMgr_Vec3& /*theBoxMin*/,
|
|
||||||
const SelectMgr_Vec3& /*theBoxMax*/,
|
|
||||||
const SelectMgr_ViewClipRange& /*theClipRange*/,
|
|
||||||
SelectBasics_PickResult& /*thePickResult*/) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsBox
|
|
||||||
// purpose : Intersection test between defined volume and given point
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsBox (const SelectMgr_Vec3& /*theBoxMin*/,
|
|
||||||
const SelectMgr_Vec3& /*theBoxMax*/,
|
|
||||||
Standard_Boolean* /*theInside*/) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPoint
|
|
||||||
// purpose : Intersection test between defined volume and given point
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsPoint (const gp_Pnt& /*thePnt*/,
|
|
||||||
const SelectMgr_ViewClipRange& /*theClipRange*/,
|
|
||||||
SelectBasics_PickResult& ) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPoint
|
|
||||||
// purpose : Intersection test between defined volume and given point
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsPoint (const gp_Pnt& /*thePnt*/) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPolygon
|
|
||||||
// purpose : SAT intersection test between defined volume and given
|
|
||||||
// ordered set of points, representing line segments. The test
|
|
||||||
// may be considered of interior part or boundary line defined
|
|
||||||
// by segments depending on given sensitivity type
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsPolygon (const TColgp_Array1OfPnt& /*theArrayOfPnts*/,
|
|
||||||
Select3D_TypeOfSensitivity /*theSensType*/,
|
|
||||||
const SelectMgr_ViewClipRange& /*theClipRange*/,
|
|
||||||
SelectBasics_PickResult& ) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsTriangle
|
|
||||||
// purpose : SAT intersection test between defined volume and given
|
|
||||||
// triangle. The test may be considered of interior part or
|
|
||||||
// boundary line defined by triangle vertices depending on
|
|
||||||
// given sensitivity type
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsTriangle (const gp_Pnt& /*thePt1*/,
|
|
||||||
const gp_Pnt& /*thePt2*/,
|
|
||||||
const gp_Pnt& /*thePt3*/,
|
|
||||||
Select3D_TypeOfSensitivity /*theSensType*/,
|
|
||||||
const SelectMgr_ViewClipRange& /*theClipRange*/,
|
|
||||||
SelectBasics_PickResult& ) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsSegment
|
|
||||||
// purpose : Checks if line segment overlaps selecting volume
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::OverlapsSegment (const gp_Pnt& /*thePnt1*/,
|
|
||||||
const gp_Pnt& /*thePnt2*/,
|
|
||||||
const SelectMgr_ViewClipRange& /*theClipRange*/,
|
|
||||||
SelectBasics_PickResult& ) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : DumpJson
|
//function : DumpJson
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -27,7 +27,7 @@ class SelectMgr_BaseFrustum : public SelectMgr_BaseIntersector
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Creates new selecting volume with pixel toletance set to 2,
|
//! Creates new selecting volume with pixel tolerance set to 2,
|
||||||
//! orthographic camera and empty frustum builder
|
//! orthographic camera and empty frustum builder
|
||||||
Standard_EXPORT SelectMgr_BaseFrustum();
|
Standard_EXPORT SelectMgr_BaseFrustum();
|
||||||
|
|
||||||
@ -72,55 +72,6 @@ public:
|
|||||||
const Standard_Real theWidth,
|
const Standard_Real theWidth,
|
||||||
const Standard_Real theHeight) Standard_OVERRIDE;
|
const Standard_Real theHeight) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
|
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
|
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
|
||||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt,
|
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
|
||||||
//! Does not perform depth calculation, so this method is defined as
|
|
||||||
//! helper function for inclusion test. Therefore, its implementation
|
|
||||||
//! makes sense only for rectangular frustum with box selection mode activated.
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
|
||||||
//! representing line segments. The test may be considered of interior part or
|
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPnts,
|
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsSegment (const gp_Pnt& thePnt1,
|
|
||||||
const gp_Pnt& thePnt2,
|
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
|
||||||
//! depending on given sensitivity type
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsTriangle (const gp_Pnt& thePt1,
|
|
||||||
const gp_Pnt& thePt2,
|
|
||||||
const gp_Pnt& thePt3,
|
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Dumps the content of me into the stream
|
//! Dumps the content of me into the stream
|
||||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
@ -18,14 +18,22 @@
|
|||||||
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseIntersector, Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseIntersector, Standard_Transient)
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : ScaleAndTransform
|
// function : SelectMgr_BaseIntersector
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Handle(SelectMgr_BaseIntersector) SelectMgr_BaseIntersector::ScaleAndTransform (const Standard_Integer,
|
SelectMgr_BaseIntersector::SelectMgr_BaseIntersector()
|
||||||
const gp_GTrsf&,
|
: mySelectionType (SelectMgr_SelectionType_Unknown)
|
||||||
const Handle(SelectMgr_FrustumBuilder)&) const
|
|
||||||
{
|
{
|
||||||
return NULL;
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : ~SelectMgr_BaseIntersector
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
SelectMgr_BaseIntersector::~SelectMgr_BaseIntersector()
|
||||||
|
{
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -164,88 +172,6 @@ const gp_Pnt2d& SelectMgr_BaseIntersector::GetMousePosition() const
|
|||||||
return aPnt;
|
return aPnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsBox
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsBox (const SelectMgr_Vec3&,
|
|
||||||
const SelectMgr_Vec3&,
|
|
||||||
const SelectMgr_ViewClipRange&,
|
|
||||||
SelectBasics_PickResult&) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsBox
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsBox (const SelectMgr_Vec3&,
|
|
||||||
const SelectMgr_Vec3&,
|
|
||||||
Standard_Boolean*) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPoint
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsPoint (const gp_Pnt&,
|
|
||||||
const SelectMgr_ViewClipRange&,
|
|
||||||
SelectBasics_PickResult&) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPoint
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsPoint (const gp_Pnt& thePnt) const
|
|
||||||
{
|
|
||||||
(void )thePnt;
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPolygon
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsPolygon (const TColgp_Array1OfPnt&,
|
|
||||||
Select3D_TypeOfSensitivity,
|
|
||||||
const SelectMgr_ViewClipRange&,
|
|
||||||
SelectBasics_PickResult&) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsTriangle
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsTriangle (const gp_Pnt&,
|
|
||||||
const gp_Pnt&,
|
|
||||||
const gp_Pnt&,
|
|
||||||
Select3D_TypeOfSensitivity,
|
|
||||||
const SelectMgr_ViewClipRange&,
|
|
||||||
SelectBasics_PickResult&) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsSegment
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_BaseIntersector::OverlapsSegment (const gp_Pnt&,
|
|
||||||
const gp_Pnt&,
|
|
||||||
const SelectMgr_ViewClipRange&,
|
|
||||||
SelectBasics_PickResult&) const
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : DistToGeometryCenter
|
// function : DistToGeometryCenter
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -39,15 +39,13 @@ class SelectMgr_BaseIntersector : public Standard_Transient
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Creates new empty selecting volume
|
//! Creates new empty selecting volume
|
||||||
SelectMgr_BaseIntersector()
|
Standard_EXPORT SelectMgr_BaseIntersector();
|
||||||
: mySelectionType (SelectMgr_SelectionType_Unknown)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~SelectMgr_BaseIntersector() {}
|
Standard_EXPORT virtual ~SelectMgr_BaseIntersector();
|
||||||
|
|
||||||
//! Builds intersector according to internal parameters
|
//! Builds intersector according to internal parameters
|
||||||
virtual void Build() {}
|
virtual void Build() = 0;
|
||||||
|
|
||||||
//! Returns selection type of this intersector
|
//! Returns selection type of this intersector
|
||||||
SelectMgr_SelectionType GetSelectionType() const { return mySelectionType; }
|
SelectMgr_SelectionType GetSelectionType() const { return mySelectionType; }
|
||||||
@ -55,27 +53,23 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Checks if it is possible to scale this intersector.
|
//! Checks if it is possible to scale this intersector.
|
||||||
//! @return false for the base class.
|
virtual Standard_Boolean IsScalable() const = 0;
|
||||||
virtual Standard_Boolean IsScalable() const { return Standard_False; }
|
|
||||||
|
|
||||||
//! Sets pixel tolerance.
|
//! Sets pixel tolerance.
|
||||||
//! It makes sense only for scalable intersectors (built on a single point).
|
//! It makes sense only for scalable intersectors (built on a single point).
|
||||||
//! This method does nothing for the base class.
|
//! This method does nothing for the base class.
|
||||||
Standard_EXPORT virtual void SetPixelTolerance (const Standard_Integer theTol);
|
Standard_EXPORT virtual void SetPixelTolerance (const Standard_Integer theTol);
|
||||||
|
|
||||||
//! IMPORTANT: Scaling makes sense only for scalable intersectors (built on a single point)!
|
|
||||||
//! Note that this method does not perform any checks on type of the frustum.
|
//! Note that this method does not perform any checks on type of the frustum.
|
||||||
//! Returns a copy of the frustum resized according to the scale factor given
|
//! @param theScaleFactor [in] scale factor for new intersector or negative value if undefined;
|
||||||
//! and transforms it using the matrix given.
|
//! IMPORTANT: scaling makes sense only for scalable ::IsScalable() intersectors (built on a single point)!
|
||||||
//! There are no default parameters, but in case if:
|
//! @param theTrsf [in] transformation for new intersector or gp_Identity if undefined
|
||||||
//! - transformation only is needed: @theScaleFactor must be initialized as any negative value;
|
//! @param theBuilder [in] an optional argument that represents corresponding settings for re-constructing transformed frustum from scratch;
|
||||||
//! - scale only is needed: @theTrsf must be set to gp_Identity.
|
//! could be NULL if reconstruction is not expected furthermore
|
||||||
//! Builder is an optional argument that represents corresponding settings for re-constructing transformed
|
//! @return a copy of the frustum resized according to the scale factor given and transforms it using the matrix given
|
||||||
//! frustum from scratch. Can be null if reconstruction is not expected furthermore.
|
virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScaleFactor,
|
||||||
//! This method does nothing for the base class.
|
|
||||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScaleFactor,
|
|
||||||
const gp_GTrsf& theTrsf,
|
const gp_GTrsf& theTrsf,
|
||||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const;
|
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -150,51 +144,50 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
//! SAT intersection test between defined volume and given axis-aligned box
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
|
virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
|
virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside = NULL) const;
|
Standard_Boolean* theInside = NULL) const = 0;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt,
|
virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
//! Does not perform depth calculation, so this method is defined as
|
//! Does not perform depth calculation, so this method is defined as helper function for inclusion test.
|
||||||
//! helper function for inclusion test. Therefore, its implementation
|
//! Therefore, its implementation makes sense only for rectangular frustum with box selection mode activated.
|
||||||
//! makes sense only for rectangular frustum with box selection mode activated.
|
virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const = 0;
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const;
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPnts,
|
virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
//! Checks if line segment overlaps selecting frustum
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsSegment (const gp_Pnt& thePnt1,
|
virtual Standard_Boolean OverlapsSegment (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
//! SAT intersection test between defined volume and given triangle. The test may
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
//! be considered of interior part or boundary line defined by triangle vertices
|
||||||
//! depending on given sensitivity type
|
//! depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsTriangle (const gp_Pnt& thePt1,
|
virtual Standard_Boolean OverlapsTriangle (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -390,26 +390,6 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsPoint (const gp_Pnt&
|
|||||||
return myActiveSelectingVolume->OverlapsPoint (thePnt);
|
return myActiveSelectingVolume->OverlapsPoint (thePnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : OverlapsPolygon
|
|
||||||
// purpose : SAT intersection test between defined volume and given
|
|
||||||
// ordered set of points, representing line segments. The test
|
|
||||||
// may be considered of interior part or boundary line defined
|
|
||||||
// by segments depending on given sensitivity type
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsPolygon (const Handle(TColgp_HArray1OfPnt)& theArrayOfPnts,
|
|
||||||
Standard_Integer theSensType,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
if (myActiveSelectingVolume.IsNull())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
return myActiveSelectingVolume->OverlapsPolygon (theArrayOfPnts->Array1(), (Select3D_TypeOfSensitivity)theSensType,
|
|
||||||
myViewClipRange, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OverlapsPolygon
|
// function : OverlapsPolygon
|
||||||
// purpose : SAT intersection test between defined volume and given
|
// purpose : SAT intersection test between defined volume and given
|
||||||
|
@ -147,13 +147,6 @@ public:
|
|||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
|
||||||
//! representing line segments. The test may be considered of interior part or
|
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPolygon (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
|
||||||
Standard_Integer theSensType,
|
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
@ -248,22 +241,6 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Deprecated static const class members aren't supported for Visual Studio prior to 2015 (vc14)
|
|
||||||
//! and GCC >= 5.0 and GCC < 6.3 (due to bug when warning was raised without member usage).
|
|
||||||
#if (!defined(_MSC_VER) || (_MSC_VER >= 1900)) && (!defined(__GNUC__) || (__GNUC__ != 5 && (__GNUC__ != 6 || __GNUC_MINOR__ >= 3)))
|
|
||||||
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
|
||||||
static const SelectMgr_SelectionType Point = SelectMgr_SelectionType_Point;
|
|
||||||
|
|
||||||
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
|
||||||
static const SelectMgr_SelectionType Box = SelectMgr_SelectionType_Box;
|
|
||||||
|
|
||||||
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
|
||||||
static const SelectMgr_SelectionType Polyline = SelectMgr_SelectionType_Polyline;
|
|
||||||
|
|
||||||
Standard_DEPRECATED("Deprecated alias - SelectMgr_SelectionType should be used instead")
|
|
||||||
static const SelectMgr_SelectionType Unknown = SelectMgr_SelectionType_Unknown;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Standard_DEPRECATED("Deprecated method - InitPointSelectingVolume() and Build() methods should be used instead")
|
Standard_DEPRECATED("Deprecated method - InitPointSelectingVolume() and Build() methods should be used instead")
|
||||||
Standard_EXPORT void BuildSelectingVolume (const gp_Pnt2d& thePoint);
|
Standard_EXPORT void BuildSelectingVolume (const gp_Pnt2d& thePoint);
|
||||||
|
|
||||||
@ -274,84 +251,6 @@ public:
|
|||||||
Standard_DEPRECATED("Deprecated method - InitPolylineSelectingVolume() and Build() should be used instead")
|
Standard_DEPRECATED("Deprecated method - InitPolylineSelectingVolume() and Build() should be used instead")
|
||||||
Standard_EXPORT void BuildSelectingVolume (const TColgp_Array1OfPnt2d& thePoints);
|
Standard_EXPORT void BuildSelectingVolume (const TColgp_Array1OfPnt2d& thePoints);
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsBox() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
return OverlapsBox (theBoxMin, theBoxMax, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsBox() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
|
||||||
Standard_Boolean* theInside = NULL) const
|
|
||||||
{
|
|
||||||
return OverlapsBox (theBoxMin, theBoxMax, theInside);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsPoint() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
return OverlapsPoint (thePnt, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsPoint() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const gp_Pnt& thePnt) const
|
|
||||||
{
|
|
||||||
return OverlapsPoint (thePnt);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
|
||||||
//! representing line segments. The test may be considered of interior part or
|
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsPolygon() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
|
||||||
Standard_Integer theSensType,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
return OverlapsPolygon (theArrayOfPts, theSensType, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
|
||||||
//! representing line segments. The test may be considered of interior part or
|
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsPolygon() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
|
||||||
Standard_Integer theSensType,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
return OverlapsPolygon (theArrayOfPts, theSensType, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsSegment() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
|
||||||
const gp_Pnt& thePnt2,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
return OverlapsSegment (thePnt1, thePnt2, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
|
||||||
//! depending on given sensitivity type
|
|
||||||
Standard_DEPRECATED ("Deprecated method - OverlapsTriangle() should be used instead")
|
|
||||||
Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
|
||||||
const gp_Pnt& thePnt2,
|
|
||||||
const gp_Pnt& thePnt3,
|
|
||||||
Standard_Integer theSensType,
|
|
||||||
SelectBasics_PickResult& thePickResult) const
|
|
||||||
{
|
|
||||||
return OverlapsTriangle (thePnt1, thePnt2, thePnt3, theSensType, thePickResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Handle(SelectMgr_BaseIntersector) myActiveSelectingVolume;
|
Handle(SelectMgr_BaseIntersector) myActiveSelectingVolume;
|
||||||
Handle(Graphic3d_SequenceOfHClipPlane) myViewClipPlanes; //!< view clipping planes
|
Handle(Graphic3d_SequenceOfHClipPlane) myViewClipPlanes; //!< view clipping planes
|
||||||
|
@ -17,12 +17,7 @@
|
|||||||
|
|
||||||
#include <SelectMgr_FrustumBuilder.hxx>
|
#include <SelectMgr_FrustumBuilder.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum,Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, Standard_Transient)
|
||||||
|
|
||||||
SelectMgr_TriangularFrustum::~SelectMgr_TriangularFrustum()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -41,6 +36,24 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SelectMgr_TriangularFrustum
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
SelectMgr_TriangularFrustum::SelectMgr_TriangularFrustum()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : ~SelectMgr_TriangularFrustum
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
SelectMgr_TriangularFrustum::~SelectMgr_TriangularFrustum()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : cacheVertexProjections
|
// function : cacheVertexProjections
|
||||||
// purpose : Caches projection of frustum's vertices onto its plane directions
|
// purpose : Caches projection of frustum's vertices onto its plane directions
|
||||||
|
@ -19,19 +19,11 @@
|
|||||||
#include <SelectMgr_Frustum.hxx>
|
#include <SelectMgr_Frustum.hxx>
|
||||||
|
|
||||||
//! This class contains representation of triangular selecting frustum, created in case
|
//! This class contains representation of triangular selecting frustum, created in case
|
||||||
//! of polyline selection, and algorithms for overlap detection between selecting
|
//! of polyline selection, and algorithms for overlap detection between selecting frustum and sensitive entities.
|
||||||
//! frustum and sensitive entities.
|
//! Overlap detection tests are implemented according to the terms of separating axis theorem (SAT).
|
||||||
//! Overlap detection tests are implemented according to the terms of separating axis
|
|
||||||
//! theorem (SAT).
|
|
||||||
//! NOTE: the object of this class can be created only as part of SelectMgr_TriangularFrustumSet.
|
//! NOTE: the object of this class can be created only as part of SelectMgr_TriangularFrustumSet.
|
||||||
class SelectMgr_TriangularFrustum : public SelectMgr_Frustum<3>
|
class SelectMgr_TriangularFrustum : public SelectMgr_Frustum<3>
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
|
|
||||||
//! Creates new triangular frustum with bases of triangles with vertices theP1,
|
|
||||||
//! theP2 and theP3 projections onto near and far view frustum planes
|
|
||||||
SelectMgr_TriangularFrustum() {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Auxiliary structure to define selection triangle
|
//! Auxiliary structure to define selection triangle
|
||||||
@ -40,7 +32,10 @@ public:
|
|||||||
gp_Pnt2d Points[3];
|
gp_Pnt2d Points[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
Standard_EXPORT ~SelectMgr_TriangularFrustum();
|
public:
|
||||||
|
|
||||||
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~SelectMgr_TriangularFrustum();
|
||||||
|
|
||||||
//! Initializes selection triangle by input points
|
//! Initializes selection triangle by input points
|
||||||
Standard_EXPORT void Init (const gp_Pnt2d& theP1,
|
Standard_EXPORT void Init (const gp_Pnt2d& theP1,
|
||||||
@ -52,12 +47,15 @@ public:
|
|||||||
//! NOTE: it should be called after Init() method
|
//! NOTE: it should be called after Init() method
|
||||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Returns FALSE (not applicable to this volume).
|
||||||
|
virtual Standard_Boolean IsScalable() const Standard_OVERRIDE { return false; }
|
||||||
|
|
||||||
//! Returns a copy of the frustum transformed according to the matrix given
|
//! Returns a copy of the frustum transformed according to the matrix given
|
||||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScale,
|
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScale,
|
||||||
const gp_GTrsf& theTrsf,
|
const gp_GTrsf& theTrsf,
|
||||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||||
|
|
||||||
// SAT Tests for different objects
|
public: //! @name SAT Tests for different objects
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
//! SAT intersection test between defined volume and given axis-aligned box
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
|
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
|
||||||
@ -76,6 +74,12 @@ public:
|
|||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Always returns FALSE (not applicable to this selector).
|
||||||
|
virtual Standard_Boolean OverlapsPoint (const gp_Pnt& ) const Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
@ -100,6 +104,8 @@ public:
|
|||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
|
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
|
||||||
Standard_EXPORT void Clear();
|
Standard_EXPORT void Clear();
|
||||||
|
|
||||||
@ -110,6 +116,11 @@ public:
|
|||||||
//! Dumps the content of me into the stream
|
//! Dumps the content of me into the stream
|
||||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! Creates an empty triangular frustum.
|
||||||
|
Standard_EXPORT SelectMgr_TriangularFrustum();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void cacheVertexProjections (SelectMgr_TriangularFrustum* theFrustum) const;
|
void cacheVertexProjections (SelectMgr_TriangularFrustum* theFrustum) const;
|
||||||
@ -121,7 +132,6 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, SelectMgr_Frustum<3>)
|
DEFINE_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, SelectMgr_Frustum<3>)
|
||||||
|
|
||||||
friend class SelectMgr_TriangularFrustumSet;
|
friend class SelectMgr_TriangularFrustumSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,14 +13,17 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <SelectMgr_TriangularFrustumSet.hxx>
|
||||||
|
|
||||||
#include <BRepMesh_DataStructureOfDelaun.hxx>
|
#include <BRepMesh_DataStructureOfDelaun.hxx>
|
||||||
#include <BRepMesh_Delaun.hxx>
|
#include <BRepMesh_Delaun.hxx>
|
||||||
#include <NCollection_IncAllocator.hxx>
|
#include <NCollection_IncAllocator.hxx>
|
||||||
#include <SelectMgr_FrustumBuilder.hxx>
|
#include <SelectMgr_FrustumBuilder.hxx>
|
||||||
|
|
||||||
#include <SelectMgr_TriangularFrustumSet.hxx>
|
namespace
|
||||||
|
{
|
||||||
#define MEMORY_BLOCK_SIZE 512 * 7
|
static const size_t MEMORY_BLOCK_SIZE = 512 * 7;
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SelectMgr_TriangularFrustumSet
|
// function : SelectMgr_TriangularFrustumSet
|
||||||
@ -31,6 +34,15 @@ SelectMgr_TriangularFrustumSet::SelectMgr_TriangularFrustumSet()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : ~SelectMgr_TriangularFrustumSet
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
SelectMgr_TriangularFrustumSet::~SelectMgr_TriangularFrustumSet()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Init
|
// function : Init
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -150,8 +162,7 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustumSet::ScaleAndTransf
|
|||||||
"Error! SelectMgr_TriangularFrustumSet::ScaleAndTransform() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::ScaleAndTransform() should be called after selection frustum initialization");
|
||||||
|
|
||||||
Handle(SelectMgr_TriangularFrustumSet) aRes = new SelectMgr_TriangularFrustumSet();
|
Handle(SelectMgr_TriangularFrustumSet) aRes = new SelectMgr_TriangularFrustumSet();
|
||||||
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
|
||||||
{
|
{
|
||||||
aRes->myFrustums.Append (Handle(SelectMgr_TriangularFrustum)::DownCast (anIter.Value()->ScaleAndTransform (theScale, theTrsf, theBuilder)));
|
aRes->myFrustums.Append (Handle(SelectMgr_TriangularFrustum)::DownCast (anIter.Value()->ScaleAndTransform (theScale, theTrsf, theBuilder)));
|
||||||
}
|
}
|
||||||
@ -182,11 +193,13 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsBox (const SelectMgr_Ve
|
|||||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->OverlapsBox (theMinPnt, theMaxPnt, theClipRange, thePickResult))
|
if (anIter.Value()->OverlapsBox (theMinPnt, theMaxPnt, theClipRange, thePickResult))
|
||||||
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@ -202,16 +215,18 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsBox (const SelectMgr_Ve
|
|||||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->OverlapsBox (theMinPnt, theMaxPnt, NULL))
|
if (!anIter.Value()->OverlapsBox (theMinPnt, theMaxPnt, NULL))
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (myToAllowOverlap || theInside == NULL)
|
if (myToAllowOverlap || theInside == NULL)
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
gp_Pnt aMinMaxPnts[2] = { gp_Pnt (theMinPnt.x(), theMinPnt.y(), theMinPnt.z()),
|
gp_Pnt aMinMaxPnts[2] = { gp_Pnt (theMinPnt.x(), theMinPnt.y(), theMinPnt.z()),
|
||||||
gp_Pnt (theMaxPnt.x(), theMaxPnt.y(), theMaxPnt.z())};
|
gp_Pnt (theMaxPnt.x(), theMaxPnt.y(), theMaxPnt.z())};
|
||||||
|
|
||||||
@ -236,8 +251,6 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsBox (const SelectMgr_Ve
|
|||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@ -253,11 +266,13 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsPoint (const gp_Pnt& th
|
|||||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->OverlapsPoint (thePnt, theClipRange, thePickResult))
|
if (anIter.Value()->OverlapsPoint (thePnt, theClipRange, thePickResult))
|
||||||
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@ -274,16 +289,18 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsPolygon (const TColgp_A
|
|||||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->OverlapsPolygon (theArrayOfPts, theSensType, theClipRange, thePickResult))
|
if (!anIter.Value()->OverlapsPolygon (theArrayOfPts, theSensType, theClipRange, thePickResult))
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (myToAllowOverlap)
|
if (myToAllowOverlap)
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Standard_Integer aPtsLower = theArrayOfPts.Lower();
|
Standard_Integer aPtsLower = theArrayOfPts.Lower();
|
||||||
Standard_Integer aPtsUpper = theArrayOfPts.Upper();
|
Standard_Integer aPtsUpper = theArrayOfPts.Upper();
|
||||||
for (Standard_Integer anIdx = aPtsLower; anIdx <= aPtsUpper; anIdx++)
|
for (Standard_Integer anIdx = aPtsLower; anIdx <= aPtsUpper; anIdx++)
|
||||||
@ -295,8 +312,6 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsPolygon (const TColgp_A
|
|||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@ -313,24 +328,24 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsSegment (const gp_Pnt&
|
|||||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->OverlapsSegment (thePnt1, thePnt2, theClipRange, thePickResult))
|
if (!anIter.Value()->OverlapsSegment (thePnt1, thePnt2, theClipRange, thePickResult))
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (myToAllowOverlap)
|
if (myToAllowOverlap)
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isIntersectBoundary (thePnt1, thePnt2))
|
if (isIntersectBoundary (thePnt1, thePnt2))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@ -349,16 +364,18 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsTriangle (const gp_Pnt&
|
|||||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->OverlapsTriangle (thePnt1, thePnt2, thePnt3, theSensType, theClipRange, thePickResult))
|
if (!anIter.Value()->OverlapsTriangle (thePnt1, thePnt2, thePnt3, theSensType, theClipRange, thePickResult))
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (myToAllowOverlap)
|
if (myToAllowOverlap)
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isIntersectBoundary (thePnt1, thePnt2)
|
if (isIntersectBoundary (thePnt1, thePnt2)
|
||||||
|| isIntersectBoundary (thePnt2, thePnt3)
|
|| isIntersectBoundary (thePnt2, thePnt3)
|
||||||
|| isIntersectBoundary (thePnt3, thePnt1))
|
|| isIntersectBoundary (thePnt3, thePnt1))
|
||||||
@ -367,8 +384,6 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsTriangle (const gp_Pnt&
|
|||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@ -381,7 +396,7 @@ void SelectMgr_TriangularFrustumSet::GetPlanes (NCollection_Vector<SelectMgr_Vec
|
|||||||
{
|
{
|
||||||
thePlaneEquations.Clear();
|
thePlaneEquations.Clear();
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
anIter.Value()->GetPlanes (thePlaneEquations);
|
anIter.Value()->GetPlanes (thePlaneEquations);
|
||||||
}
|
}
|
||||||
@ -485,11 +500,9 @@ void SelectMgr_TriangularFrustumSet::DumpJson (Standard_OStream& theOStream, Sta
|
|||||||
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustumSet)
|
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustumSet)
|
||||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_BaseFrustum)
|
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_BaseFrustum)
|
||||||
|
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(SelectMgr_TriangularFrustum)& aFrustum = anIter.Value();
|
const Handle(SelectMgr_TriangularFrustum)& aFrustum = anIter.Value();
|
||||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aFrustum.get())
|
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aFrustum.get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef MEMORY_BLOCK_SIZE
|
|
||||||
|
@ -20,16 +20,14 @@
|
|||||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||||
|
|
||||||
typedef NCollection_List<Handle(SelectMgr_TriangularFrustum)> SelectMgr_TriangFrustums;
|
typedef NCollection_List<Handle(SelectMgr_TriangularFrustum)> SelectMgr_TriangFrustums;
|
||||||
typedef NCollection_List<Handle(SelectMgr_TriangularFrustum)>::Iterator SelectMgr_TriangFrustumsIter;
|
|
||||||
|
|
||||||
//! This class is used to handle polyline selection. The main principle of polyline selection
|
//! This class is used to handle polyline selection. The main principle of polyline selection
|
||||||
//! algorithm is to split the polygon defined by polyline onto triangles. Than each of
|
//! algorithm is to split the polygon defined by polyline onto triangles.
|
||||||
//! them is considered as a base for triangular frustum building. In other
|
//! Than each of them is considered as a base for triangular frustum building.
|
||||||
//! words, each triangle vertiex will be projected from 2d screen space to 3d world space
|
//! In other words, each triangle vertex will be projected from 2d screen space to 3d world space onto near and far view frustum planes.
|
||||||
//! onto near and far view frustum planes. Thus, the projected triangles make up the bases of
|
//! Thus, the projected triangles make up the bases of selecting frustum.
|
||||||
//! selecting frustum. When the set of such frustums is created, the function determining
|
//! When the set of such frustums is created, the function determining
|
||||||
//! selection iterates through triangular frustum set and searches for overlap with any
|
//! selection iterates through triangular frustum set and searches for overlap with any frustum.
|
||||||
//! frustum.
|
|
||||||
class SelectMgr_TriangularFrustumSet : public SelectMgr_BaseFrustum
|
class SelectMgr_TriangularFrustumSet : public SelectMgr_BaseFrustum
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -40,24 +38,32 @@ public:
|
|||||||
Handle(TColgp_HArray1OfPnt2d) Points;
|
Handle(TColgp_HArray1OfPnt2d) Points;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Constructor.
|
||||||
SelectMgr_TriangularFrustumSet();
|
SelectMgr_TriangularFrustumSet();
|
||||||
|
|
||||||
~SelectMgr_TriangularFrustumSet() {};
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~SelectMgr_TriangularFrustumSet();
|
||||||
|
|
||||||
//! Initializes set of triangular frustums by polyline
|
//! Initializes set of triangular frustums by polyline
|
||||||
Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& thePoints);
|
Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& thePoints);
|
||||||
|
|
||||||
//! Meshes polygon bounded by polyline. Than organizes a set of triangular frustums,
|
//! Meshes polygon bounded by polyline. Than organizes a set of triangular frustums,
|
||||||
//! where each triangle's projection onto near and far view frustum planes is
|
//! where each triangle's projection onto near and far view frustum planes is considered as a frustum base
|
||||||
//! considered as a frustum base
|
|
||||||
//! NOTE: it should be called after Init() method
|
//! NOTE: it should be called after Init() method
|
||||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Returns FALSE (not applicable to this volume).
|
||||||
|
virtual Standard_Boolean IsScalable() const Standard_OVERRIDE { return false; }
|
||||||
|
|
||||||
//! Returns a copy of the frustum with all sub-volumes transformed according to the matrix given
|
//! Returns a copy of the frustum with all sub-volumes transformed according to the matrix given
|
||||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScale,
|
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScale,
|
||||||
const gp_GTrsf& theTrsf,
|
const gp_GTrsf& theTrsf,
|
||||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
|
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
@ -71,6 +77,12 @@ public:
|
|||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Always returns FALSE (not applicable to this selector).
|
||||||
|
virtual Standard_Boolean OverlapsPoint (const gp_Pnt& ) const Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_EXPORT virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
@ -88,6 +100,8 @@ public:
|
|||||||
const SelectMgr_ViewClipRange& theClipRange,
|
const SelectMgr_ViewClipRange& theClipRange,
|
||||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth
|
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth
|
||||||
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
|
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user