0030058: Visualization, Select3D_SensitivePrimitiveArray - the selection is not fast...
authorkgv <kgv@opencascade.com>
Fri, 17 Aug 2018 12:00:11 +0000 (15:00 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 24 Aug 2018 15:03:33 +0000 (18:03 +0300)
Select3D_SensitiveSet::Matches() has been improved to check if BVH node is fully included by selection volume
and pass this information to overlapsElement()/elementIsInside() interfaces
to avoid expensive partial overlapping checks for individual elements.
Select3D_SensitivePrimitiveArray implements this new interface to improve partial overlapping performance.
Select3D_SensitivePrimitiveArray::Matches() now handles rectangle selection for sub-elements when Elements map is defined.
Added missing const to SelectMgr_BaseFrustum::Overlaps() methods.

AIS_PointCloud has been extended with new selection mode for collecting selected nodes

Draw Harness command vdrawparray has been extended with an option -shape
allowing to create a triangulation from tessellated shape.

34 files changed:
src/AIS/AIS_PointCloud.cxx
src/AIS/AIS_PointCloud.hxx
src/MeshVS/MeshVS_CommonSensitiveEntity.cxx
src/MeshVS/MeshVS_CommonSensitiveEntity.hxx
src/Select3D/Select3D_InteriorSensitivePointSet.cxx
src/Select3D/Select3D_InteriorSensitivePointSet.hxx
src/Select3D/Select3D_SensitiveGroup.cxx
src/Select3D/Select3D_SensitiveGroup.hxx
src/Select3D/Select3D_SensitivePoly.cxx
src/Select3D/Select3D_SensitivePoly.hxx
src/Select3D/Select3D_SensitivePrimitiveArray.cxx
src/Select3D/Select3D_SensitivePrimitiveArray.hxx
src/Select3D/Select3D_SensitiveSet.cxx
src/Select3D/Select3D_SensitiveSet.hxx
src/Select3D/Select3D_SensitiveTriangulation.cxx
src/Select3D/Select3D_SensitiveTriangulation.hxx
src/Select3D/Select3D_SensitiveWire.cxx
src/Select3D/Select3D_SensitiveWire.hxx
src/SelectBasics/SelectBasics_EntityOwner.cxx
src/SelectBasics/SelectBasics_EntityOwner.hxx
src/SelectBasics/SelectBasics_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_BaseFrustum.cxx
src/SelectMgr/SelectMgr_BaseFrustum.hxx
src/SelectMgr/SelectMgr_Frustum.hxx
src/SelectMgr/SelectMgr_Frustum.lxx
src/SelectMgr/SelectMgr_RectangularFrustum.cxx
src/SelectMgr/SelectMgr_RectangularFrustum.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
src/ViewerTest/ViewerTest_ObjectCommands.cxx

index 454dbc2..dcfea91 100644 (file)
 #include <SelectMgr_Selection.hxx>
 #include <StdPrs_BndBox.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloudOwner, SelectMgr_EntityOwner)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloud, AIS_InteractiveObject)
 
-IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloud,AIS_InteractiveObject)
+//=======================================================================
+//function : AIS_PointCloudOwner
+//purpose  :
+//=======================================================================
+AIS_PointCloudOwner::AIS_PointCloudOwner (const Handle(AIS_PointCloud)& theOrigin)
+: SelectMgr_EntityOwner ((const Handle(SelectMgr_SelectableObject)& )theOrigin,  5),
+  myDetPoints (new TColStd_HPackedMapOfInteger()),
+  mySelPoints (new TColStd_HPackedMapOfInteger())
+{
+  //
+}
+
+//=======================================================================
+//function : ~AIS_PointCloudOwner
+//purpose  :
+//=======================================================================
+AIS_PointCloudOwner::~AIS_PointCloudOwner()
+{
+  //
+}
+
+//=======================================================================
+//function : HilightWithColor
+//purpose  :
+//=======================================================================
+Standard_Boolean AIS_PointCloudOwner::IsForcedHilight() const
+{
+  return true;
+}
+
+//=======================================================================
+//function : HilightWithColor
+//purpose  :
+//=======================================================================
+void AIS_PointCloudOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+                                                      const Handle(Prs3d_Drawer)& theStyle,
+                                                      const Standard_Integer )
+{
+  Handle(AIS_PointCloud) anObj = Handle(AIS_PointCloud)::DownCast (Selectable());
+  if (anObj.IsNull())
+  {
+    throw Standard_ProgramError ("Internal Error within AIS_PointCloud::PointsOwner!");
+  }
+
+  const Handle(TColStd_HPackedMapOfInteger)& aMap = thePrsMgr->IsImmediateModeOn()
+                                                  ? myDetPoints
+                                                  : mySelPoints;
+  Handle(Prs3d_Presentation) aPrs = thePrsMgr->IsImmediateModeOn()
+                                  ? anObj->GetHilightPresentation(thePrsMgr)
+                                  : anObj->GetSelectPresentation (thePrsMgr);
+  const Graphic3d_ZLayerId aZLayer = theStyle->ZLayer() != -1
+                                   ? theStyle->ZLayer()
+                                   : (thePrsMgr->IsImmediateModeOn() ? Graphic3d_ZLayerId_Top : anObj->ZLayer());
+  aMap->ChangeMap().Clear();
+  for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
+  {
+    const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
+    for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
+    {
+      const Handle(SelectMgr_SensitiveEntity)& aSelEnt = aSelEntIter.Value();
+      if (aSelEnt->BaseSensitive()->OwnerId() == this)
+      {
+        if (Handle(Select3D_SensitivePrimitiveArray) aSensitive = Handle(Select3D_SensitivePrimitiveArray)::DownCast (aSelEnt->BaseSensitive()))
+        {
+          aMap->ChangeMap() = aSensitive->LastDetectedElementMap()->Map();
+          if (aSensitive->LastDetectedElement() != -1)
+          {
+            aMap->ChangeMap().Add (aSensitive->LastDetectedElement());
+          }
+          break;
+        }
+      }
+    }
+  }
+
+  aPrs->Clear();
+  if (aPrs->GetZLayer() != aZLayer)
+  {
+    aPrs->SetZLayer (aZLayer);
+  }
+  if (aMap->Map().IsEmpty())
+  {
+    return;
+  }
+
+  const Handle(Graphic3d_ArrayOfPoints) anAllPoints = anObj->GetPoints();
+  if (anAllPoints.IsNull())
+  {
+    return;
+  }
+
+  Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (aMap->Map().Extent());
+  for (TColStd_PackedMapOfInteger::Iterator aPntIter (aMap->Map()); aPntIter.More(); aPntIter.Next())
+  {
+    const gp_Pnt aPnt = anAllPoints->Vertice (aPntIter.Key() + 1);
+    aPoints->AddVertex (aPnt);
+  }
+
+  Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
+  aGroup->SetGroupPrimitivesAspect (theStyle->PointAspect()->Aspect());
+  aGroup->AddPrimitiveArray (aPoints);
+  if (thePrsMgr->IsImmediateModeOn())
+  {
+    thePrsMgr->AddToImmediateList (aPrs);
+  }
+  else
+  {
+    aPrs->Display();
+  }
+}
+
+//=======================================================================
+//function : Unhilight
+//purpose  :
+//=======================================================================
+void AIS_PointCloudOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& , const Standard_Integer )
+{
+  if (Handle(Prs3d_Presentation) aPrs = Selectable()->GetSelectPresentation (Handle(PrsMgr_PresentationManager3d)()))
+  {
+    aPrs->Erase();
+  }
+}
+
+//=======================================================================
+//function : Clear
+//purpose  :
+//=======================================================================
+void AIS_PointCloudOwner::Clear (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode)
+{
+  SelectMgr_EntityOwner::Clear (thePrsMgr, theMode);
+}
 
 //==================================================
 // Function: AIS_PointCloud
@@ -46,6 +178,8 @@ AIS_PointCloud::AIS_PointCloud()
 
   SetDisplayMode (AIS_PointCloud::DM_Points);
   SetHilightMode (AIS_PointCloud::DM_BndBox);
+
+  myDynHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_CYAN1, 1.0));
 }
 
 //=======================================================================
@@ -432,14 +566,22 @@ void AIS_PointCloud::ComputeSelection (const Handle(SelectMgr_Selection)& theSel
   switch (theMode)
   {
     case SM_Points:
+    case SM_SubsetOfPoints:
     {
       const Handle(Graphic3d_ArrayOfPoints) aPoints = GetPoints();
       if (!aPoints.IsNull()
        && !aPoints->Attributes().IsNull())
       {
+        if (theMode == SM_SubsetOfPoints)
+        {
+          anOwner = new AIS_PointCloudOwner (this);
+        }
+
         // split large point clouds into several groups
         const Standard_Integer aNbGroups = aPoints->Attributes()->NbElements > 500000 ? 8 : 1;
         Handle(Select3D_SensitivePrimitiveArray) aSensitive = new Select3D_SensitivePrimitiveArray (anOwner);
+        aSensitive->SetDetectElements (true);
+        aSensitive->SetDetectElementMap (theMode == SM_SubsetOfPoints);
         aSensitive->SetSensitivityFactor (8);
         aSensitive->InitPoints (aPoints->Attributes(), aPoints->Indices(), TopLoc_Location(), true, aNbGroups);
         aSensitive->BVH();
index 83f3f9a..ab7ab32 100644 (file)
 #include <Bnd_Box.hxx>
 #include <Graphic3d_ArrayOfPoints.hxx>
 #include <Quantity_HArray1OfColor.hxx>
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Macro.hxx>
+#include <SelectMgr_EntityOwner.hxx>
 #include <TColgp_HArray1OfDir.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 
-class AIS_PointCloud;
-DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
+class TColStd_HPackedMapOfInteger;
 
 //! Interactive object for set of points.
 //! The presentation supports two display modes:
@@ -43,7 +40,7 @@ DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
 //! hilight mode, e.g. 100);
 class AIS_PointCloud : public AIS_InteractiveObject
 {
-
+  DEFINE_STANDARD_RTTIEXT(AIS_PointCloud, AIS_InteractiveObject)
 public:
 
   //! Display modes supported by this Point Cloud object
@@ -56,8 +53,9 @@ public:
   //! Selection modes supported by this Point Cloud object
   enum SelectionMode
   {
-    SM_Points = 0, //!< detected by points
-    SM_BndBox = 2  //!< detected by bounding box
+    SM_Points         = 0, //!< detected by points
+    SM_SubsetOfPoints = 1, //!< detect point(s) within Point Cloud rather than object as whole
+    SM_BndBox         = 2, //!< detected by bounding box
   };
 
 public:
@@ -121,10 +119,45 @@ private:
   Handle(Graphic3d_ArrayOfPoints) myPoints;    //!< points array for presentation
   Bnd_Box                         myBndBox;    //!< bounding box for presentation
 
+};
+
+DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
+
+//! Custom owner for highlighting selected points.
+class AIS_PointCloudOwner : public SelectMgr_EntityOwner
+{
+  DEFINE_STANDARD_RTTIEXT(AIS_PointCloudOwner, SelectMgr_EntityOwner)
 public:
+  //! Main constructor.
+  Standard_EXPORT AIS_PointCloudOwner (const Handle(AIS_PointCloud)& theOrigin);
 
-  DEFINE_STANDARD_RTTIEXT(AIS_PointCloud,AIS_InteractiveObject)
+  //! Destructor.
+  Standard_EXPORT virtual ~AIS_PointCloudOwner();
 
+  //! Return selected points.
+  //! WARNING! Indexation starts with 0 (shifted by -1 comparing to Graphic3d_ArrayOfPoints::Vertice()).
+  const Handle(TColStd_HPackedMapOfInteger)& SelectedPoints() const { return mySelPoints; }
+
+  //! Return last detected points.
+  //! WARNING! Indexation starts with 0 (shifted by -1 comparing to Graphic3d_ArrayOfPoints::Vertice()).
+  const Handle(TColStd_HPackedMapOfInteger)& DetectedPoints() const { return myDetPoints; }
+
+  //! Always update dynamic highlighting.
+  Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE;
+
+  //! Handle dynamic highlighting.
+  Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+                                                 const Handle(Prs3d_Drawer)& theStyle,
+                                                 const Standard_Integer theMode) Standard_OVERRIDE;
+
+  //! Removes highlighting.
+  Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode) Standard_OVERRIDE;
+
+  //! Clears presentation.
+  Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode) Standard_OVERRIDE;
+protected:
+  Handle(TColStd_HPackedMapOfInteger) myDetPoints; //!< last detected points
+  Handle(TColStd_HPackedMapOfInteger) mySelPoints; //!< selected points
 };
 
 #endif // _AIS_PointCloud_HeaderFile
index c6a445e..eacba59 100644 (file)
@@ -222,10 +222,16 @@ void MeshVS_CommonSensitiveEntity::Swap (const Standard_Integer theIdx1,
 //function : overlapsElement
 //purpose  :
 //=======================================================================
-Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                                SelectBasics_SelectingVolumeManager& theMgr,
                                                                 Standard_Integer theElemIdx,
-                                                                SelectBasics_PickResult& thePickResult)
+                                                                Standard_Boolean theIsFullInside)
 {
+  if (theIsFullInside)
+  {
+    return Standard_True;
+  }
+
   const Standard_Integer anItemIdx = myItemIndexes.Value (theElemIdx);
   if (mySelMethod == MeshVS_MSM_PRECISE)
   {
@@ -276,8 +282,14 @@ Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_Sel
 //purpose  :
 //=======================================================================
 Standard_Boolean MeshVS_CommonSensitiveEntity::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                                const Standard_Integer theElemIdx)
+                                                                Standard_Integer theElemIdx,
+                                                                Standard_Boolean theIsFullInside)
 {
+  if (theIsFullInside)
+  {
+    return Standard_True;
+  }
+
   const Standard_Integer anItemIdx = myItemIndexes.Value (theElemIdx);
   if (mySelMethod == MeshVS_MSM_PRECISE)
   {
index 6f9bae8..dd2ea1d 100644 (file)
@@ -65,13 +65,15 @@ public:
 protected:
 
   //! Checks whether the entity with index theIdx overlaps the current selecting volume
-  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                            SelectBasics_SelectingVolumeManager& theMgr,
                                                             Standard_Integer theElemIdx,
-                                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                            const Standard_Integer theElemIdx) Standard_OVERRIDE;
+                                                            Standard_Integer theElemIdx,
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
   Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
index 553ddcb..7e0c76e 100644 (file)
@@ -259,12 +259,12 @@ void Select3D_InteriorSensitivePointSet::Swap (const Standard_Integer theIdx1,
 
 // =======================================================================
 // function : overlapsElement
-// purpose  : Checks whether the planar convex polygon with index theIdx
-//            in myPlanarPolygons overlaps the current selecting volume
+// purpose  :
 // =======================================================================
-Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                                      SelectBasics_SelectingVolumeManager& theMgr,
                                                                       Standard_Integer theElemIdx,
-                                                                      SelectBasics_PickResult& thePickResult)
+                                                                      Standard_Boolean )
 {
   Standard_Integer aPolygIdx = myPolygonsIdxs->Value (theElemIdx);
   const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (aPolygIdx);
@@ -278,10 +278,11 @@ Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasi
 // purpose  :
 // =======================================================================
 Standard_Boolean Select3D_InteriorSensitivePointSet::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                                      const Standard_Integer               theElemIdx)
+                                                                      Standard_Integer theElemIdx,
+                                                                      Standard_Boolean theIsFullInside)
 {
   SelectBasics_PickResult aDummy;
-  return overlapsElement (theMgr, theElemIdx, aDummy);
+  return overlapsElement (aDummy, theMgr, theElemIdx, theIsFullInside);
 }
 
 // =======================================================================
index cfaca92..4375f22 100644 (file)
@@ -76,13 +76,15 @@ protected:
 
   //! Checks whether the planar convex polygon with index theIdx
   //! in myPlanarPolygons overlaps the current selecting volume
-  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                            SelectBasics_SelectingVolumeManager& theMgr,
                                                             Standard_Integer theElemIdx,
-                                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                            const Standard_Integer               theElemIdx) Standard_OVERRIDE;
+                                                            Standard_Integer theElemIdx,
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked
   //! screen point to center of the geometry
index edf866c..31215fc 100644 (file)
@@ -326,9 +326,10 @@ Standard_Integer Select3D_SensitiveGroup::Size() const
 // purpose  : Checks whether the entity with index theIdx overlaps the
 //            current selecting volume
 // =======================================================================
-Standard_Boolean Select3D_SensitiveGroup::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean Select3D_SensitiveGroup::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                           SelectBasics_SelectingVolumeManager& theMgr,
                                                            Standard_Integer theElemIdx,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           Standard_Boolean )
 {
   const Standard_Integer aSensitiveIdx = myBVHPrimIndexes.Value (theElemIdx);
   if (myEntities.FindKey (aSensitiveIdx)->Matches (theMgr, thePickResult))
@@ -344,10 +345,11 @@ Standard_Boolean Select3D_SensitiveGroup::overlapsElement (SelectBasics_Selectin
 // purpose  :
 // =======================================================================
 Standard_Boolean Select3D_SensitiveGroup::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                           const Standard_Integer               theElemIdx)
+                                                           Standard_Integer theElemIdx,
+                                                           Standard_Boolean theIsFullInside)
 {
   SelectBasics_PickResult aDummy;
-  return overlapsElement(theMgr, theElemIdx, aDummy);
+  return overlapsElement (aDummy, theMgr, theElemIdx, theIsFullInside);
 }
 
 // =======================================================================
index 7b7380f..58e64a3 100644 (file)
@@ -146,13 +146,15 @@ public:
 private:
 
   //! Checks whether the entity with index theIdx overlaps the current selecting volume
-  virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                            SelectBasics_SelectingVolumeManager& theMgr,
                                             Standard_Integer theElemIdx,
-                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                            const Standard_Integer               theElemIdx) Standard_OVERRIDE;
+                                            Standard_Integer theElemIdx,
+                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
   virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
index 5c19d68..20ffe84 100644 (file)
@@ -220,17 +220,23 @@ void Select3D_SensitivePoly::Swap (const Standard_Integer theIdx1,
 //           theIdx overlaps the current selecting
 //           volume
 //==================================================
-Standard_Boolean Select3D_SensitivePoly::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean Select3D_SensitivePoly::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                          SelectBasics_SelectingVolumeManager& theMgr,
                                                           Standard_Integer theElemIdx,
-                                                          SelectBasics_PickResult& thePickResult)
+                                                          Standard_Boolean theIsFullInside)
 {
   if (mySegmentIndexes.IsNull())
+  {
     return Standard_False;
+  }
+  else if (theIsFullInside)
+  {
+    return Standard_True;
+  }
 
   const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
   gp_Pnt aPnt1 = myPolyg.Pnt3d (aSegmentIdx);
   gp_Pnt aPnt2 = myPolyg.Pnt3d (aSegmentIdx + 1);
-
   return theMgr.Overlaps (aPnt1, aPnt2, thePickResult);
 }
 
@@ -239,10 +245,15 @@ Standard_Boolean Select3D_SensitivePoly::overlapsElement (SelectBasics_Selecting
 // Purpose  :
 //==================================================
 Standard_Boolean Select3D_SensitivePoly::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                          const Standard_Integer               theElemIdx)
+                                                          Standard_Integer theElemIdx,
+                                                          Standard_Boolean theIsFullInside)
 {
-  const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
+  if (theIsFullInside)
+  {
+    return Standard_True;
+  }
 
+  const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
   return theMgr.Overlaps (myPolyg.Pnt3d (aSegmentIdx + 0))
       && theMgr.Overlaps (myPolyg.Pnt3d (aSegmentIdx + 1));
 }
index aaa7429..8f600c8 100644 (file)
@@ -95,13 +95,15 @@ public:
 private:
 
   //! Checks whether the segment with index theIdx overlaps the current selecting volume
-  virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                            SelectBasics_SelectingVolumeManager& theMgr,
                                             Standard_Integer theElemIdx,
-                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                            const Standard_Integer               theElemIdx) Standard_OVERRIDE;
+                                            Standard_Integer theElemIdx,
+                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked screen point
   //! to center of the geometry
index eb3dcf5..f7dd11d 100644 (file)
@@ -908,7 +908,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
    || theMgr.GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point
    || !toDetectRange)
   {
-    if (!Select3D_SensitiveSet::Matches (theMgr, thePickResult))
+    if (!matches (theMgr, thePickResult, toDetectRange))
     {
       return Standard_False;
     }
@@ -929,35 +929,22 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
   }
 
   SelectBasics_PickResult aPickResult;
-  bool isFailed = false;
-  const bool toMatchAll = !theMgr.IsOverlapAllowed();
+  bool hasResults = false;
   for (Standard_Integer aGroupIter = 0; aGroupIter < myBvhIndices.NbElements; ++aGroupIter)
   {
     const Standard_Integer anElemIdx = myBvhIndices.Index (aGroupIter);
     Handle(Select3D_SensitivePrimitiveArray)& aChild = myGroups->ChangeValue (anElemIdx);
-    const bool isMatched = aChild->Matches (theMgr, aPickResult);
-    if (!myDetectedElemMap.IsNull())
+    if (aChild->Matches (theMgr, aPickResult))
     {
-      myDetectedElemMap->ChangeMap().Unite (aChild->myDetectedElemMap->Map());
-    }
-    if (!myDetectedNodeMap.IsNull())
-    {
-      myDetectedNodeMap->ChangeMap().Unite (aChild->myDetectedNodeMap->Map());
-    }
-
-    if (!isMatched)
-    {
-      if (toMatchAll)
+      hasResults = true;
+      if (!myDetectedElemMap.IsNull())
       {
-        isFailed = true;
-        if (!toDetectRange)
-        {
-          break;
-        }
+        myDetectedElemMap->ChangeMap().Unite (aChild->myDetectedElemMap->Map());
+      }
+      if (!myDetectedNodeMap.IsNull())
+      {
+        myDetectedNodeMap->ChangeMap().Unite (aChild->myDetectedNodeMap->Map());
       }
-    }
-    else
-    {
       if (thePickResult.Depth() > aPickResult.Depth())
       {
         myDetectedIdx = aGroupIter;
@@ -965,7 +952,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
       }
     }
   }
-  if (isFailed)
+  if (!hasResults)
   {
     return Standard_False;
   }
@@ -977,19 +964,15 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
 // function : overlapsElement
 // purpose  :
 // =======================================================================
-Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                                    SelectBasics_SelectingVolumeManager& theMgr,
                                                                     Standard_Integer theElemIdx,
-                                                                    SelectBasics_PickResult& thePickResult)
+                                                                    Standard_Boolean theIsFullInside)
 {
   const Standard_Integer anElemIdx = myBvhIndices.Index (theElemIdx);
   if (!myGroups.IsNull())
   {
-    if (myGroups->Value (anElemIdx)->Matches (theMgr, thePickResult))
-    {
-      return Standard_True;
-    }
-
-    return Standard_False;
+    return myGroups->Value (anElemIdx)->Matches (theMgr, thePickResult);
   }
 
   const Standard_Integer aPatchSize = myBvhIndices.PatchSize (theElemIdx);
@@ -1019,7 +1002,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
         if (myToDetectNode
          || myToDetectElem)
         {
-          if (theMgr.Overlaps (aPoint, aPickResult))
+          if (theIsFullInside || theMgr.Overlaps (aPoint, aPickResult))
           {
             if (aPickResult.Depth() <= myMinDepthNode)
             {
@@ -1068,7 +1051,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
 
         if (myToDetectElem)
         {
-          if (theMgr.Overlaps (aPnts[0], aPnts[1], aPnts[2], Select3D_TOS_INTERIOR, aPickResult))
+          if (theIsFullInside || theMgr.Overlaps (aPnts[0], aPnts[1], aPnts[2], Select3D_TOS_INTERIOR, aPickResult))
           {
             if (aPickResult.Depth() <= myMinDepthElem)
             {
@@ -1087,7 +1070,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
         {
           for (int aNodeIter = 0; aNodeIter < 3; ++aNodeIter)
           {
-            if (theMgr.Overlaps (aPnts[aNodeIter], aPickResult))
+            if (theIsFullInside || theMgr.Overlaps (aPnts[aNodeIter], aPickResult))
             {
               if (aPickResult.Depth() <= myMinDepthNode)
               {
@@ -1109,7 +1092,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
           {
             int aNode1 = aNodeIter == 0 ? 2 : (aNodeIter - 1);
             int aNode2 = aNodeIter;
-            if (theMgr.Overlaps (aPnts[aNode1], aPnts[aNode2], aPickResult))
+            if (theIsFullInside || theMgr.Overlaps (aPnts[aNode1], aPnts[aNode2], aPickResult))
             {
               if (aPickResult.Depth() <= myMinDepthEdge)
               {
@@ -1148,13 +1131,14 @@ Standard_Real Select3D_SensitivePrimitiveArray::distanceToCOG (SelectBasics_Sele
 // purpose  :
 // =======================================================================
 Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                                    const Standard_Integer               theElemIdx)
+                                                                    Standard_Integer theElemIdx,
+                                                                    Standard_Boolean theIsFullInside)
 {
   const Standard_Integer anElemIdx = myBvhIndices.Index (theElemIdx);
   if (!myGroups.IsNull())
   {
     SelectBasics_PickResult aDummy;
-    return overlapsElement (theMgr, theElemIdx, aDummy);
+    return myGroups->Value (anElemIdx)->Matches (theMgr, aDummy);
   }
 
   const Standard_Integer aPatchSize = myBvhIndices.PatchSize (theElemIdx);
@@ -1177,7 +1161,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics
         {
           aPoint = vecToPnt (getPosVec2 (aPointIndex));
         }
-        if (!theMgr.Overlaps (aPoint))
+        if (!theIsFullInside && !theMgr.Overlaps (aPoint))
         {
           return Standard_False;
         }
@@ -1218,9 +1202,9 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics
           aPnts[2] = vecToPnt (getPosVec2 (aTriNodes[2]));
         }
 
-        if (!theMgr.Overlaps (aPnts[0])
-         || !theMgr.Overlaps (aPnts[1])
-         || !theMgr.Overlaps (aPnts[2]))
+        if (!theIsFullInside && (   !theMgr.Overlaps (aPnts[0])
+                                 || !theMgr.Overlaps (aPnts[1])
+                                 || !theMgr.Overlaps (aPnts[2])))
         {
           return Standard_False;
         }
index c36cd3e..50e767b 100644 (file)
@@ -278,16 +278,18 @@ protected:
   }
 
   //! Checks whether the element with index theIdx overlaps the current selecting volume
-  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                            SelectBasics_SelectingVolumeManager& theMgr,
                                                             Standard_Integer theElemIdx,
-                                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
   Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                            const Standard_Integer               theElemIdx) Standard_OVERRIDE;
+                                                            Standard_Integer theElemIdx,
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
 private:
 
index df7f996..c7e606a 100644 (file)
@@ -65,14 +65,26 @@ void Select3D_SensitiveSet::BVH()
   myContent.GetBVH();
 }
 
+namespace
+{
+  //! This structure describes the node in BVH
+  struct NodeInStack
+  {
+    NodeInStack (Standard_Integer theId = 0,
+                 Standard_Boolean theIsFullInside = false) : Id (theId), IsFullInside (theIsFullInside) {}
+
+    Standard_Integer Id;           //!< node identifier
+    Standard_Boolean IsFullInside; //!< if the node is completely inside the current selection volume
+  };
+}
+
 //=======================================================================
 // function : Matches
-// purpose  : Checks whether one or more entities of the set overlap
-//            current selecting volume. Implements the traverse of BVH
-//            tree built for the set
+// purpose  :
 //=======================================================================
-Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeManager& theMgr,
-                                                 SelectBasics_PickResult& thePickResult)
+Standard_Boolean Select3D_SensitiveSet::matches (SelectBasics_SelectingVolumeManager& theMgr,
+                                                 SelectBasics_PickResult& thePickResult,
+                                                 Standard_Boolean theToCheckAllInside)
 {
   myDetectedIdx = -1;
   const BVH_Tree<Standard_Real, 3, BVH_BinaryTree>* aBVH = myContent.GetBVH().get();
@@ -82,50 +94,58 @@ Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeMan
     return Standard_False;
   }
 
-  Standard_Integer aStack[BVH_Constants_MaxTreeDepth];
-  Standard_Integer aNode =  0;
+  NodeInStack aStack[BVH_Constants_MaxTreeDepth];
+  NodeInStack aNode;
+
   Standard_Integer aHead = -1;
 
   Standard_Integer aMatchesNb = -1;
   SelectBasics_PickResult aPickResult;
+  const bool toCheckFullInside = (theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point);
   for (;;)
   {
-    const BVH_Vec4i& aData = aBVH->NodeInfoBuffer()[aNode];
+    const BVH_Vec4i& aData = aBVH->NodeInfoBuffer()[aNode.Id];
 
     if (aData.x() == 0) // is inner node
     {
-      const Standard_Integer aLftIdx = aData.y();
-      const Standard_Integer aRghIdx = aData.z();
-
-      Standard_Boolean isLftInside = Standard_True;
-      Standard_Boolean isRghInside = Standard_True;
-
-      Standard_Boolean toCheckLft = theMgr.Overlaps (aBVH->MinPoint (aLftIdx),
-                                                     aBVH->MaxPoint (aLftIdx),
-                                                     theMgr.IsOverlapAllowed() ? NULL : &isLftInside);
+      NodeInStack aLeft (aData.y(), toCheckFullInside), aRight(aData.z(), toCheckFullInside);
+      Standard_Boolean toCheckLft = Standard_True, toCheckRgh = Standard_True;
+      if (!aNode.IsFullInside)
+      {
+        toCheckLft = theMgr.Overlaps (aBVH->MinPoint (aLeft.Id), aBVH->MaxPoint (aLeft.Id), toCheckFullInside ? &aLeft.IsFullInside : NULL);
+        if (!toCheckLft)
+        {
+          aLeft.IsFullInside = Standard_False;
+        }
 
-      Standard_Boolean toCheckRgh = theMgr.Overlaps (aBVH->MinPoint (aRghIdx),
-                                                     aBVH->MaxPoint (aRghIdx),
-                                                     theMgr.IsOverlapAllowed() ? NULL : &isRghInside);
+        toCheckRgh = theMgr.Overlaps (aBVH->MinPoint (aRight.Id), aBVH->MaxPoint (aRight.Id), toCheckFullInside ? &aRight.IsFullInside : NULL);
+        if (!toCheckRgh)
+        {
+          aRight.IsFullInside = Standard_False;
+        }
+      }
 
       if (!theMgr.IsOverlapAllowed()) // inclusion test
       {
-        if (!toCheckLft || !toCheckRgh)
+        if (!theToCheckAllInside)
         {
-          return Standard_False; // no inclusion
-        }
+          if (!toCheckLft || !toCheckRgh)
+          {
+            return Standard_False; // no inclusion
+          }
 
-        toCheckLft &= !isLftInside;
-        toCheckRgh &= !isRghInside;
+          // skip extra checks
+          toCheckLft &= !aLeft.IsFullInside;
+          toCheckRgh &= !aRight.IsFullInside;
+        }
       }
 
       if (toCheckLft || toCheckRgh)
       {
-        aNode = toCheckLft ? aLftIdx : aRghIdx;
-
+        aNode = toCheckLft ? aLeft : aRight;
         if (toCheckLft && toCheckRgh)
         {
-          aStack[++aHead] = aRghIdx;
+          aStack[++aHead] = aRight;
         }
       }
       else
@@ -142,14 +162,18 @@ Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeMan
       {
         if (!theMgr.IsOverlapAllowed()) // inclusion test
         {
-          if (!elementIsInside (theMgr, anElemIdx))
+          if (!elementIsInside (theMgr, anElemIdx, aNode.IsFullInside))
           {
+            if (theToCheckAllInside)
+            {
+              continue;
+            }
             return Standard_False;
           }
         }
         else // overlap test
         {
-          if (!overlapsElement (theMgr, anElemIdx, aPickResult))
+          if (!overlapsElement (aPickResult, theMgr, anElemIdx, aNode.IsFullInside))
           {
             continue;
           }
@@ -159,9 +183,8 @@ Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeMan
             thePickResult = aPickResult;
             myDetectedIdx = anElemIdx;
           }
-
-          ++aMatchesNb;
         }
+        ++aMatchesNb;
       }
 
       if (aHead < 0)
@@ -176,7 +199,8 @@ Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeMan
     thePickResult.SetDistToGeomCenter(distanceToCOG(theMgr));
   }
 
-  return !theMgr.IsOverlapAllowed() || aMatchesNb != -1;
+  return aMatchesNb != -1
+     || (!theToCheckAllInside && !theMgr.IsOverlapAllowed());
 }
 
 //=======================================================================
index 13ad6ba..b03a68e 100644 (file)
@@ -64,8 +64,11 @@ public:
 
   //! Checks whether one or more entities of the set overlap current selecting volume.
   //! Implements the traverse of BVH tree built for the set
-  Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
-                                                    SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+  virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
+                                    SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
+  {
+    return matches (theMgr, thePickResult, false);
+  }
 
   //! Builds BVH tree for sensitive set.
   //! Must be called manually to build BVH tree for any sensitive set
@@ -96,15 +99,36 @@ public:
 
 protected:
 
-  //! Checks whether the entity with index theIdx overlaps the current selecting volume.
-  //! @param theMatchDepth set to the current minimum depth by Select3D_SensitiveSet; should be set to the new depth when overlapping is detected
-  virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  //! Checks whether one or more entities of the set overlap current selecting volume.
+  //! Implements the traverse of BVH tree built for the set
+  //! @param theMgr selection manager
+  //! @param thePickResult picking result (for picking by ray)
+  //! @param theToCheckAllInside flag indicating that even with SelectMgr_SelectingVolumeManager::IsOverlapAllowed() returning FALSE
+  //!        the method will return TRUE if at least one sub-element is fully inside selection volume ::elementIsInside();
+  //!        this is useful for entities allowing local selection of sub-elements using single Owner object.
+  Standard_EXPORT Standard_Boolean matches (SelectBasics_SelectingVolumeManager& theMgr,
+                                            SelectBasics_PickResult& thePickResult,
+                                            Standard_Boolean theToCheckAllInside);
+
+  //! Checks whether the entity with index theIdx (partially) overlaps the current selecting volume.
+  //! @param thePickResult [OUT] picking result, should update minimum depth
+  //! @param theMgr [IN] selection manager
+  //! @param theElemIdx [IN] element index within BVH tree to check
+  //! @param theIsFullInside [IN] when TRUE indicates that entire BVH node is already inside selection volume (in case of rectangle selection);
+  //!                             in this case algorithm might skip checking the element and just register it as detected
+  virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                            SelectBasics_SelectingVolumeManager& theMgr,
                                             Standard_Integer theElemIdx,
-                                            SelectBasics_PickResult& thePickResult) = 0;
+                                            Standard_Boolean theIsFullInside) = 0;
 
-  //! Checks whether the entity with index theIdx is inside the current selecting volume
+  //! Checks whether the entity with index theIdx is (fully) inside the current selecting volume
+  //! @param theMgr [IN] selection manager
+  //! @param theElemIdx [IN] element index within BVH tree to check
+  //! @param theIsFullInside [IN] when TRUE indicates that entire BVH node is already inside selection volume (in case of rectangle selection);
+  //!                             in this case algorithm might skip checking the element and just register it as detected
   virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                            const Standard_Integer               theElemIdx) = 0;
+                                            Standard_Integer theElemIdx,
+                                            Standard_Boolean theIsFullInside) = 0;
 
   //! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
   virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) = 0;
index b8109e5..c583950 100644 (file)
@@ -259,12 +259,17 @@ void Select3D_SensitiveTriangulation::Swap (const Standard_Integer theIdx1,
 // purpose  : Checks whether the element with index theIdx overlaps the
 //            current selecting volume
 //=======================================================================
-Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                                   SelectBasics_SelectingVolumeManager& theMgr,
                                                                    Standard_Integer theElemIdx,
-                                                                   SelectBasics_PickResult& thePickResult)
+                                                                   Standard_Boolean theIsFullInside)
 {
-  const Standard_Integer& aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
+  if (theIsFullInside)
+  {
+    return Standard_True;
+  }
 
+  const Standard_Integer aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
   if (mySensType == Select3D_TOS_BOUNDARY)
   {
     Standard_Integer aSegmStartIdx = myFreeEdges->Value (aPrimitiveIdx * 2 + 1);
@@ -296,10 +301,15 @@ Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_
 // Purpose  :
 //==================================================
 Standard_Boolean Select3D_SensitiveTriangulation::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                                   const Standard_Integer               theElemIdx)
+                                                                   Standard_Integer theElemIdx,
+                                                                   Standard_Boolean theIsFullInside)
 {
-  const Standard_Integer& aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
+  if (theIsFullInside)
+  {
+    return Standard_True;
+  }
 
+  const Standard_Integer aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
   if (mySensType == Select3D_TOS_BOUNDARY)
   {
     const gp_Pnt& aSegmPnt1 = myTriangul->Nodes().Value (myFreeEdges->Value (aPrimitiveIdx * 2 + 1));
index cbd7a4c..b7228f0 100644 (file)
@@ -102,16 +102,18 @@ protected:
 private:
 
   //! Checks whether the element with index theIdx overlaps the current selecting volume
-  virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                            SelectBasics_SelectingVolumeManager& theMgr,
                                             Standard_Integer theElemIdx,
-                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
   virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                            const Standard_Integer               theElemIdx) Standard_OVERRIDE;
+                                            Standard_Integer theElemIdx,
+                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
 private:
 
index fd235fc..8185e4e 100644 (file)
@@ -112,9 +112,10 @@ void Select3D_SensitiveWire::Swap (const Standard_Integer theIdx1,
 // purpose  : Checks whether the entity with index theIdx overlaps the
 //            current selecting volume
 // =======================================================================
-Standard_Boolean Select3D_SensitiveWire::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+Standard_Boolean Select3D_SensitiveWire::overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                          SelectBasics_SelectingVolumeManager& theMgr,
                                                           Standard_Integer theElemIdx,
-                                                          SelectBasics_PickResult& thePickResult)
+                                                          Standard_Boolean )
 {
   const Standard_Integer aSensitiveIdx = myEntityIndexes.Value (theElemIdx);
   const Handle(SelectBasics_SensitiveEntity)& aSeg = myEntities.Value (aSensitiveIdx);
@@ -126,7 +127,8 @@ Standard_Boolean Select3D_SensitiveWire::overlapsElement (SelectBasics_Selecting
 // purpose  :
 // =======================================================================
 Standard_Boolean Select3D_SensitiveWire::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                          const Standard_Integer               theElemIdx)
+                                                          Standard_Integer theElemIdx,
+                                                          Standard_Boolean )
 {
   SelectBasics_PickResult aMatchResult;
   return myEntities.Value (myEntityIndexes.Value (theElemIdx))->Matches (theMgr, aMatchResult);
index ac85ffd..a32f475 100644 (file)
@@ -73,13 +73,15 @@ public:
 protected:
 
   //! Checks whether the entity with index theIdx overlaps the current selecting volume
-  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
+  Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
+                                                            SelectBasics_SelectingVolumeManager& theMgr,
                                                             Standard_Integer theElemIdx,
-                                                            SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Checks whether the entity with index theIdx is inside the current selecting volume
   Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
-                                                            const Standard_Integer               theElemIdx) Standard_OVERRIDE;
+                                                            Standard_Integer theElemIdx,
+                                                            Standard_Boolean theIsFullInside) Standard_OVERRIDE;
 
   //! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
   Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
index fef12b0..5580543 100644 (file)
@@ -27,3 +27,13 @@ SelectBasics_EntityOwner::SelectBasics_EntityOwner (const Standard_Integer thePr
 {
   //
 }
+
+//========================================
+// Function : SelectBasics_EntityOwner
+// Purpose  :
+//========================================
+SelectBasics_EntityOwner::SelectBasics_EntityOwner()
+: mypriority (0)
+{
+  //
+}
index 8a28b97..a03aa13 100644 (file)
@@ -62,7 +62,9 @@ public:
 
 protected:
 
-  Standard_EXPORT SelectBasics_EntityOwner (const Standard_Integer thePriority = 0);
+  Standard_EXPORT SelectBasics_EntityOwner (const Standard_Integer thePriority);
+
+  Standard_EXPORT SelectBasics_EntityOwner();
 
 protected:
 
index 7ebf8a6..1c68de1 100644 (file)
@@ -46,40 +46,40 @@ public:
   //! Returns true if selecting volume is overlapped by box theBox
   virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
                                      const NCollection_Vec3<Standard_Real>& theBoxMax,
-                                     SelectBasics_PickResult& thePickResult) = 0;
+                                     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
   virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
                                      const NCollection_Vec3<Standard_Real>& theBoxMax,
-                                     Standard_Boolean*                      theInside = NULL) = 0;
+                                     Standard_Boolean*                      theInside = NULL) const = 0;
 
   //! Returns true if selecting volume is overlapped by point thePnt
   virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
-                                     SelectBasics_PickResult& thePickResult) = 0;
+                                     SelectBasics_PickResult& thePickResult) const = 0;
 
   //! Returns true if selecting volume is overlapped by point thePnt.
   //! Does not perform depth calculation, so this method is defined as
   //! helper function for inclusion test.
-  virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) = 0;
+  virtual Standard_Boolean Overlaps (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 Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
                                      Standard_Integer theSensType,
-                                     SelectBasics_PickResult& thePickResult) = 0;
+                                     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 Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
                                      Standard_Integer theSensType,
-                                     SelectBasics_PickResult& thePickResult) = 0;
+                                     SelectBasics_PickResult& thePickResult) const = 0;
 
   //! Returns true if selecting volume is overlapped by line segment with start point at thePt1
   //! and end point at thePt2
   virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
                                      const gp_Pnt& thePt2,
-                                     SelectBasics_PickResult& thePickResult) = 0;
+                                     SelectBasics_PickResult& thePickResult) const = 0;
 
   //! Returns true if selecting volume is overlapped by triangle with vertices thePt1,
   //! thePt2 and thePt3, taking into account sensitivity type theSensType
@@ -87,11 +87,11 @@ public:
                                      const gp_Pnt& thePt2,
                                      const gp_Pnt& thePt3,
                                      Standard_Integer theSensType,
-                                     SelectBasics_PickResult& thePickResult) = 0;
+                                     SelectBasics_PickResult& thePickResult) const = 0;
 
   //! Calculates distance from 3d projection of user-defined selection point
   //! to the given point theCOG
-  virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) = 0;
+  virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const = 0;
 
   virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
 
index d9b4484..bf9f43a 100644 (file)
@@ -146,7 +146,7 @@ void SelectMgr_BaseFrustum::SetBuilder (const Handle(SelectMgr_FrustumBuilder)&
 //=======================================================================
 Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
                                                   const SelectMgr_Vec3& /*theBoxMax*/,
-                                                  SelectBasics_PickResult& /*thePickResult*/)
+                                                  SelectBasics_PickResult& /*thePickResult*/) const
 {
   return Standard_False;
 }
@@ -157,7 +157,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBox
 //=======================================================================
 Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
                                                   const SelectMgr_Vec3& /*theBoxMax*/,
-                                                  Standard_Boolean*     /*theInside*/)
+                                                  Standard_Boolean*     /*theInside*/) const
 {
   return Standard_False;
 }
@@ -167,7 +167,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBox
 // purpose  : Intersection test between defined volume and given point
 //=======================================================================
 Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/,
-                                                  SelectBasics_PickResult& )
+                                                  SelectBasics_PickResult& ) const
 {
   return Standard_False;
 }
@@ -176,7 +176,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/,
 // function : Overlaps
 // purpose  : Intersection test between defined volume and given point
 //=======================================================================
-Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/)
+Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/) const
 {
   return Standard_False;
 }
@@ -190,7 +190,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/)
 //=======================================================================
 Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const TColgp_Array1OfPnt& /*theArrayOfPnts*/,
                                                   Select3D_TypeOfSensitivity /*theSensType*/,
-                                                  SelectBasics_PickResult& )
+                                                  SelectBasics_PickResult& ) const
 {
   return Standard_False;
 }
@@ -206,7 +206,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePt1*/,
                                                   const gp_Pnt& /*thePt2*/,
                                                   const gp_Pnt& /*thePt3*/,
                                                   Select3D_TypeOfSensitivity /*theSensType*/,
-                                                  SelectBasics_PickResult& )
+                                                  SelectBasics_PickResult& ) const
 {
   return Standard_False;
 }
@@ -217,7 +217,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePt1*/,
 //=======================================================================
 Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt1*/,
                                                   const gp_Pnt& /*thePnt2*/,
-                                                  SelectBasics_PickResult& )
+                                                  SelectBasics_PickResult& ) const
 {
   return Standard_False;
 }
@@ -227,7 +227,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt1*/,
 // purpose  : Measures distance between 3d projection of user-picked
 //            screen point and given point theCOG
 //=======================================================================
-Standard_Real SelectMgr_BaseFrustum::DistToGeometryCenter (const gp_Pnt& /*theCOG*/)
+Standard_Real SelectMgr_BaseFrustum::DistToGeometryCenter (const gp_Pnt& /*theCOG*/) const
 {
   return DBL_MAX;
 }
@@ -247,7 +247,7 @@ gp_Pnt SelectMgr_BaseFrustum::DetectedPoint (const Standard_Real /*theDepth*/) c
 //            detected belongs to the region defined by clipping planes
 //=======================================================================
 Standard_Boolean SelectMgr_BaseFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& /*thePlanes*/,
-                                                   const Standard_Real /*theDepth*/)
+                                                   const Standard_Real /*theDepth*/) const
 {
   return Standard_True;
 }
index a7890c5..6e4852c 100644 (file)
@@ -120,35 +120,35 @@ public:
   //! SAT intersection test between defined volume and given axis-aligned box
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                      const SelectMgr_Vec3& theBoxMax,
-                                                     SelectBasics_PickResult& thePickResult);
+                                                     SelectBasics_PickResult& thePickResult) const;
 
   //! 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 Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                      const SelectMgr_Vec3& theBoxMax,
-                                                     Standard_Boolean*     theInside = NULL);
+                                                     Standard_Boolean*     theInside = NULL) const;
 
   //! Intersection test between defined volume and given point
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
-                                                     SelectBasics_PickResult& thePickResult);
+                                                     SelectBasics_PickResult& thePickResult) const;
 
   //! 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 Overlaps (const gp_Pnt& thePnt);
+  Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const;
 
   //! 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 Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult);
+                                                     SelectBasics_PickResult& thePickResult) const;
 
   //! Checks if line segment overlaps selecting frustum
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
                                                      const gp_Pnt& thePnt2,
-                                                     SelectBasics_PickResult& thePickResult);
+                                                     SelectBasics_PickResult& thePickResult) const;
 
   //! SAT intersection test between defined volume and given triangle. The test may
   //! be considered of interior part or boundary line defined by triangle vertices
@@ -157,18 +157,18 @@ public:
                                                      const gp_Pnt& thePt2,
                                                      const gp_Pnt& thePt3,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult);
+                                                     SelectBasics_PickResult& thePickResult) const;
 
   //! Measures distance between 3d projection of user-picked
   //! screen point and given point theCOG
-  Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG);
+  Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const;
 
   Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const;
 
   //! Checks if the point of sensitive in which selection was detected belongs
   //! to the region defined by clipping planes
   Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                                      const Standard_Real theDepth);
+                                                      const Standard_Real theDepth) const;
 
   //! Valid for point selection only!
   //! Computes depth range for global (defined for the whole view) clipping planes.
index 1bd6105..d758bb5 100644 (file)
@@ -66,24 +66,24 @@ protected:
   //! with minimum corner at point theMinPt and maximum at point theMaxPt
   Standard_Boolean hasOverlap (const SelectMgr_Vec3& theBoxMin,
                                const SelectMgr_Vec3& theBoxMax,
-                               Standard_Boolean*     theInside = NULL);
+                               Standard_Boolean*     theInside = NULL) const;
 
   //! SAT intersection test between defined volume and given point
-  Standard_Boolean hasOverlap (const gp_Pnt& thePnt);
+  Standard_Boolean hasOverlap (const gp_Pnt& thePnt) const;
 
   //! SAT intersection test between defined volume and given segment
   Standard_Boolean hasOverlap (const gp_Pnt& thePnt1,
-                               const gp_Pnt& thePnt2);
+                               const gp_Pnt& thePnt2) const;
 
   //! SAT intersection test between frustum given and planar convex polygon represented as ordered point set
   Standard_Boolean hasOverlap (const TColgp_Array1OfPnt& theArrayOfPnts,
-                               gp_Vec& theNormal);
+                               gp_Vec& theNormal) const;
 
   //! SAT intersection test between defined volume and given triangle
   Standard_Boolean hasOverlap (const gp_Pnt& thePnt1,
                                const gp_Pnt& thePnt2,
                                const gp_Pnt& thePnt3,
-                               gp_Vec& theNormal);
+                               gp_Vec& theNormal) const;
 
 private:
 
index 1562d3e..b923f01 100644 (file)
@@ -129,7 +129,7 @@ Standard_Boolean SelectMgr_Frustum<N>::isSeparated (const gp_Pnt& thePnt1,
 template <int N>
 Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const SelectMgr_Vec3& theMinPnt,
                                                    const SelectMgr_Vec3& theMaxPnt,
-                                                   Standard_Boolean*     theInside)
+                                                   Standard_Boolean*     theInside) const
 {
   for (Standard_Integer anAxis = 0; anAxis < 3; ++anAxis)
   {
@@ -203,7 +203,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const SelectMgr_Vec3& theMinP
 // purpose  : SAT intersection test between defined volume and given point
 // =======================================================================
 template <int N>
-Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt)
+Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt) const
 {
   const Standard_Integer anIncFactor = (myIsOrthographic && N == 4) ? 2 : 1;
 
@@ -227,7 +227,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt)
 // =======================================================================
 template <int N>
 Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& theStartPnt,
-                                                   const gp_Pnt& theEndPnt)
+                                                   const gp_Pnt& theEndPnt) const
 {
   const gp_XYZ& aDir = theEndPnt.XYZ() - theStartPnt.XYZ();
   if (aDir.Modulus() < Precision::Confusion())
@@ -309,7 +309,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& theStartPnt,
 // =======================================================================
 template <int N>
 Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const TColgp_Array1OfPnt& theArrayOfPnts,
-                                                   gp_Vec& theNormal)
+                                                   gp_Vec& theNormal) const
 {
   Standard_Integer aStartIdx = theArrayOfPnts.Lower();
   Standard_Integer anEndIdx = theArrayOfPnts.Upper();
@@ -406,7 +406,7 @@ template <int N>
 Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt1,
                                                    const gp_Pnt& thePnt2,
                                                    const gp_Pnt& thePnt3,
-                                                   gp_Vec& theNormal)
+                                                   gp_Vec& theNormal) const
 {
   const gp_XYZ aTrEdges[3] = { thePnt2.XYZ() - thePnt1.XYZ(),
                                thePnt3.XYZ() - thePnt2.XYZ(),
index f95a6d1..d972e19 100644 (file)
@@ -24,7 +24,7 @@
 // =======================================================================
 void SelectMgr_RectangularFrustum::segmentSegmentDistance (const gp_Pnt& theSegPnt1,
                                                            const gp_Pnt& theSegPnt2,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           SelectBasics_PickResult& thePickResult) const
 {
   gp_XYZ anU = theSegPnt2.XYZ() - theSegPnt1.XYZ();
   gp_XYZ aV = myViewRayDir.XYZ();
@@ -95,7 +95,7 @@ void SelectMgr_RectangularFrustum::segmentSegmentDistance (const gp_Pnt& theSegP
 // =======================================================================
 bool SelectMgr_RectangularFrustum::segmentPlaneIntersection (const gp_Vec& thePlane,
                                                              const gp_Pnt& thePntOnPlane,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   gp_XYZ anU = myViewRayDir.XYZ();
   gp_XYZ aW = myNearPickedPnt.XYZ() - thePntOnPlane.XYZ();
@@ -429,7 +429,7 @@ Handle(SelectMgr_BaseFrustum) SelectMgr_RectangularFrustum::ScaleAndTransform (c
 // =======================================================================
 Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                          const SelectMgr_Vec3& theBoxMax,
-                                                         Standard_Boolean*     theInside)
+                                                         Standard_Boolean*     theInside) const
 {
   return hasOverlap (theBoxMin, theBoxMax, theInside);
 }
@@ -441,7 +441,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& t
 // =======================================================================
 Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                          const SelectMgr_Vec3& theBoxMax,
-                                                         SelectBasics_PickResult& thePickResult)
+                                                         SelectBasics_PickResult& thePickResult) const
 {
   if (!hasOverlap (theBoxMin, theBoxMax))
     return Standard_False;
@@ -461,7 +461,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& t
 // purpose  : Intersection test between defined volume and given point
 // =======================================================================
 Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt,
-                                                         SelectBasics_PickResult& thePickResult)
+                                                         SelectBasics_PickResult& thePickResult) const
 {
   if (!hasOverlap (thePnt))
     return Standard_False;
@@ -480,7 +480,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt,
 // function : Overlaps
 // purpose  : Intersection test between defined volume and given point
 // =======================================================================
-Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt)
+Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt) const
 {
   return hasOverlap (thePnt);
 }
@@ -491,7 +491,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt)
 // =======================================================================
 Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
                                                          const gp_Pnt& thePnt2,
-                                                         SelectBasics_PickResult& thePickResult)
+                                                         SelectBasics_PickResult& thePickResult) const
 {
   if (!hasOverlap (thePnt1, thePnt2))
     return Standard_False;
@@ -510,7 +510,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
 // =======================================================================
 Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                          Select3D_TypeOfSensitivity theSensType,
-                                                         SelectBasics_PickResult& thePickResult)
+                                                         SelectBasics_PickResult& thePickResult) const
 {
   if (theSensType == Select3D_TOS_BOUNDARY)
   {
@@ -560,7 +560,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
                                                          const gp_Pnt& thePnt2,
                                                          const gp_Pnt& thePnt3,
                                                          Select3D_TypeOfSensitivity theSensType,
-                                                         SelectBasics_PickResult& thePickResult)
+                                                         SelectBasics_PickResult& thePickResult) const
 {
   if (theSensType == Select3D_TOS_BOUNDARY)
   {
@@ -639,7 +639,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
 // purpose  : Measures distance between 3d projection of user-picked
 //            screen point and given point theCOG
 // =======================================================================
-Standard_Real SelectMgr_RectangularFrustum::DistToGeometryCenter (const gp_Pnt& theCOG)
+Standard_Real SelectMgr_RectangularFrustum::DistToGeometryCenter (const gp_Pnt& theCOG) const
 {
   return theCOG.Distance (myNearPickedPnt) * myScale;
 }
@@ -659,7 +659,7 @@ gp_Pnt SelectMgr_RectangularFrustum::DetectedPoint (const Standard_Real theDepth
 // purpose  :
 // =======================================================================
 void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                                         SelectMgr_ViewClipRange& theRange)
+                                                         SelectMgr_ViewClipRange& theRange) const
 {
   Standard_Real aPlaneA, aPlaneB, aPlaneC, aPlaneD;
   for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes); aPlaneIt.More(); aPlaneIt.Next())
@@ -744,7 +744,7 @@ void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_Sequenc
 //            detected belongs to the region defined by clipping planes
 // =======================================================================
 Standard_Boolean SelectMgr_RectangularFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                                          const Standard_Real theDepth)
+                                                          const Standard_Real theDepth) const
 {
   SelectMgr_ViewClipRange aRange;
   computeClippingRange (thePlanes, aRange);
index f2413a9..1fae9f4 100644 (file)
@@ -59,32 +59,32 @@ public:
   //! SAT intersection test between defined volume and given axis-aligned box
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                      const SelectMgr_Vec3& theBoxMax,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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 Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                      const SelectMgr_Vec3& theBoxMax,
-                                                     Standard_Boolean*     theInside = NULL) Standard_OVERRIDE;
+                                                     Standard_Boolean*     theInside) const Standard_OVERRIDE;
 
   //! Intersection test between defined volume and given point
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Intersection test between defined volume and given point
-  Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Boolean Overlaps (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 Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Checks if line segment overlaps selecting frustum
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
                                                      const gp_Pnt& thePnt2,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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
@@ -93,11 +93,11 @@ public:
                                                      const gp_Pnt& thePnt2,
                                                      const gp_Pnt& thePnt3,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Measures distance between 3d projection of user-picked
   //! screen point and given point theCOG
-  Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const Standard_OVERRIDE;
 
   //! 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;
@@ -105,7 +105,7 @@ public:
   //! Checks if the point of sensitive in which selection was detected belongs
   //! to the region defined by clipping planes
   Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                                      const Standard_Real theDepth) Standard_OVERRIDE;
+                                                      const Standard_Real theDepth) const Standard_OVERRIDE;
 
   //! Valid for point selection only!
   //! Computes depth range for global (defined for the whole view) clipping planes.
@@ -141,15 +141,15 @@ protected:
 
   Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1,
                                                const gp_Pnt& theSegPnt2,
-                                               SelectBasics_PickResult& thePickResult);
+                                               SelectBasics_PickResult& thePickResult) const;
 
   Standard_EXPORT bool segmentPlaneIntersection (const gp_Vec& thePlane,
                                                  const gp_Pnt& thePntOnPlane,
-                                                 SelectBasics_PickResult& thePickResult);
+                                                 SelectBasics_PickResult& thePickResult) const;
 
   //! Computes valid depth range for the given clipping planes
   Standard_EXPORT void computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                             SelectMgr_ViewClipRange& theRange);
+                                             SelectMgr_ViewClipRange& theRange) const;
 
   //! Returns false if theDepth must be clipped by current view clip range
   Standard_EXPORT Standard_Boolean isViewClippingOk (const SelectBasics_PickResult& thePickResult) const;
index 879a632..7073a00 100644 (file)
@@ -236,7 +236,7 @@ void SelectMgr_SelectingVolumeManager::BuildSelectingVolume (const TColgp_Array1
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                              const SelectMgr_Vec3& theBoxMax,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -250,7 +250,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                              const SelectMgr_Vec3& theBoxMax,
-                                                             Standard_Boolean*     theInside)
+                                                             Standard_Boolean*     theInside) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -263,7 +263,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec
 // purpose  : Intersection test between defined volume and given point
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -276,7 +276,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePn
 // function : Overlaps
 // purpose  : Intersection test between defined volume and given point
 //=======================================================================
-Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt)
+Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -293,7 +293,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePn
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPnts,
                                                              Standard_Integer theSensType,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -312,7 +312,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const Handle(TColgp
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                              Standard_Integer theSensType,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -328,7 +328,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const TColgp_Array1
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt1,
                                                              const gp_Pnt& thePt2,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -347,7 +347,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt
                                                              const gp_Pnt& thePt2,
                                                              const gp_Pnt& thePt3,
                                                              Standard_Integer theSensType,
-                                                             SelectBasics_PickResult& thePickResult)
+                                                             SelectBasics_PickResult& thePickResult) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -364,7 +364,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt
 // purpose  : Measures distance between 3d projection of user-picked
 //            screen point and given point theCOG
 //=======================================================================
-Standard_Real SelectMgr_SelectingVolumeManager::DistToGeometryCenter (const gp_Pnt& theCOG)
+Standard_Real SelectMgr_SelectingVolumeManager::DistToGeometryCenter (const gp_Pnt& theCOG) const
 {
   if (myActiveSelectionType == Unknown)
     return Standard_False;
@@ -394,7 +394,7 @@ gp_Pnt SelectMgr_SelectingVolumeManager::DetectedPoint (const Standard_Real theD
 //            detected belongs to the region defined by clipping planes
 //=======================================================================
 Standard_Boolean SelectMgr_SelectingVolumeManager::IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                                              const Standard_Real& theDepth)
+                                                              const Standard_Real& theDepth) const
 {
   if (myActiveSelectionType != Point)
     return Standard_False;
index 263ba50..92715fa 100644 (file)
@@ -106,39 +106,39 @@ public:
   //! SAT intersection test between defined volume and given axis-aligned box
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                      const SelectMgr_Vec3& theBoxMax,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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 Overlaps (const SelectMgr_Vec3& theBoxMin,
                                                       const SelectMgr_Vec3& theBoxMax,
-                                                      Standard_Boolean*     theInside = NULL) Standard_OVERRIDE;
+                                                      Standard_Boolean*     theInside = NULL) const Standard_OVERRIDE;
 
   //! Intersection test between defined volume and given point
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Intersection test between defined volume and given point
-  Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Boolean Overlaps (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 Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
                                                      Standard_Integer theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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
   Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
                                                      Standard_Integer theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Checks if line segment overlaps selecting frustum
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
                                                      const gp_Pnt& thePnt2,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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
@@ -147,12 +147,12 @@ public:
                                                       const gp_Pnt& thePnt2,
                                                       const gp_Pnt& thePnt3,
                                                       Standard_Integer theSensType,
-                                                      SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                      SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
 
   //! Measures distance between 3d projection of user-picked
   //! screen point and given point theCOG
-  Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const Standard_OVERRIDE;
 
   //! Calculates the point on a view ray that was detected during the run of selection algo by given depth.
   //! Throws exception if active selection type is not Point.
@@ -161,7 +161,7 @@ public:
   //! Checks if the point of sensitive in which selection was detected belongs
   //! to the region defined by clipping planes
   Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                                      const Standard_Real& theDepth);
+                                                      const Standard_Real& theDepth) const;
 
   //! Is used for rectangular selection only
   //! If theIsToAllow is false, only fully included sensitives will be detected, otherwise the algorithm will
index 488ed90..3e8b1e9 100644 (file)
@@ -169,7 +169,7 @@ Handle(SelectMgr_BaseFrustum) SelectMgr_TriangularFrustum::ScaleAndTransform (co
 //=======================================================================
 Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& theMinPt,
                                                         const SelectMgr_Vec3& theMaxPt,
-                                                        SelectBasics_PickResult& /*thePickResult*/)
+                                                        SelectBasics_PickResult& /*thePickResult*/) const
 {
   return hasOverlap (theMinPt, theMaxPt);
 }
@@ -182,7 +182,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& th
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& theMinPt,
                                                         const SelectMgr_Vec3& theMaxPt,
-                                                        Standard_Boolean* /*theInside*/)
+                                                        Standard_Boolean* /*theInside*/) const
 {
   return hasOverlap (theMinPt, theMaxPt, NULL);
 }
@@ -192,7 +192,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& th
 // purpose  : Intersection test between defined volume and given point
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt,
-                                                        SelectBasics_PickResult& /*thePickResult*/)
+                                                        SelectBasics_PickResult& /*thePickResult*/) const
 {
   return hasOverlap (thePnt);
 }
@@ -206,7 +206,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt,
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                         Select3D_TypeOfSensitivity theSensType,
-                                                        SelectBasics_PickResult& /*thePickResult*/)
+                                                        SelectBasics_PickResult& /*thePickResult*/) const
 {
   if (theSensType == Select3D_TOS_BOUNDARY)
   {
@@ -237,7 +237,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const TColgp_Array1OfPnt
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt1,
                                                         const gp_Pnt& thePnt2,
-                                                        SelectBasics_PickResult& /*thePickResult*/)
+                                                        SelectBasics_PickResult& /*thePickResult*/) const
 {
   return hasOverlap (thePnt1, thePnt2);
 }
@@ -253,7 +253,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt1,
                                                         const gp_Pnt& thePnt2,
                                                         const gp_Pnt& thePnt3,
                                                         Select3D_TypeOfSensitivity theSensType,
-                                                        SelectBasics_PickResult& thePickResult)
+                                                        SelectBasics_PickResult& thePickResult) const
 {
   if (theSensType == Select3D_TOS_BOUNDARY)
   {
index 8be66c0..4dea1f8 100644 (file)
@@ -48,29 +48,29 @@ public:
   //! SAT intersection test between defined volume and given axis-aligned box
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
                                                      const SelectMgr_Vec3& theMaxPnt,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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 Overlaps (const SelectMgr_Vec3& theMinPt,
                                                      const SelectMgr_Vec3& theMaxPt,
-                                                     Standard_Boolean* theInside) Standard_OVERRIDE;
+                                                     Standard_Boolean* theInside) const Standard_OVERRIDE;
 
   //! Intersection test between defined volume and given point
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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
   Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Checks if line segment overlaps selecting frustum
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
                                                      const gp_Pnt& thePnt2,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     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
@@ -79,7 +79,7 @@ public:
                                                      const gp_Pnt& thePnt2,
                                                      const gp_Pnt& thePnt3,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Nullifies the handle to corresponding builder instance to prevent memory leaks
   Standard_EXPORT void Clear();
index c9cdf2e..dee6d1f 100644 (file)
@@ -127,7 +127,7 @@ Handle(SelectMgr_BaseFrustum) SelectMgr_TriangularFrustumSet::ScaleAndTransform
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3& theMinPnt,
                                                            const SelectMgr_Vec3& theMaxPnt,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           SelectBasics_PickResult& thePickResult) const
 {
   for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
   {
@@ -144,7 +144,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3&
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3& theMinPnt,
                                                            const SelectMgr_Vec3& theMaxPnt,
-                                                           Standard_Boolean* /*theInside*/)
+                                                           Standard_Boolean* /*theInside*/) const
 {
   for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
   {
@@ -160,7 +160,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3&
 // purpose  :
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           SelectBasics_PickResult& thePickResult) const
 {
   for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
   {
@@ -177,7 +177,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt,
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
                                                            Select3D_TypeOfSensitivity theSensType,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           SelectBasics_PickResult& thePickResult) const
 {
   for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
   {
@@ -194,7 +194,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const TColgp_Array1Of
 // =======================================================================
 Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt1,
                                                            const gp_Pnt& thePnt2,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           SelectBasics_PickResult& thePickResult) const
 {
   for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
   {
@@ -213,7 +213,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt1
                                                            const gp_Pnt& thePnt2,
                                                            const gp_Pnt& thePnt3,
                                                            Select3D_TypeOfSensitivity theSensType,
-                                                           SelectBasics_PickResult& thePickResult)
+                                                           SelectBasics_PickResult& thePickResult) const
 {
   for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
   {
index b3d5320..47b7bbf 100644 (file)
@@ -52,28 +52,28 @@ public:
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
                                                      const SelectMgr_Vec3& theMaxPnt,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
                                                      const SelectMgr_Vec3& theMaxPnt,
-                                                     Standard_Boolean* theInside) Standard_OVERRIDE;
+                                                     Standard_Boolean* theInside) const Standard_OVERRIDE;
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
                                                      const gp_Pnt& thePnt2,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
                                                      const gp_Pnt& thePnt2,
                                                      const gp_Pnt& thePnt3,
                                                      Select3D_TypeOfSensitivity theSensType,
-                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
+                                                     SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
 
   //! Stores plane equation coefficients (in the following form:
   //! Ax + By + Cz + D = 0) to the given vector
index b80392f..1e73e1f 100644 (file)
@@ -3445,20 +3445,12 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char*
   Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
   if (aContextAIS.IsNull())
   {
-    di << "Call vinit before!\n";
+    std::cout << "Error: no active Viewer\n";
     return 1;
   }
   else if (argc < 3)
   {
-    di << "Use: " << argv[0] << " Name TypeOfArray"
-       << " [vertex] ... [bounds] ... [edges]\n"
-       << "  TypeOfArray={ points | segments | polylines | triangles |\n"
-       << "                trianglefans | trianglestrips | quads |\n"
-       << "                quadstrips | polygons }\n"
-       << "  vertex={ 'v' x y z [normal={ 'n' nx ny nz }] [color={ 'c' r g b }]"
-       << " [texel={ 't' tx ty }] } \n"
-       << "  bounds={ 'b' verticies_count [color={ 'c' r g b }] }\n"
-       << "  edges={ 'e' vertex_id }\n";
+    std::cout << "Syntax error: wrong number of arguments\n";
     return 1;
   }
 
@@ -3466,6 +3458,26 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char*
   Standard_Integer aArgIndex = 1;
   TCollection_AsciiString aName (argv[aArgIndex++]);
   TCollection_AsciiString anArrayType (argv[aArgIndex++]);
+  if (anArrayType == "-shape")
+  {
+    Standard_CString aShapeName = argv[aArgIndex++];
+    TopoDS_Shape aShape = DBRep::Get (aShapeName);
+    Handle(Graphic3d_ArrayOfPrimitives) aTris = StdPrs_ShadedShape::FillTriangles (aShape);
+    if (aShape.IsNull())
+    {
+      std::cout << "Syntax error: shape '" << aShapeName << "' is not found\n";
+      return 1;
+    }
+    else if (aTris.IsNull())
+    {
+      std::cout << "Syntax error: shape '" << aShapeName << "' is not triangulated\n";
+      return 1;
+    }
+
+    Handle(MyPArrayObject) aPObject = new MyPArrayObject (aTris);
+    ViewerTest::Display (aName, aPObject);
+    return 0;
+  }
 
   Standard_Boolean hasVertex = Standard_False;
 
@@ -6306,7 +6318,14 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
     __FILE__, VComputeHLR, group);
 
   theCommands.Add("vdrawparray",
-    "vdrawparray : vdrawparray Name TypeOfArray [vertex = { 'v' x y z [vertex_normal = { 'n' x y z }] [vertex_color = { 'c' r g b }] ] ... [bound = { 'b' vertex_count [bound_color = { 'c' r g b }] ] ... [edge = { 'e' vertex_id ]",
+                "vdrawparray name TypeOfArray={points|segments|polylines|triangles"
+      "\n\t\t:                                |trianglefans|trianglestrips|quads|quadstrips|polygons}"
+      "\n\t\t:              [vertex={'v' x y z [normal={'n' nx ny nz}] [color={'c' r g b}] [texel={'t' tx ty}]]"
+      "\n\t\t:              [bound= {'b' nbVertices [bound_color={'c' r g b}]]"
+      "\n\t\t:              [edge=  {'e' vertexId]"
+      "\n\t\t:              [-shape shapeName]"
+      "\n\t\t: Commands create an Interactive Object for specified Primitive Array definition (Graphic3d_ArrayOfPrimitives)"
+      "\n\t\t: with the main purpose is covering various combinations by tests",
     __FILE__,VDrawPArray,group);
 
   theCommands.Add("vconnect",