From: mpa Date: Wed, 9 Jul 2014 07:41:07 +0000 (+0400) Subject: 0021791: [CEA 623] Clipping : no difference between a closed shell and a solid X-Git-Tag: V7_5_0a1~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f0af5b61f121c7caff1bfe5cbe0b2d479e361e4;p=modules%2Fgui.git 0021791: [CEA 623] Clipping : no difference between a closed shell and a solid --- diff --git a/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx b/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx index 9275eb7d3..bc4215764 100644 --- a/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx +++ b/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx @@ -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 ); diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 366d3bb0c..7300cebec 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -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 ); } diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 5e2e955b3..d29df5315 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -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); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index be3311217..ecd91a634 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -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 {