]> OCCT Git - occt.git/commitdiff
0032419: Coding Rules - revert Overlaps() methods to SelectBasics_SelectingVolumeMana... IR-2021-06-04
authorkgv <kgv@opencascade.com>
Fri, 4 Jun 2021 08:28:49 +0000 (11:28 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 4 Jun 2021 16:10:46 +0000 (19:10 +0300)
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).

18 files changed:
src/MeshVS/MeshVS_SensitivePolyhedron.cxx
src/Select3D/Select3D_InteriorSensitivePointSet.cxx
src/Select3D/Select3D_SensitiveCircle.cxx
src/SelectBasics/FILES
src/SelectBasics/SelectBasics_SelectingVolumeManager.cxx [new file with mode: 0644]
src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_AxisIntersector.cxx
src/SelectMgr/SelectMgr_AxisIntersector.hxx
src/SelectMgr/SelectMgr_BaseFrustum.cxx
src/SelectMgr/SelectMgr_BaseFrustum.hxx
src/SelectMgr/SelectMgr_BaseIntersector.cxx
src/SelectMgr/SelectMgr_BaseIntersector.hxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_TriangularFrustum.cxx
src/SelectMgr/SelectMgr_TriangularFrustum.hxx
src/SelectMgr/SelectMgr_TriangularFrustumSet.cxx
src/SelectMgr/SelectMgr_TriangularFrustumSet.hxx

index 447028cb948cc55d5c7c0f8161f7314ec3ae3799..95225537628ef6b2a0c798420d25116ca1788e46 100644 (file)
@@ -86,7 +86,7 @@ Standard_Boolean MeshVS_SensitivePolyhedron::Matches (SelectBasics_SelectingVolu
   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);
     }
index 03d8d0a26bf7fe9b151458c89de6c1b410a8fa6c..c2bcff4732debdfd86dc181c97342a679476c6fc 100644 (file)
@@ -270,7 +270,7 @@ Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasi
   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);
 }
 
 // =======================================================================
index d8cfb92828c42d833bed3780eeed56912604d09e..6a4864c7dd27725b995bfc37b636af7fa9c40b43 100644 (file)
@@ -228,7 +228,7 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume
       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)
       {
@@ -240,7 +240,7 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume
       return Standard_True;
     }
 
-    if (!theMgr.OverlapsPolygon (anArrayOfPnt, Select3D_TOS_INTERIOR, thePickResult))
+    if (!theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), Select3D_TOS_INTERIOR, thePickResult))
     {
       return Standard_False;
     }
index 169e58d3ca15b4ef75874094c7bbba741b8e1b27..3d0d42f1a6e0d092d94b6111cd764a835f2605ab 100644 (file)
@@ -1,5 +1,6 @@
 SelectBasics.hxx
 SelectBasics_EntityOwner.hxx
 SelectBasics_PickResult.hxx
+SelectBasics_SelectingVolumeManager.cxx
 SelectBasics_SelectingVolumeManager.hxx
 SelectBasics_SensitiveEntity.hxx
diff --git a/src/SelectBasics/SelectBasics_SelectingVolumeManager.cxx b/src/SelectBasics/SelectBasics_SelectingVolumeManager.cxx
new file mode 100644 (file)
index 0000000..3d84755
--- /dev/null
@@ -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);
+}
index 6c177af4a145993b63488ef8db9ba2adf3976b63..68aaaab90c1a94eed6d1b9d3c9fd6f2047abe995 100644 (file)
@@ -20,6 +20,7 @@
 #include <gp_Pnt.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 #include <SelectBasics_PickResult.hxx>
+#include <SelectMgr_SelectionType.hxx>
 #include <Standard_Dump.hxx>
 
 class Bnd_Box;
@@ -33,12 +34,17 @@ class SelectBasics_SelectingVolumeManager
 {
 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,
@@ -59,12 +65,6 @@ public:
   //! 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,
@@ -85,12 +85,16 @@ public:
                                              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.
@@ -126,6 +130,85 @@ public:
     (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
index ae1e024703aaaff0786d2a9155b716663628fa20..2dc4d4df1c18c6fcb7d4a3d6a3ae8ac69edd9a2a 100644 (file)
 // =======================================================================
 SelectMgr_AxisIntersector::SelectMgr_AxisIntersector()
 {
+  //
+}
+
+// =======================================================================
+// function : ~SelectMgr_AxisIntersector
+// purpose  :
+// =======================================================================
+SelectMgr_AxisIntersector::~SelectMgr_AxisIntersector()
+{
+  //
 }
 
 // =======================================================================
index 9f7b95a47885f125a94f39c8f716085008663a4a..4e92d96fe6d1b025929429dcd47bd1a06348933b 100644 (file)
@@ -28,7 +28,7 @@ public:
   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);
@@ -37,14 +37,16 @@ public:
   //! 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:
 
index d61e930882e8e0fa48b75b645ce25c1115643c58..718b122727f6996d95411d2edba2fbfc5105a969 100644 (file)
@@ -23,8 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseFrustum, SelectMgr_BaseIntersector)
 
 //=======================================================================
 // 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),
@@ -143,94 +142,6 @@ void SelectMgr_BaseFrustum::SetBuilder (const Handle(SelectMgr_FrustumBuilder)&
   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  : 
index e303b0445287c35a0995aba4e7bd89717221da3a..9a0ef2cbdd18193bed02f5e4610eaccbca4c9d60 100644 (file)
@@ -27,7 +27,7 @@ class SelectMgr_BaseFrustum : public SelectMgr_BaseIntersector
 {
 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();
 
@@ -72,55 +72,6 @@ public:
                                             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;
 
index 1dadf955def8f6602b3b481edc29696f6cb26c92..739ea74e35feb3a57bd9c47a2f5c3190679bd2f2 100644 (file)
 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()
+{
+  //
 }
 
 //=======================================================================
@@ -164,88 +172,6 @@ const gp_Pnt2d& SelectMgr_BaseIntersector::GetMousePosition() const
   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  :
index bc2b5b41d7d7a0e4434d7f2089994af7ede8be68..c792169569ccffda0b67660e958511105f563989 100644 (file)
@@ -39,15 +39,13 @@ class SelectMgr_BaseIntersector : public Standard_Transient
 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; }
@@ -55,27 +53,23 @@ public:
 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:
 
@@ -150,51 +144,50 @@ 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:
 
index b8045dc68657a47cb555840f22b71000640d981f..ee709488aa61f742d74afd1266189895597debc7 100644 (file)
@@ -390,26 +390,6 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsPoint (const gp_Pnt&
   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
index 1cd81cadd31298e7f1aa050d5750518cafc98b7d..291831e7db739d1aeb50e6de73b326c40d876843 100644 (file)
@@ -147,13 +147,6 @@ public:
   //! 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
@@ -248,22 +241,6 @@ 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_EXPORT void BuildSelectingVolume (const gp_Pnt2d& thePoint);
 
@@ -274,84 +251,6 @@ public:
   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
index c27aa4b6687c9fbbe0be8b4479c941f6b51e9f9a..72a15e36e370bc7b58e0431fd6fa17904320b34f 100644 (file)
 
 #include <SelectMgr_FrustumBuilder.hxx>
 
-IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum,Standard_Transient)
-
-SelectMgr_TriangularFrustum::~SelectMgr_TriangularFrustum()
-{
-  Clear();
-}
+IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, Standard_Transient)
 
 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
 // purpose  : Caches projection of frustum's vertices onto its plane directions
@@ -325,4 +338,4 @@ void SelectMgr_TriangularFrustum::DumpJson (Standard_OStream& theOStream, Standa
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustum)
   OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_Frustum)
-}
\ No newline at end of file
+}
index 58990520ec369d4175df2b476deebc2b1634de3d..18ae7487e3abe2f0a2fdd4082ffe600fa8564e59 100644 (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
@@ -40,7 +32,10 @@ public:
     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,
@@ -52,12 +47,15 @@ public:
   //! 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,
@@ -76,6 +74,12 @@ public:
                                                           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
@@ -100,6 +104,8 @@ public:
                                                              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();
 
@@ -110,6 +116,11 @@ public:
   //! 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;
@@ -121,7 +132,6 @@ protected:
 public:
 
   DEFINE_STANDARD_RTTIEXT(SelectMgr_TriangularFrustum, SelectMgr_Frustum<3>)
-
   friend class SelectMgr_TriangularFrustumSet;
 };
 
index 3e15d50dd2b2352da5518b61fb2ee14b09123658..d07652a0e15c02c5be6bcc90d2b5a9a5dabc55f5 100644 (file)
 // 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()
 {
+  //
 }
 
 // =======================================================================
@@ -150,8 +162,7 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustumSet::ScaleAndTransf
     "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)));
   }
@@ -182,10 +193,12 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsBox (const SelectMgr_Ve
   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;
@@ -202,41 +215,41 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsBox (const SelectMgr_Ve
   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;
@@ -253,10 +266,12 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsPoint (const gp_Pnt& th
   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;
@@ -274,28 +289,28 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsPolygon (const TColgp_A
   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;
@@ -313,23 +328,23 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsSegment (const gp_Pnt&
   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;
@@ -349,25 +364,25 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsTriangle (const gp_Pnt&
   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;
@@ -381,7 +396,7 @@ void SelectMgr_TriangularFrustumSet::GetPlanes (NCollection_Vector<SelectMgr_Vec
 {
   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);
   }
@@ -485,11 +500,9 @@ void SelectMgr_TriangularFrustumSet::DumpJson (Standard_OStream& theOStream, Sta
   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
index 14c1f38291dfa582a0b2300f63cc325c0fad1c11..70cfb7a5c8e90c8e3ec7857f8973c3a55ab66552 100644 (file)
 #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:
@@ -40,24 +38,32 @@ 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,
@@ -71,6 +77,12 @@ public:
                                                           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,
@@ -88,6 +100,8 @@ public:
                                                              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;