Salome HOME
Refs #288 - the profile section selected and addition mode is activated
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 4d6b818bdfcd83e947bf4485f356516691c24dbc..c8da5e4d08c7e7451192408b1e43091dee9d5b36 100644 (file)
@@ -190,6 +190,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
   foreach ( const int anId, anObsoleteIds ) {
     myViewManagerMap.remove( anId );
     myObjectStateMap.remove( anId );
+    myObjectDisplayOrderMap.remove( anId );
     myShapesMap.remove( anId );
     myVTKPrsMap.remove( anId );
   }
@@ -867,6 +868,13 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId,
 
     ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ];
     anObjectState.Visibility = theState;
+
+    // Remember the display order ( needed for Z layers assignment only )
+    QStringList& anObjectEntries = myObjectDisplayOrderMap[ theViewId ];
+    anObjectEntries.removeAll( anEntry );
+    if ( theState ) {
+      anObjectEntries.append( anEntry );
+    }
   }
 }
 
@@ -1517,4 +1525,19 @@ void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent*
       aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
     }
   }
+}
+
+/**
+ * Get the object display order. Needed for Z layers assignment only.
+ */
+int HYDROGUI_Module::getObjectDisplayOrder( 
+  const int theViewId, const Handle(HYDROData_Entity)& theObject) const
+{
+  if( theObject.IsNull() )
+    return -1;
+
+  QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject );
+  QStringList anObjectEntries = myObjectDisplayOrderMap.value( theViewId );
+
+  return anObjectEntries.indexOf( anEntry );
 }
\ No newline at end of file