Salome HOME
Open document problem is corrected: after opening a document, all default filters...
authornds <nds@opencascade.com>
Tue, 7 Nov 2017 09:35:10 +0000 (12:35 +0300)
committernds <nds@opencascade.com>
Tue, 7 Nov 2017 09:35:10 +0000 (12:35 +0300)
src/PartSet/PartSet_Filters.cpp
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_Workshop.cpp

index 2851ea877dc2fac100e4d03b987cd42eceebc1a7..afe4fbbda47d0090db276282818800f086cda5f5 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultGroup.h>
 #include <ModelAPI_Session.h>
 
 #include <AIS_InteractiveObject.hxx>
@@ -57,11 +58,17 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)&
         ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
         // result of parts belongs to PartSet document and can be selected only when PartSet
         //  is active in order to do not select the result of the active part.
-        if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group()) {
-          SessionPtr aMgr = ModelAPI_Session::get();
-          aValid = aMgr->activeDocument() == aMgr->moduleDocument();
+        if (aResult.get()) {
+          if (aResult->groupName() == ModelAPI_ResultPart::group()) {
+            SessionPtr aMgr = ModelAPI_Session::get();
+            aValid = aMgr->activeDocument() == aMgr->moduleDocument();
+          } else if (aResult->groupName() == ModelAPI_ResultGroup::group()) {
+            aValid = Standard_False;
+          } else
+            aValid = Standard_True;
         }
-        else {
+        else { // possibly this code is obsolete, as a feature object can be selected in recovery
+          // only and there can not be Group feature
           FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
           if (aFeature) {
             aValid = aFeature->getKind() != "Group";
index 8ae275c83eb766e8747a46e86ee18a4d517d40c6..3f3c23bd529f361936a65df367ce3d94088b8c1c 100755 (executable)
@@ -624,7 +624,6 @@ bool PartSet_Module::isSketchNeutralPointActivated() const
 void PartSet_Module::closeDocument()
 {
   myActivePartIndex = QModelIndex();
-  clearViewer();
 }
 
 void PartSet_Module::clearViewer()
index e3bca97c24195b48e6505d4a8051694d98398333..92158be6a97c0cad763ef74aa9986b9328d56150 100755 (executable)
@@ -2259,6 +2259,9 @@ void XGUI_Workshop::closeDocument()
   objectBrowser()->clearContent();
 
   module()->closeDocument();
+  // we need to clear viewer (with created filters) to do not have problems in 2nd SALOME study
+  module()->clearViewer();
+
 
   // data model need not process the document's signals about objects modifications as
   // the document is closed