Salome HOME
Merge Python 3 porting.
[modules/gui.git] / src / SVTK / SVTK_InteractorStyle.cxx
index 6bb80535913743fbe32a5d9afe83ccdcd3e9e839..cd5396b4261a85e212bf36b2c5376d81b5881216 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  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
 #include <vtkPerspectiveTransform.h> 
 #include <vtkMatrix4x4.h>
 
+#include <QtxRubberBand.h>
+
 #include <QPixmap>
 #include <QWidget>
-#include <QRubberBand>
 #include <QPolygon>
 
 #include <algorithm>
@@ -1200,6 +1201,11 @@ void SVTK_InteractorStyle::onFinishOperation()
 
           if( anActorCollection )
           {
+           if( !myShiftState && 
+               anActorCollection->GetNumberOfItems () > 1 && 
+               myLastHighlitedActor.GetPointer() ) {
+             anActorCollection->RemoveItem ( myLastHighlitedActor.GetPointer() );
+           }
             anActorCollection->InitTraversal();
             while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
             {
@@ -1611,17 +1617,28 @@ void SVTK_InteractorStyle::DominantCombinedSwitch()
 */
 void SVTK_InteractorStyle::drawRect()
 {
-  if ( !myRectBand ) {
-    myRectBand = new QRubberBand( QRubberBand::Rectangle, GetRenderWidget() );
-    QPalette palette;
-    palette.setColor(myRectBand->foregroundRole(), Qt::white);
-    myRectBand->setPalette(palette);
-  }
-  myRectBand->hide();
+  if ( !myRectBand )
+    myRectBand = new QtxRectRubberBand( GetRenderWidget() );
 
+  myRectBand->setUpdatesEnabled ( false );
   QRect aRect = SUIT_Tools::makeRect(myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y());
-  myRectBand->setGeometry( aRect );
-  myRectBand->setVisible( aRect.isValid() );
+  myRectBand->initGeometry( aRect );
+
+  if ( !myRectBand->isVisible() )
+    myRectBand->show();
+
+  myRectBand->setUpdatesEnabled ( true );
+}
+
+/*!
+  \brief Delete rubber band on the end on the dragging operation.
+*/
+void SVTK_InteractorStyle::endDrawRect()
+{
+  if ( myRectBand ) {
+    myRectBand->clearGeometry();
+    myRectBand->hide();
+  }
 }
 
 bool isIntersect( const QPoint& theStart1, const QPoint& theEnd1,
@@ -1749,17 +1766,6 @@ void SVTK_InteractorStyle::drawPolygon()
   }
 }
 
-/*!
-  \brief Delete rubber band on the end on the dragging operation.
-*/
-void SVTK_InteractorStyle::endDrawRect()
-{
-  if ( myRectBand ) myRectBand->hide();
-
-  delete myRectBand;
-  myRectBand = 0;
-}
-
 /*!
   \brief Delete rubber band on the end on the dragging operation.
 */