]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Show/Hide for Part result
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 2 Jun 2015 14:42:29 +0000 (17:42 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 2 Jun 2015 14:42:29 +0000 (17:42 +0300)
src/ModuleBase/ModuleBase_ParamSpinBox.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index bcd0d28e1a149c4a01a0789c0858d7487bb1c384..dd3eebd30c9c8d5fbac839adace8a0c1acb183b6 100644 (file)
@@ -164,7 +164,8 @@ bool ModuleBase_ParamSpinBox::hasVariable() const
 
 bool ModuleBase_ParamSpinBox::hasVariable(const QString& theText) const
 {
-  QRegExp varNameMask("[-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?");
+  //QRegExp varNameMask("[-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?"); //This row causes problem with input in sketcher (circle)
+  QRegExp varNameMask("[-+]?[0-9]*.?[0-9]+([eE][-+]?[0-9]+)?");
   return !varNameMask.exactMatch(theText);
 }
 
index 88f167b96b0471363ac67017334f9b17a4bcb912..c9a9689f4f39c0f12c6ac3df9431a3752bc9d0c7 100644 (file)
@@ -164,6 +164,12 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
           } else if (hasResult && (!hasParameter)) {
             aMenu->addAction(action("SHOW_CMD"));
           }
+
+          ResultPartPtr aPartRes = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+          if (aPartRes) {
+            aMenu->addAction(action("SHOW_CMD"));
+          }
+
           if (!(hasParameter || hasFeature))
             aMenu->addAction(action("SHOW_ONLY_CMD"));
         }
index e56e696f5d2b79aef5f5c3937986be1bc3716b9d..bfdc7f104a97efc8c984ae8049f41248ee9c5f6a 100644 (file)
@@ -1587,29 +1587,46 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects)
 }
 
 //**************************************************************
+#define SET_DISPLAY_GROUP(aGroupName, aDisplay) \
+for (int i = 0; i < aDoc->size(aGroupName); i++) { \
+  aDoc->object(aGroupName, i)->setDisplayed(aDisplay); \
+}
 void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
 {
   foreach (ObjectPtr aObj, theList) {
-    if (isVisible) {
-      aObj->setDisplayed(true);
-      //displayObject(aObj);
+    ResultPartPtr aPartRes = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+    if (aPartRes) {
+      DocumentPtr aDoc = aPartRes->partDoc();
+      SET_DISPLAY_GROUP(ModelAPI_ResultBody::group(), isVisible)
+      SET_DISPLAY_GROUP(ModelAPI_ResultConstruction::group(), isVisible)
+      SET_DISPLAY_GROUP(ModelAPI_ResultGroup::group(), isVisible)
     } else {
-      aObj->setDisplayed(false);
-      //myDisplayer->erase(aObj, false);
+      aObj->setDisplayed(isVisible);
     }
   }
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-  //myDisplayer->updateViewer();
 }
 
 //**************************************************************
 void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList)
 {
+  // Hide all displayed objects
   QObjectPtrList aList = myDisplayer->displayedObjects();
   foreach (ObjectPtr aObj, aList)
     aObj->setDisplayed(false);
-  foreach (ObjectPtr aObj, theList)
-    aObj->setDisplayed(true);
+
+  // Show only objects from the list
+  foreach (ObjectPtr aObj, theList) {
+    ResultPartPtr aPartRes = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+    if (aPartRes) {
+      DocumentPtr aDoc = aPartRes->partDoc();
+      SET_DISPLAY_GROUP(ModelAPI_ResultBody::group(), true)
+      SET_DISPLAY_GROUP(ModelAPI_ResultConstruction::group(), true)
+      SET_DISPLAY_GROUP(ModelAPI_ResultGroup::group(), true)
+    } else {
+      aObj->setDisplayed(true);
+    }
+  }
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 
 }