]> OCCT Git - occt-copy.git/commitdiff
0030695: Visualization - selection by box should use clipping planes set for viewer
authornds <nds@opencascade.com>
Mon, 6 May 2019 13:34:02 +0000 (16:34 +0300)
committernds <nds@opencascade.com>
Mon, 6 May 2019 13:34:02 +0000 (16:34 +0300)
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/StdSelect/StdSelect_ViewerSelector3d.cxx

index 0476e7fd6bf45d5e4032780d020c298b774548ed..20933e9777456694817242b345bacb74a9ec0b52 100644 (file)
@@ -420,7 +420,36 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
   {
     return;
   }
+  // in case of Box/Polyline selection - keep only Owners having all Entities detected
+  if (!theMgr.ViewClipping().IsNull() &&
+      theMgr.GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Box)
+ //&& theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Polyline))
+  {
+    Graphic3d_BndBox3d aBBox (aSensitivesTree->MinPoint (0), aSensitivesTree->MaxPoint (0));
+    // If box selection is active, and the whole sensitive tree is out of the clip planes
+    // selection is empty for this object
+    const Handle(Graphic3d_SequenceOfHClipPlane)& aViewPlanes = theMgr.ViewClipping();
+
+    for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (*aViewPlanes); aPlaneIt.More(); aPlaneIt.Next())
+    {
+      const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
+      if (!aPlane->IsOn())
+      {
+        continue;
+      }
 
+      Graphic3d_ClipState aState = aPlane->ProbeBox (aBBox);
+      if (aState == Graphic3d_ClipState_Out)
+      {
+        return;
+      }
+      if (aState == Graphic3d_ClipState_On && !mySelectingVolumeMgr.IsOverlapAllowed()) // partially clipped
+      {
+        return;
+      }
+    }
+  }
   const Standard_Integer aFirstStored = mystored.Extent() + 1;
 
   Standard_Integer aStack[BVH_Constants_MaxTreeDepth];
index 19fc15a01dcdb27d5dca760bd289fa87d052bf54..8ed26b7c6d51827d1e9d43b2fc59e6a1f670714c 100644 (file)
@@ -175,6 +175,8 @@ void StdSelect_ViewerSelector3d::Pick (const Standard_Integer theXPMin,
   mySelectingVolumeMgr.BuildSelectingVolume (aMinMousePos,
                                              aMaxMousePos);
 
+  mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes());
+
   TraverseSensitives();
 }
 
@@ -193,6 +195,8 @@ void StdSelect_ViewerSelector3d::Pick (const TColgp_Array1OfPnt2d& thePolyline,
   mySelectingVolumeMgr.SetWindowSize (aWidth, aHeight);
   mySelectingVolumeMgr.BuildSelectingVolume (thePolyline);
 
+  mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes());
+
   TraverseSensitives();
 }