Salome HOME
Fix for the issue #2401
[modules/shaper.git] / src / PartSet / PartSet_OverconstraintListener.cpp
index a9d88731423f6b19dfca95006ba1b5c0ebe46499..640af398ae868f252f563d34e61c89562c30fe6b 100755 (executable)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        SketcherPrs_Angle.cpp
-// Created:     20 August 2015
-// Author:      Vitaly SMETANNIKOV
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_AttributeString.h>
@@ -73,6 +87,9 @@ void PartSet_OverconstraintListener::getCustomColor(const ObjectPtr& theObject,
   if (!myIsActive)
     return;
 
+  FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+  std::string aFeatureName = aFeature->data()->name();
+
   if (myConflictingObjects.find(theObject) != myConflictingObjects.end()) {
     theColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color");
   }
@@ -93,8 +110,11 @@ void PartSet_OverconstraintListener::getCustomColor(const ObjectPtr& theObject,
 void PartSet_OverconstraintListener::processEvent(
                                                  const std::shared_ptr<Events_Message>& theMessage)
 {
-  if (!myIsActive)
-    return;
+  // #2271 open document: if sketch has confilcting elements, solver sends message with the
+  // elements by opening the document. Sketch is not active, but an internal container should
+  // be updated. So, we should not check whether the listener is active here
+  //if (!myIsActive)
+  //  return;
 
 #ifdef DEBUG_FEATURE_OVERCONSTRAINT_LISTENER
   bool isRepaired = theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED);