]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #1712 : avoid duplicates and not-concealed attributes usage
authormpv <mpv@opencascade.com>
Fri, 2 Sep 2016 08:09:11 +0000 (11:09 +0300)
committermpv <mpv@opencascade.com>
Fri, 2 Sep 2016 08:09:11 +0000 (11:09 +0300)
src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp

index c39cbd4da9671f6a8fcb524bc9422dff4ca839ac..fd5c23cef031e89b506505c491cc06c894767ff7 100644 (file)
@@ -10,6 +10,8 @@
 #include <ModelAPI_Result.h>\r
 #include <ModelAPI_AttributeReference.h>\r
 #include <ModelAPI_AttributeRefList.h>\r
+#include <ModelAPI_Session.h>\r
+#include <ModelAPI_Validator.h>\r
 \r
 #include <Config_WidgetAPI.h>\r
 \r
@@ -75,12 +77,19 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom()
       myBaseFeature->data()->referencesToObjects(aRefs);\r
       std::list<std::pair<std::string, std::list<ObjectPtr> > >::const_iterator\r
                                                       anIt = aRefs.begin(), aLast = aRefs.end();\r
+      std::set<ResultPtr> alreadyThere; // to avoid duplications\r
       for (; anIt != aLast; anIt++) {\r
+        if (!ModelAPI_Session::get()->validators()->\r
+              isConcealed(myBaseFeature->getKind(), anIt->first))\r
+          continue; // use only concealed attributes\r
         std::list<ObjectPtr> anObjects = (*anIt).second;\r
         std::list<ObjectPtr>::const_iterator anOIt = anObjects.begin(), anOLast = anObjects.end();\r
         for (; anOIt != anOLast; anOIt++) {\r
           ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(*anOIt);\r
           if (aResult && aResult->isConcealed()) {\r
+            if (alreadyThere.find(aResult) == alreadyThere.end()) // issue 1712, avoid duplicates\r
+              alreadyThere.insert(aResult);\r
+            else continue;\r
             int aRowId = myView->rowCount();\r
             addViewRow(aResult);\r
             myConcealedResults[aRowId] = aResult;\r