]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Display all objects on document opening
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 29 Jul 2014 08:13:49 +0000 (12:13 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 29 Jul 2014 08:13:49 +0000 (12:13 +0400)
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 0cfd7e493742e9e90dd6f0537ef8060287824ff7..6891d57daa7601a43f28fd242982263a9ef8943f 100644 (file)
@@ -161,8 +161,8 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
   QList<ObjectPtr> aObjects = aSelMgr->selection()->selectedObjects();
   if (aObjects.size() > 0) {
-    if (aObjects.size() == 1)
-      theMenu->addAction(action("EDIT_CMD"));
+    //if (aObjects.size() == 1)
+    //  theMenu->addAction(action("EDIT_CMD"));
     bool isVisible = false;
     foreach(ObjectPtr aObject, aObjects) {
       ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
@@ -175,7 +175,7 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
       theMenu->addAction(action("HIDE_CMD"));
     else 
       theMenu->addAction(action("SHOW_CMD"));
-    theMenu->addAction(action("DELETE_CMD"));
+    //theMenu->addAction(action("DELETE_CMD"));
   }
   if (!myWorkshop->isSalomeMode()) {
     QMdiArea* aMDI = myWorkshop->mainWindow()->mdiArea();
index 08692199027deb04d94c6bd53eeb165a70b3c4c3..197b93eca1c73c690d3a210ac5ccb2ea18735a77 100644 (file)
@@ -30,7 +30,8 @@
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
-#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultBody.h>
 
 #include <PartSetPlugin_Part.h>
 
@@ -568,8 +569,9 @@ void XGUI_Workshop::onOpen()
   }
   QApplication::setOverrideCursor(Qt::WaitCursor);
   aDoc->load(myCurrentDir.toLatin1().constData());
-  updateCommandStatus();
   myObjectBrowser->rebuildDataTree();
+  displayAllResults();
+  updateCommandStatus();
   QApplication::restoreOverrideCursor();
 }
 
@@ -1024,3 +1026,32 @@ void XGUI_Workshop::registerValidators() const
   aFactory->registerValidator("ModuleBase_ResulLineValidator", new ModuleBase_ResulLineValidator);
   aFactory->registerValidator("ModuleBase_ResulArcValidator", new ModuleBase_ResulArcValidator);
 }
+
+
+//**************************************************************
+void XGUI_Workshop::displayAllResults()
+{
+  PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+  DocumentPtr aRootDoc = aMgr->rootDocument();
+  displayDocumentResults(aRootDoc);
+  for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
+    ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
+    ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+    displayDocumentResults(aPart->partDoc());
+  }
+  myDisplayer->updateViewer();
+}
+
+//**************************************************************
+void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
+{
+  displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
+  displayGroupResults(theDoc, ModelAPI_ResultBody::group());
+}
+
+//**************************************************************
+void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup)
+{
+  for (int i = 0; i < theDoc->size(theGroup); i++)
+    myDisplayer->display(theDoc->object(theGroup, i), false);
+}
\ No newline at end of file
index 74c20b177a4f38e11d3b18166d66eda1ce7b3736..3fbe33e20dd1b69ff86442a7303b5ae988d04706 100644 (file)
@@ -6,6 +6,7 @@
 #include <Events_Listener.h>
 #include <ModuleBase_Definitions.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Document.h>
 
 #include <QObject>
 #include <QMap>
@@ -161,6 +162,10 @@ protected:
 
   QList<QAction*> getModuleCommands() const;
 
+  void displayAllResults();
+  void displayDocumentResults(DocumentPtr theDoc);
+  void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
+
 protected slots:
   /// SLOT, that is called after the operation is started. Update workshop state according to
   /// the started operation, e.g. visualizes the property panel and connect to it.