Salome HOME
0021791: [CEA 623] Clipping : no difference between a closed shell and a solid
authormpa <mpa@opencascade.com>
Wed, 9 Jul 2014 07:41:07 +0000 (11:41 +0400)
committermpa <mpa@opencascade.com>
Wed, 9 Jul 2014 07:41:07 +0000 (11:41 +0400)
src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewWindow.cxx

index 9275eb7d3e6620feed2fd5ed378e81ed87e9f2d5..bc42157645e85ed219d0a8ea8892fa07a1ff1a83 100644 (file)
@@ -520,7 +520,7 @@ bool OCCViewer_ClipPlaneInteractor::mousePress( QMouseEvent* theEvent,
   myIsClickable = isClickable( aPlane );
 
   // process mouse click on the object
-  if ( myIsClickable );
+  if ( myIsClickable )
   {
     myViewer->getAISContext()->SetSelected( aPlane );
     emit planeClicked( aPlane );
index 366d3bb0cc53954d530318213857a9872fda4120..7300cebec3245d5d38278e8949824f8fd9bf127b 100755 (executable)
@@ -1031,7 +1031,16 @@ void OCCViewer_Viewer::setSelectionOptions( bool isPreselectionEnabled, bool isS
   }
 }
 
-
+/*!
+  Creates clipping plane based on the incoming plane
+*/
+Handle(Graphic3d_ClipPlane) OCCViewer_Viewer::createClipPlane(const gp_Pln& thePlane, const Standard_Boolean theIsOn)
+{
+  Handle(Graphic3d_ClipPlane) aGraphic3dPlane = new Graphic3d_ClipPlane( thePlane );
+  aGraphic3dPlane->SetOn( theIsOn );
+  aGraphic3dPlane->SetCapping( Standard_True );
+  return aGraphic3dPlane;
+}
 /*!
   Applies clipping planes to clippable objects
 */
@@ -1053,10 +1062,7 @@ void OCCViewer_Viewer::setClipPlanes(ClipPlanesList theList)
     gp_Pnt anOrigin( aPlane.X, aPlane.Y, aPlane.Z );
     gp_Dir aDirection( aDx, aDy, aDz );
 
-    Handle(Graphic3d_ClipPlane) aGraphic3dPlane = new Graphic3d_ClipPlane( gp_Pln( anOrigin, aDirection ) );
-    aGraphic3dPlane->SetOn( aPlane.IsOn );
-
-    myInternalClipPlanes.Append( aGraphic3dPlane );
+    myInternalClipPlanes.Append( createClipPlane( gp_Pln( anOrigin, aDirection ), aPlane.IsOn ) );
     myClipPlanes.push_back( aPlane );
   }
 
index 5e2e955b38192864e1c8435dddc3266ddb8b44d4..d29df5315de9982e4fd5574c66b54cd5d7b5da5f 100755 (executable)
@@ -156,6 +156,7 @@ public:
   void                            setStaticTrihedronDisplayed(const bool on);
 
   /* Clip planes management */
+  Handle(Graphic3d_ClipPlane)     createClipPlane(const gp_Pln& thePlane, const Standard_Boolean theIsOn);
   void                            setClipPlanes (ClipPlanesList theList);
   ClipPlanesList                  getClipPlanes() const;
   void                            applyExistingClipPlanesToObject (const Handle(AIS_InteractiveObject)& theObject);
index be3311217fd2ee552c0e519507fa26a2278c9177..ecd91a63479b835dbb767e9982201102b16eecd0 100755 (executable)
@@ -2019,16 +2019,13 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x,  const doub
     pln.Coefficients(a, b, c, d);
     
     Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes();
-    Handle(Graphic3d_ClipPlane) aClipPlane;
     if(aPlanes.Size() > 0 ) {
       Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes);
-      aClipPlane = anIter.Value();
+      Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value();
       aClipPlane->SetEquation(pln);
       aClipPlane->SetOn(Standard_True);
     } else {
-      aClipPlane = new Graphic3d_ClipPlane(pln);
-      view->AddClipPlane(aClipPlane);
-      aClipPlane->SetOn(Standard_True);
+      view->AddClipPlane( myModel->createClipPlane( pln, Standard_True ) );
     }
   }
   else {