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).
SelectBasics_PickResult aPickResult;
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);
}
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (aPolygIdx);
Handle(TColgp_HArray1OfPnt) aPoints;
aPolygon->Points3D (aPoints);
- return theMgr.OverlapsPolygon (aPoints, Select3D_TOS_INTERIOR, thePickResult);
+ return theMgr.OverlapsPolygon (aPoints->Array1(), Select3D_TOS_INTERIOR, thePickResult);
}
// =======================================================================
if (theMgr.GetActiveSelectionType() == SelectMgr_SelectionType_Polyline)
{
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)
{
return Standard_True;
}
- if (!theMgr.OverlapsPolygon (anArrayOfPnt, Select3D_TOS_INTERIOR, thePickResult))
+ if (!theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), Select3D_TOS_INTERIOR, thePickResult))
{
return Standard_False;
}
SelectBasics.hxx
SelectBasics_EntityOwner.hxx
SelectBasics_PickResult.hxx
+SelectBasics_SelectingVolumeManager.cxx
SelectBasics_SelectingVolumeManager.hxx
SelectBasics_SensitiveEntity.hxx
--- /dev/null
+// 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);
+}
#include <gp_Pnt.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <SelectBasics_PickResult.hxx>
+#include <SelectMgr_SelectionType.hxx>
#include <Standard_Dump.hxx>
class Bnd_Box;
{
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;
+public:
+
//! Returns true if selecting volume is overlapped by box theBox
virtual Standard_Boolean OverlapsBox (const NCollection_Vec3<Standard_Real>& theBoxMin,
const NCollection_Vec3<Standard_Real>& theBoxMax,
//! helper function for inclusion test.
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
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPts,
Standard_Integer theSensType,
SelectBasics_PickResult& thePickResult) const = 0;
+public:
+
//! Calculates distance from 3d projection of user-defined selection point
//! to the given point theCOG
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;
+ //! Returns flag indicating if partial overlapping of entities is allowed or should be rejected.
virtual Standard_Boolean IsOverlapAllowed() const = 0;
//! Valid only for point and rectangular selection.
(void )theOStream;
(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
// =======================================================================
SelectMgr_AxisIntersector::SelectMgr_AxisIntersector()
{
+ //
+}
+
+// =======================================================================
+// function : ~SelectMgr_AxisIntersector
+// purpose :
+// =======================================================================
+SelectMgr_AxisIntersector::~SelectMgr_AxisIntersector()
+{
+ //
}
// =======================================================================
Standard_EXPORT SelectMgr_AxisIntersector();
//! Destructor
- virtual ~SelectMgr_AxisIntersector() {}
+ Standard_EXPORT virtual ~SelectMgr_AxisIntersector();
//! Initializes selecting axis according to the input one
Standard_EXPORT void Init (const gp_Ax1& theAxis);
//! NOTE: it should be called after Init() method
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.
//! Returns a copy of the intersector transformed using the matrix given.
- //! Builder is an optional argument that represents corresponding settings for re-constructing transformed
- //! frustum from scratch. Can be null if reconstruction is not expected furthermore.
- Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector)
- ScaleAndTransform (const Standard_Integer theScaleFactor,
- const gp_GTrsf& theTrsf,
- const Handle(SelectMgr_FrustumBuilder)& theBuilder = Handle(SelectMgr_FrustumBuilder)()) const Standard_OVERRIDE;
+ //! Builder is an optional argument that represents corresponding settings for re-constructing transformed frustum from scratch.
+ //! Can be null if reconstruction is not expected furthermore.
+ Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScaleFactor,
+ const gp_GTrsf& theTrsf,
+ const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
public:
//=======================================================================
// function : SelectMgr_BaseFrustum
-// purpose : Creates new selecting volume with pixel toletance set to 2,
-// orthographic camera and empty frustum builder
+// purpose :
//=======================================================================
SelectMgr_BaseFrustum::SelectMgr_BaseFrustum()
: myPixelTolerance (2),
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
//purpose :
{
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
Standard_EXPORT SelectMgr_BaseFrustum();
const Standard_Real theWidth,
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
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseIntersector, Standard_Transient)
//=======================================================================
-// function : ScaleAndTransform
+// function : SelectMgr_BaseIntersector
// purpose :
//=======================================================================
-Handle(SelectMgr_BaseIntersector) SelectMgr_BaseIntersector::ScaleAndTransform (const Standard_Integer,
- const gp_GTrsf&,
- const Handle(SelectMgr_FrustumBuilder)&) const
+SelectMgr_BaseIntersector::SelectMgr_BaseIntersector()
+: mySelectionType (SelectMgr_SelectionType_Unknown)
{
- return NULL;
+ //
+}
+
+//=======================================================================
+// function : ~SelectMgr_BaseIntersector
+// purpose :
+//=======================================================================
+SelectMgr_BaseIntersector::~SelectMgr_BaseIntersector()
+{
+ //
}
//=======================================================================
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
// purpose :
public:
//! Creates new empty selecting volume
- SelectMgr_BaseIntersector()
- : mySelectionType (SelectMgr_SelectionType_Unknown)
- {}
+ Standard_EXPORT SelectMgr_BaseIntersector();
//! Destructor
- virtual ~SelectMgr_BaseIntersector() {}
+ Standard_EXPORT virtual ~SelectMgr_BaseIntersector();
//! Builds intersector according to internal parameters
- virtual void Build() {}
+ virtual void Build() = 0;
//! Returns selection type of this intersector
SelectMgr_SelectionType GetSelectionType() const { return mySelectionType; }
public:
//! Checks if it is possible to scale this intersector.
- //! @return false for the base class.
- virtual Standard_Boolean IsScalable() const { return Standard_False; }
+ virtual Standard_Boolean IsScalable() const = 0;
//! Sets pixel tolerance.
//! It makes sense only for scalable intersectors (built on a single point).
//! This method does nothing for the base class.
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.
- //! Returns a copy of the frustum resized according to the scale factor given
- //! and transforms it using the matrix given.
- //! There are no default parameters, but in case if:
- //! - transformation only is needed: @theScaleFactor must be initialized as any negative value;
- //! - scale only is needed: @theTrsf must be set to gp_Identity.
- //! Builder is an optional argument that represents corresponding settings for re-constructing transformed
- //! frustum from scratch. Can be null if reconstruction is not expected furthermore.
- //! This method does nothing for the base class.
- Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScaleFactor,
- const gp_GTrsf& theTrsf,
- const Handle(SelectMgr_FrustumBuilder)& theBuilder) const;
+ //! Note that this method does not perform any checks on type of the frustum.
+ //! @param theScaleFactor [in] scale factor for new intersector or negative value if undefined;
+ //! IMPORTANT: scaling makes sense only for scalable ::IsScalable() intersectors (built on a single point)!
+ //! @param theTrsf [in] transformation for new intersector or gp_Identity if undefined
+ //! @param theBuilder [in] an optional argument that represents corresponding settings for re-constructing transformed frustum from scratch;
+ //! could be NULL if reconstruction is not expected furthermore
+ //! @return a copy of the frustum resized according to the scale factor given and transforms it using the matrix given
+ virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScaleFactor,
+ const gp_GTrsf& theTrsf,
+ const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0;
public:
public:
//! 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;
+ virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
+ const SelectMgr_Vec3& theBoxMax,
+ const SelectMgr_ViewClipRange& theClipRange,
+ SelectBasics_PickResult& thePickResult) const = 0;
//! 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;
+ virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theBoxMin,
+ const SelectMgr_Vec3& theBoxMax,
+ Standard_Boolean* theInside = NULL) const = 0;
//! 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;
+ virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt,
+ const SelectMgr_ViewClipRange& theClipRange,
+ SelectBasics_PickResult& thePickResult) const = 0;
//! 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;
+ //! 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.
+ virtual Standard_Boolean OverlapsPoint (const gp_Pnt& thePnt) const = 0;
//! 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;
+ virtual Standard_Boolean OverlapsPolygon (const TColgp_Array1OfPnt& theArrayOfPnts,
+ Select3D_TypeOfSensitivity theSensType,
+ const SelectMgr_ViewClipRange& theClipRange,
+ SelectBasics_PickResult& thePickResult) const = 0;
//! 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;
+ virtual Standard_Boolean OverlapsSegment (const gp_Pnt& thePnt1,
+ const gp_Pnt& thePnt2,
+ const SelectMgr_ViewClipRange& theClipRange,
+ SelectBasics_PickResult& thePickResult) const = 0;
//! 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;
+ virtual Standard_Boolean OverlapsTriangle (const gp_Pnt& thePnt1,
+ const gp_Pnt& thePnt2,
+ const gp_Pnt& thePnt3,
+ Select3D_TypeOfSensitivity theSensType,
+ const SelectMgr_ViewClipRange& theClipRange,
+ SelectBasics_PickResult& thePickResult) const = 0;
public:
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
// purpose : SAT intersection test between defined volume and given
//! Intersection test between defined volume and given point
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,
//! representing line segments. The test may be considered of interior part or
//! boundary line defined by segments depending on given sensitivity type
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_EXPORT void BuildSelectingVolume (const gp_Pnt2d& thePoint);
Standard_DEPRECATED("Deprecated method - InitPolylineSelectingVolume() and Build() should be used instead")
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:
Handle(SelectMgr_BaseIntersector) myActiveSelectingVolume;
Handle(Graphic3d_SequenceOfHClipPlane) myViewClipPlanes; //!< view clipping planes
#include <SelectMgr_FrustumBuilder.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum,Standard_Transient)
-
-SelectMgr_TriangularFrustum::~SelectMgr_TriangularFrustum()
-{
- Clear();
-}
+IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, Standard_Transient)
namespace
{
}
}
+// =======================================================================
+// function : SelectMgr_TriangularFrustum
+// purpose :
+// =======================================================================
+SelectMgr_TriangularFrustum::SelectMgr_TriangularFrustum()
+{
+ //
+}
+
+// =======================================================================
+// function : ~SelectMgr_TriangularFrustum
+// purpose :
+// =======================================================================
+SelectMgr_TriangularFrustum::~SelectMgr_TriangularFrustum()
+{
+ Clear();
+}
+
// =======================================================================
// function : cacheVertexProjections
// purpose : Caches projection of frustum's vertices onto its plane directions
{
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustum)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_Frustum)
-}
\ No newline at end of file
+}
#include <SelectMgr_Frustum.hxx>
//! This class contains representation of triangular selecting frustum, created in case
-//! of polyline selection, and algorithms for overlap detection between selecting
-//! frustum and sensitive entities.
-//! Overlap detection tests are implemented according to the terms of separating axis
-//! theorem (SAT).
+//! of polyline selection, and algorithms for overlap detection between selecting frustum and sensitive entities.
+//! 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.
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:
//! Auxiliary structure to define selection triangle
gp_Pnt2d Points[3];
};
- Standard_EXPORT ~SelectMgr_TriangularFrustum();
+public:
+
+ //! Destructor.
+ Standard_EXPORT virtual ~SelectMgr_TriangularFrustum();
//! Initializes selection triangle by input points
Standard_EXPORT void Init (const gp_Pnt2d& theP1,
//! NOTE: it should be called after Init() method
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
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScale,
const gp_GTrsf& theTrsf,
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
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
const SelectMgr_ViewClipRange& theClipRange,
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,
//! representing line segments. The test may be considered of interior part or
//! boundary line defined by segments depending on given sensitivity type
const SelectMgr_ViewClipRange& theClipRange,
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
+public:
+
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
Standard_EXPORT void Clear();
//! Dumps the content of me into the stream
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:
void cacheVertexProjections (SelectMgr_TriangularFrustum* theFrustum) const;
public:
DEFINE_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, SelectMgr_Frustum<3>)
-
friend class SelectMgr_TriangularFrustumSet;
};
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <SelectMgr_TriangularFrustumSet.hxx>
+
#include <BRepMesh_DataStructureOfDelaun.hxx>
#include <BRepMesh_Delaun.hxx>
#include <NCollection_IncAllocator.hxx>
#include <SelectMgr_FrustumBuilder.hxx>
-#include <SelectMgr_TriangularFrustumSet.hxx>
-
-#define MEMORY_BLOCK_SIZE 512 * 7
+namespace
+{
+ static const size_t MEMORY_BLOCK_SIZE = 512 * 7;
+}
// =======================================================================
// function : SelectMgr_TriangularFrustumSet
// purpose :
// =======================================================================
SelectMgr_TriangularFrustumSet::SelectMgr_TriangularFrustumSet()
-: myToAllowOverlap (Standard_False)
+: myToAllowOverlap (Standard_False)
+{
+}
+
+// =======================================================================
+// function : ~SelectMgr_TriangularFrustumSet
+// purpose :
+// =======================================================================
+SelectMgr_TriangularFrustumSet::~SelectMgr_TriangularFrustumSet()
{
+ //
}
// =======================================================================
"Error! SelectMgr_TriangularFrustumSet::ScaleAndTransform() should be called after selection frustum initialization");
Handle(SelectMgr_TriangularFrustumSet) aRes = new SelectMgr_TriangularFrustumSet();
-
- for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
+ for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
{
aRes->myFrustums.Append (Handle(SelectMgr_TriangularFrustum)::DownCast (anIter.Value()->ScaleAndTransform (theScale, theTrsf, theBuilder)));
}
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
"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))
+ {
return Standard_True;
+ }
}
return Standard_False;
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
"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))
{
- if (myToAllowOverlap || theInside == NULL)
- {
- return Standard_True;
- }
- else
- {
- gp_Pnt aMinMaxPnts[2] = { gp_Pnt (theMinPnt.x(), theMinPnt.y(), theMinPnt.z()),
- gp_Pnt (theMaxPnt.x(), theMaxPnt.y(), theMaxPnt.z())};
+ continue;
+ }
- gp_Pnt anOffset[3] = { gp_Pnt (aMinMaxPnts[1].X() - aMinMaxPnts[0].X(), 0.0, 0.0),
- gp_Pnt (0.0, aMinMaxPnts[1].Y() - aMinMaxPnts[0].Y(), 0.0),
- gp_Pnt (0.0, 0.0, aMinMaxPnts[1].Z() - aMinMaxPnts[0].Z()) };
+ if (myToAllowOverlap || theInside == NULL)
+ {
+ return Standard_True;
+ }
- Standard_Integer aSign = 1;
- for (Standard_Integer aPntsIdx = 0; aPntsIdx < 2; aPntsIdx++)
+ gp_Pnt aMinMaxPnts[2] = { gp_Pnt (theMinPnt.x(), theMinPnt.y(), theMinPnt.z()),
+ gp_Pnt (theMaxPnt.x(), theMaxPnt.y(), theMaxPnt.z())};
+
+ gp_Pnt anOffset[3] = { gp_Pnt (aMinMaxPnts[1].X() - aMinMaxPnts[0].X(), 0.0, 0.0),
+ gp_Pnt (0.0, aMinMaxPnts[1].Y() - aMinMaxPnts[0].Y(), 0.0),
+ gp_Pnt (0.0, 0.0, aMinMaxPnts[1].Z() - aMinMaxPnts[0].Z()) };
+
+ Standard_Integer aSign = 1;
+ for (Standard_Integer aPntsIdx = 0; aPntsIdx < 2; aPntsIdx++)
+ {
+ for (Standard_Integer aCoordIdx = 0; aCoordIdx < 3; aCoordIdx++)
+ {
+ gp_Pnt anOffsetPnt = aMinMaxPnts [aPntsIdx].XYZ() + aSign * anOffset [aCoordIdx].XYZ();
+ if (isIntersectBoundary (aMinMaxPnts [aPntsIdx], anOffsetPnt)
+ || isIntersectBoundary (anOffsetPnt, anOffsetPnt.XYZ() + aSign * anOffset [(aCoordIdx + 1) % 3].XYZ()))
{
- for (Standard_Integer aCoordIdx = 0; aCoordIdx < 3; aCoordIdx++)
- {
- gp_Pnt anOffsetPnt = aMinMaxPnts [aPntsIdx].XYZ() + aSign * anOffset [aCoordIdx].XYZ();
- if (isIntersectBoundary (aMinMaxPnts [aPntsIdx], anOffsetPnt)
- || isIntersectBoundary (anOffsetPnt, anOffsetPnt.XYZ() + aSign * anOffset [(aCoordIdx + 1) % 3].XYZ()))
- {
- *theInside &= Standard_False;
- return Standard_True;
- }
- }
- aSign = -aSign;
+ *theInside &= Standard_False;
+ return Standard_True;
}
- return Standard_True;
}
+ aSign = -aSign;
}
+ return Standard_True;
}
return Standard_False;
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
"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))
+ {
return Standard_True;
+ }
}
return Standard_False;
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
"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))
{
- if (myToAllowOverlap)
- {
- return Standard_True;
- }
- else
+ continue;
+ }
+
+ if (myToAllowOverlap)
+ {
+ return Standard_True;
+ }
+
+ Standard_Integer aPtsLower = theArrayOfPts.Lower();
+ Standard_Integer aPtsUpper = theArrayOfPts.Upper();
+ for (Standard_Integer anIdx = aPtsLower; anIdx <= aPtsUpper; anIdx++)
+ {
+ if (isIntersectBoundary (theArrayOfPts.Value (anIdx), theArrayOfPts.Value (anIdx < aPtsUpper ? anIdx + 1 : aPtsLower)))
{
- Standard_Integer aPtsLower = theArrayOfPts.Lower();
- Standard_Integer aPtsUpper = theArrayOfPts.Upper();
- for (Standard_Integer anIdx = aPtsLower; anIdx <= aPtsUpper; anIdx++)
- {
- if (isIntersectBoundary (theArrayOfPts.Value (anIdx), theArrayOfPts.Value (anIdx < aPtsUpper ? anIdx + 1 : aPtsLower)))
- {
- return Standard_False;
- }
- }
- return Standard_True;
+ return Standard_False;
}
}
+ return Standard_True;
}
return Standard_False;
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
"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))
{
- if (myToAllowOverlap)
- {
- return Standard_True;
- }
- else
- {
- if (isIntersectBoundary (thePnt1, thePnt2))
- {
- return Standard_False;
- }
- return Standard_True;
- }
+ continue;
}
+
+ if (myToAllowOverlap)
+ {
+ return Standard_True;
+ }
+
+ if (isIntersectBoundary (thePnt1, thePnt2))
+ {
+ return Standard_False;
+ }
+ return Standard_True;
}
return Standard_False;
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Polyline,
"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))
{
- if (myToAllowOverlap)
- {
- return Standard_True;
- }
- else
- {
- if (isIntersectBoundary (thePnt1, thePnt2)
- || isIntersectBoundary (thePnt2, thePnt3)
- || isIntersectBoundary (thePnt3, thePnt1))
- {
- return Standard_False;
- }
- return Standard_True;
- }
+ continue;
}
+
+ if (myToAllowOverlap)
+ {
+ return Standard_True;
+ }
+
+ if (isIntersectBoundary (thePnt1, thePnt2)
+ || isIntersectBoundary (thePnt2, thePnt3)
+ || isIntersectBoundary (thePnt3, thePnt1))
+ {
+ return Standard_False;
+ }
+ return Standard_True;
}
return Standard_False;
{
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);
}
OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustumSet)
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();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aFrustum.get())
}
}
-
-#undef MEMORY_BLOCK_SIZE
#include <TColgp_HArray1OfPnt2d.hxx>
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
-//! algorithm is to split the polygon defined by polyline onto triangles. Than each of
-//! them is considered as a base for triangular frustum building. In other
-//! words, each triangle vertiex will be projected from 2d screen space to 3d world space
-//! onto near and far view frustum planes. Thus, the projected triangles make up the bases of
-//! selecting frustum. When the set of such frustums is created, the function determining
-//! selection iterates through triangular frustum set and searches for overlap with any
-//! frustum.
+//! algorithm is to split the polygon defined by polyline onto triangles.
+//! Than each of them is considered as a base for triangular frustum building.
+//! In other words, each triangle vertex will be projected from 2d screen space to 3d world space onto near and far view frustum planes.
+//! Thus, the projected triangles make up the bases of selecting frustum.
+//! When the set of such frustums is created, the function determining
+//! selection iterates through triangular frustum set and searches for overlap with any frustum.
class SelectMgr_TriangularFrustumSet : public SelectMgr_BaseFrustum
{
public:
Handle(TColgp_HArray1OfPnt2d) Points;
};
+public:
+
+ //! Constructor.
SelectMgr_TriangularFrustumSet();
- ~SelectMgr_TriangularFrustumSet() {};
+ //! Destructor.
+ Standard_EXPORT virtual ~SelectMgr_TriangularFrustumSet();
//! Initializes set of triangular frustums by polyline
Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& thePoints);
//! 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
- //! considered as a frustum base
+ //! where each triangle's projection onto near and far view frustum planes is considered as a frustum base
//! NOTE: it should be called after Init() method
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
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform (const Standard_Integer theScale,
const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
+public:
+
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
const SelectMgr_Vec3& theMaxPnt,
const SelectMgr_ViewClipRange& theClipRange,
const SelectMgr_ViewClipRange& theClipRange,
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,
Select3D_TypeOfSensitivity theSensType,
const SelectMgr_ViewClipRange& theClipRange,
const SelectMgr_ViewClipRange& theClipRange,
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
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;