Salome HOME
Exlude the user input during process events by application (Bug #325).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 09cd00f85a37587359680c4b37a6453f03db52c5..c9aa1704b558d9240ed4175263256604bdb95820 100644 (file)
@@ -592,6 +592,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( EditDigueId ) );
         theMenu->addSeparator();
       }
+      else if( anIsObstacle )
+      {
+        theMenu->addAction( action( TranslateObstacleId ) );
+        theMenu->addSeparator();
+      }
       else if( anIsVisualState && anIsObjectBrowser )
       {
         theMenu->addAction( action( SaveVisualStateId ) );
@@ -655,7 +660,6 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   if ( anIsOCCView || anIsVTKView ) {
     theMenu->addSeparator();
     theMenu->addAction( action( CopyViewerPositionId ) );
-    myPopupPos = QCursor::pos();
   }
 }
 
@@ -1050,6 +1054,35 @@ void HYDROGUI_Module::setObjectVTKPrs( const int                       theViewId
   aViewShapes.append( theShape );
 }
 
+void HYDROGUI_Module::removeObjectVTKPrs( const int      theViewId,
+                                          const QString& theEntry )
+{
+  if ( !myVTKPrsMap.contains( theViewId ) )
+    return;
+
+  ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
+  Handle(HYDROData_Entity) anObject;
+  QString anEntryRef;
+  for ( int i = 0; i < aViewShapes.length(); )
+  {
+    HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
+    anObject = aShape->getObject();
+    anEntryRef = HYDROGUI_DataObject::dataObjectEntry( anObject );
+    if ( aShape && (!anObject.IsNull()) && ( anEntryRef == theEntry ) )
+    {
+      delete aShape;
+      aViewShapes.removeAt( i );
+      continue;
+    }
+
+    ++i;
+  }
+
+  // Invalidate global Z range
+  double anInvalidRange[2] = { HYDROGUI_VTKPrs::InvalidZValue(), HYDROGUI_VTKPrs::InvalidZValue() };
+  getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
+}
+
 void HYDROGUI_Module::removeObjectVTKPrs( const int                       theViewId,
                                           const Handle(HYDROData_Entity)& theObject )
 {
@@ -1457,7 +1490,8 @@ void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent*
   bool doShow = false;
   HYDROGUI_Displayer* aDisplayer = getDisplayer();
   if ( aDisplayer )
-    doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, QCursor::pos(), aX, aY, aZ );
+    aDisplayer->SaveCursorViewPosition( theViewWindow );
+    doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, aX, aY, aZ );
 
   if ( doShow )
   {
@@ -1485,12 +1519,3 @@ int HYDROGUI_Module::getObjectDisplayOrder(
 
   return anObjectEntries.indexOf( anEntry );
 }
-
-/**
- * Get the popup menu position
- * \return the position
- */
-QPoint HYDROGUI_Module::getPopupPosition() const
-{
- return myPopupPos;
-}