Salome HOME
Delete key regression corrections: in previous implementation sketch entities did...
[modules/shaper.git] / src / SketchSolver / SketchSolver_Storage.h
index e733421ff2730ddb363f80fd0b55630ef93bce5e..7cd073f70f13dc59bf47eff3d805c976dcfb0d08 100644 (file)
@@ -18,7 +18,7 @@
 #include <ModelAPI_Feature.h>
 #include <SketchPlugin_Constraint.h>
 
-
+class SketchSolver_ConstraintDistance;
 typedef std::map<EntityWrapperPtr, std::set<EntityWrapperPtr> > CoincidentPointsMap;
 
 
@@ -37,7 +37,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
@@ -50,7 +51,7 @@ public:
   ///        the list of constraints applicable for corresponding solver.
   /// \param theConstraint        [in]   original SketchPlugin constraint
   /// \param theSolverConstraints [in]   list of solver's constraints
-  SKETCHSOLVER_EXPORT
+  SKETCHSOLVER_EXPORT virtual
     void addConstraint(ConstraintPtr                   theConstraint,
                        std::list<ConstraintWrapperPtr> theSolverConstraints);
 
@@ -100,15 +101,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
@@ -150,6 +142,9 @@ public:
 
   /// \brief Block or unblock events when refreshing features
   SKETCHSOLVER_EXPORT void blockEvents(bool isBlocked);
+  /// \brief Shows the events are blocked for the features in the storage
+  bool isEventsBlocked() const
+  { return myEventsBlocked; }
 
 protected:
   /// \brief Change mapping feature from SketchPlugin and
@@ -169,13 +164,13 @@ protected:
 
   /// \brief Update constraint's data
   /// \return \c true if any value is updated
-  virtual bool update(ConstraintWrapperPtr& theConstraint) = 0;
+  virtual bool update(ConstraintWrapperPtr theConstraint) = 0;
   /// \brief Update entity's data
   /// \return \c true if any value is updated
-  virtual bool update(EntityWrapperPtr& theEntity) = 0;
+  virtual bool update(EntityWrapperPtr theEntity) = 0;
   /// \brief Update parameter's data
   /// \return \c true if the value of parameter is updated
-  virtual bool update(ParameterWrapperPtr& theParameter) = 0;
+  virtual bool update(ParameterWrapperPtr theParameter) = 0;
 
   /// \brief Remove constraint
   /// \return \c true if the constraint and all its parameters are removed successfully
@@ -192,19 +187,23 @@ protected:
   /// \brief Update the group for the given parameter
   virtual void changeGroup(ParameterWrapperPtr theParam, const GroupID& theGroup) = 0;
 
+  /// \brief Verify the feature or any its attribute is used by constraint
+  SKETCHSOLVER_EXPORT bool isUsed(FeaturePtr theFeature) const;
+  /// \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;
 
-  /// \brief Verify the feature or any its attribute is used by constraint
-  bool isUsed(FeaturePtr theFeature) const;
-  /// \brief Verify the attribute is used by constraint
-  bool isUsed(AttributePtr theAttirubute) const;
-
 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;
@@ -214,6 +213,9 @@ 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;
 };
 
 typedef std::shared_ptr<SketchSolver_Storage> StoragePtr;