Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_OverconstraintListener.h
old mode 100755 (executable)
new mode 100644 (file)
index 1f0e8f0..c407824
@@ -1,9 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_OverconstraintListener.h
-// Created:     8 Feb 2016
-// Author:      Natalia ERMOLAEVA
-
+// Copyright (C) 2014-2023  CEA, EDF
+//
+// 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
+//
 
 #ifndef PartSet_OverconstraintListener_H
 #define PartSet_OverconstraintListener_H
@@ -12,7 +24,7 @@
 #include <ModelAPI_Object.h>
 
 class ModuleBase_IWorkshop;
-class XGUI_Workshop;
+class PartSet_Module;
 
 #include <QString>
 
@@ -33,23 +45,37 @@ public:
 
   virtual ~PartSet_OverconstraintListener() {};
 
-  // Set erroneous color for the presentation of object if the object is in the conflicting list
-  // \param theObject an object to be settled
-  // \param theUpdateViewer a boolean state whether the current viewer should be updated
-  //bool customizeObject(ObjectPtr theObject, const bool theUpdateViewer);
+  /// If active state is changed, update fully defined state and sketch sub-entities color
+  /// \param theActive a state
+  void setActive(const bool& theActive);
 
   /// Returns true if the object belongs to internal container of conflicting objects
   /// \param theObject an object to be checked
-  /// \return boolean result
-  bool isConflictingObject(const ObjectPtr& theObject);
-
-  /// Returns values of conflicting color
   /// \param theColor the output container to be filled in [red, green, blue] values
-  void getConflictingColor(std::vector<int>& theColor);
+  /// \return boolean result
+  void getCustomColor(const ObjectPtr& theObject, std::vector<int>& theColor);
 
   /// Redefinition of Events_Listener method
   virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
 
+
+  bool isConflictingObject(const ObjectPtr& theObject) const
+  {
+    return (myConflictingObjects.find(theObject) != myConflictingObjects.end());
+  }
+
+  const std::set<ObjectPtr>& conflictingObjects() const
+  {
+    return myConflictingObjects;
+  }
+
+  const std::set<ObjectPtr>& objectsToRemove() const
+  {
+    return myObjectsToRemove;
+  }
+
+  bool isFullyConstrained() const { return myIsFullyConstrained; }
+
 protected:
   /// Append objects to the internal container of conflicting object, redisplay necessary objects
   /// \param theObjects a list of new conflicting objects
@@ -66,8 +92,8 @@ protected:
   void redisplayObjects(const std::set<ObjectPtr>& theObjects);
 
 private:
-  /// Returns workshop
-  XGUI_Workshop* workshop() const;
+  /// Returns module
+  PartSet_Module* module() const;
 
 #ifdef _DEBUG
   /// Unite objects in one string information
@@ -77,8 +103,11 @@ private:
 #endif
 
 private:
-  std::set<ObjectPtr> myConflictingObjects;
   ModuleBase_IWorkshop* myWorkshop;
+  bool myIsActive; /// state if sketch is active
+  std::set<ObjectPtr> myConflictingObjects;
+  std::set<ObjectPtr> myObjectsToRemove;
+  bool myIsFullyConstrained; /// state if Solver is fully constrained, DOF = 0
 };
 
 #endif