Salome HOME
Method name corrected.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ZLevelsOp.cxx
index 7d12d15a7a0885f8e3ad4d4df800eb7ec1cadb2a..61f318b9c8c8c29eda6e208350db507de0e5ad08 100644 (file)
@@ -50,8 +50,36 @@ void HYDROGUI_ZLevelsOp::startOperation()
 {
   HYDROGUI_Operation::startOperation();
 
-  // TODO
-  abort();
+  HYDROGUI_ZLevelsModel::Object2VisibleList anObject2VisibleList;
+
+  // Get the document
+  Handle(HYDROData_Document) aDoc = doc();
+  if( !aDoc.IsNull() ) {
+    // Get active OCC view id
+    size_t anActiveOCCViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
+
+    // Get objects list
+    HYDROData_SequenceOfObjects aSeqOfObjects = aDoc->GetObjectsLayerOrder( Standard_True );
+    HYDROData_SequenceOfObjects::Iterator anIter( aSeqOfObjects );
+    for ( ; anIter.More(); anIter.Next() ) {
+      Handle(HYDROData_Entity) anObject = anIter.Value();
+      if ( !anObject.IsNull() ) {
+        bool isVisible = module()->isObjectVisible( anActiveOCCViewId, anObject );
+        anObject2VisibleList << HYDROGUI_ZLevelsModel::Object2Visible( anObject, isVisible );
+      }
+    }
+  }
+
+  // Show the dialog
+  myZLevelsDlg = new HYDROGUI_ZLevelsDlg( module()->getApp()->desktop() );
+  myZLevelsDlg->setModal( true );
+  myZLevelsDlg->setObjects( anObject2VisibleList );
+
+  //TODO: reimplement
+  connect( myZLevelsDlg, SIGNAL( accepted() ), this, SLOT( commit() ) );
+  connect( myZLevelsDlg, SIGNAL( rejected() ), this, SLOT( abort() ) );
+
+  myZLevelsDlg->exec();
 }
 
 bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags,