Salome HOME
Merge branch 'master' into agy/NewPV1_For_850
[modules/gui.git] / src / OCCViewer / OCCViewer_ClipPlaneInteractor.cxx
index c11065772b2d6a2a7d36f3581fa6d701614a40e6..39d6c0a129dff14d2147199ec185caf6aab20ab1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -141,7 +141,7 @@ bool OCCViewer_ClipPlaneInteractor::isClickable( const Handle(AIS_Plane)& thePla
 
   Handle(AIS_InteractiveContext) anAISContext = myViewer->getAISContext();
 
-  if ( anAISContext->IsSelected( thePlane ) )
+  if ( anAISContext->IsSelected( Handle(AIS_InteractiveObject)::DownCast(thePlane) ) )
   {
     return false;
   }
@@ -172,7 +172,7 @@ bool OCCViewer_ClipPlaneInteractor::isDraggable( const Handle(AIS_Plane)& thePla
 
   Handle(AIS_InteractiveContext) anAISContext = myViewer->getAISContext();
 
-  if ( !anAISContext->IsSelected( thePlane ) )
+  if ( !anAISContext->IsSelected( Handle(AIS_InteractiveObject)::DownCast(thePlane) ) ) 
   {
     return false;
   }
@@ -220,10 +220,10 @@ bool OCCViewer_ClipPlaneInteractor::startDragging( const QPoint& thePickPos,
 
   gp_Pnt aPickPoint = aFindPick.Point( 1 );
 
-  const gp_Dir& aPlaneN      = aPlanePln.Axis().Direction();
-  const gp_Dir& aPlaneX      = aPlanePln.XAxis().Direction();
-  const gp_Dir& aPlaneY      = aPlanePln.YAxis().Direction();
-  const gp_Pnt& aPlaneCenter = aPlanePln.Location();
+  gp_Dir aPlaneN      = aPlanePln.Axis().Direction();
+  gp_Dir aPlaneX      = aPlanePln.XAxis().Direction();
+  gp_Dir aPlaneY      = aPlanePln.YAxis().Direction();
+  gp_Pnt aPlaneCenter = aPlanePln.Location();
 
   switch ( theDragOp )
   {
@@ -406,7 +406,7 @@ void OCCViewer_ClipPlaneInteractor::performDragging( const QPoint& theDragPos,
       thePlane->SetToUpdate();
       thePlane->UpdateSelection();
 
-      myViewer->getAISContext()->Update( thePlane );
+      myViewer->getAISContext()->Update( thePlane , Standard_True );
     }
     break;
 
@@ -447,7 +447,7 @@ void OCCViewer_ClipPlaneInteractor::performDragging( const QPoint& theDragPos,
       thePlane->SetToUpdate();
       thePlane->UpdateSelection();
 
-      myViewer->getAISContext()->Update( thePlane );
+      myViewer->getAISContext()->Update( thePlane , Standard_True );
     }
     break;
   }
@@ -495,7 +495,7 @@ bool OCCViewer_ClipPlaneInteractor::mousePress( QMouseEvent* theEvent,
   Handle(AIS_InteractiveContext) anAISContext = myViewer->getAISContext();
 
   // check detection of plane
-  anAISContext->MoveTo( theEvent->x(), theEvent->y(), aView3D );
+  anAISContext->MoveTo( theEvent->x(), theEvent->y(), aView3D , Standard_True );
 
   if ( !anAISContext->HasDetected() )
   {
@@ -522,7 +522,7 @@ bool OCCViewer_ClipPlaneInteractor::mousePress( QMouseEvent* theEvent,
   // process mouse click on the object
   if ( myIsClickable )
   {
-    myViewer->getAISContext()->SetSelected( aPlane );
+    myViewer->getAISContext()->SetSelected( Handle(AIS_InteractiveObject)::DownCast(aPlane) , Standard_True );
     emit planeClicked( aPlane );
   }
 
@@ -615,6 +615,7 @@ bool OCCViewer_ClipPlaneInteractor::mouseRelease( QMouseEvent* theEvent,
   myInteractedPlane = NULL;
   myIsDraggable     = false;
   myIsClickable     = false;
+  myViewer->getAISContext()->ClearSelected( Standard_True );
   return true;
 }