Salome HOME
Pipe validator fix
[modules/shaper.git] / src / SketchSolver / SketchSolver_Storage.h
index a35a7366b5e53b6d8785e7461d9a5ca52f9c2feb..454044c8826f42fea46eee82a5c57d6a89751558 100644 (file)
@@ -18,7 +18,8 @@
 #include <ModelAPI_Feature.h>
 #include <SketchPlugin_Constraint.h>
 
-
+class SketchSolver_ConstraintDistance;
+class SketchSolver_ConstraintFixedArcRadius;
 typedef std::map<EntityWrapperPtr, std::set<EntityWrapperPtr> > CoincidentPointsMap;
 
 
@@ -37,7 +38,8 @@ public:
   SketchSolver_Storage(const GroupID& theGroup)
     : myGroupID(theGroup),
       myNeedToResolve(false),
-      myEventsBlocked(false)
+      myEventsBlocked(false),
+      myExistArc(false)
   {}
 
   /// \brief Change mapping between constraint from SketchPlugin and
@@ -100,15 +102,6 @@ public:
   /// \brief Remove all features became invalid
   SKETCHSOLVER_EXPORT void removeInvalidEntities();
 
-////  /// \brief Mark specified constraint as temporary
-////  virtual void setTemporary(ConstraintPtr theConstraint) = 0;
-////  /// \brief Returns number of temporary constraints
-////  virtual size_t nbTemporary() const = 0;
-////  /// \brief Remove temporary constraints
-////  /// \param theNbConstraints [in]  number of temporary constraints to be deleted
-////  /// \return number of remaining temporary constraints
-////  virtual size_t removeTemporary(size_t theNbConstraints = 1) = 0;
-
   /// \brief Check whether the feature or its attributes are used by this storage
   /// \param theFeature [in]  feature to be checked
   /// \return \c true if the feature interacts with the storage
@@ -121,6 +114,10 @@ public:
   /// \brief Check the features is not removed
   bool isConsistent() const;
 
+  /// \brief Check the storage has constraints
+  bool isEmpty() const
+  { return myConstraintMap.empty(); }
+
   /// \brief Check the entity is fixed.
   ///        If the point is under verification, all coincident points are checked too.
   SKETCHSOLVER_EXPORT bool isFixed(EntityWrapperPtr theEntity) const;
@@ -134,6 +131,8 @@ public:
 
   /// \brief Initialize solver by constraints, entities and parameters
   virtual void initializeSolver(SolverPtr theSolver) = 0;
+  /// \brief Return list of conflicting constraints
+  std::set<ObjectPtr> getConflictingConstraints(SolverPtr theSolver) const;
 
   /// \brief Update SketchPlugin features after resolving constraints
   /// \param theFixedOnly [in]  if \c true the fixed points will be updated only
@@ -200,6 +199,9 @@ protected:
   /// \brief Verify the attribute is used by constraint
   SKETCHSOLVER_EXPORT bool isUsed(AttributePtr theAttirubute) const;
 
+  /// \brief Find arcs without corresponding entity applicable for the solver and build them
+  SKETCHSOLVER_EXPORT void processArcs();
+
 private:
   /// \brief Find the normal of the sketch
   EntityWrapperPtr getNormal() const;
@@ -208,6 +210,7 @@ protected:
   GroupID myGroupID;       ///< identifier of the group, this storage belongs to
   bool    myNeedToResolve; ///< parameters are changed and group needs to be resolved
   bool    myEventsBlocked; ///< indicates that features do not send events
+  bool    myExistArc;      ///< the storage has any point of arc but not full arc, need to add it
 
   /// map SketchPlugin constraint to a list of solver's constraints
   std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> > myConstraintMap;
@@ -217,6 +220,10 @@ protected:
   std::map<AttributePtr, EntityWrapperPtr>                  myAttributeMap;
 
   CoincidentPointsMap myCoincidentPoints; ///< lists of coincident points (first is a master point, second is a set of slaves)
+
+  // to be able to update entities from constraints
+  friend class SketchSolver_ConstraintDistance;
+  friend class SketchSolver_ConstraintFixedArcRadius;
 };
 
 typedef std::shared_ptr<SketchSolver_Storage> StoragePtr;