]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h
Salome HOME
Simplify sketcher model. Remove obsolete files and classes.
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_Storage.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    PlaneGCSSolver_Storage.h
4 // Created: 14 Dec 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef PlaneGCSSolver_Storage_H_
8 #define PlaneGCSSolver_Storage_H_
9
10 #include <PlaneGCSSolver_Defs.h>
11
12 #include <SketchSolver.h>
13 #include <SketchSolver_Storage.h>
14
15 class PlaneGCSSolver_EntityBuilder;
16
17 /** \class   PlaneGCSSolver_Storage
18  *  \ingroup Plugins
19  *  \brief   Contains all necessary data in PlaneGCS format to solve a single group of constraints
20  */
21 class PlaneGCSSolver_Storage : public SketchSolver_Storage
22 {
23 public:
24   PlaneGCSSolver_Storage(const SolverPtr& theSolver);
25
26 // =============   Inherited from SketchSolver_Storage   =============
27
28   /// \brief Change mapping between constraint from SketchPlugin and
29   ///        a constraint applicable for corresponding solver.
30   /// \param theConstraint       [in]   original SketchPlugin constraint
31   /// \param theSolverConstraint [in]   solver's constraint
32   virtual void addConstraint(ConstraintPtr        theConstraint,
33                              ConstraintWrapperPtr theSolverConstraint);
34
35   /// \brief Add list of temporary constraints which will be destroyed
36   ///        after the next solving of the set of constraints.
37   /// \param theSolverConstraint [in]  solver's constraint
38   virtual void addTemporaryConstraint(const ConstraintWrapperPtr& theSolverConstraint);
39
40
41   /// \brief Convert feature to the form applicable for specific solver and map it
42   /// \param theFeature [in]  feature to convert
43   /// \param theForce   [in]  forced feature creation
44   /// \return \c true if the feature has been created or updated
45   virtual bool update(FeaturePtr theFeature, bool theForce = false);
46
47   /// \brief Convert attribute to the form applicable for specific solver and map it
48   /// \param theAttribute [in]  attribute to convert
49   /// \param theForce     [in]  forced feature creation
50   /// \return \c true if the attribute has been created or updated
51   virtual bool update(AttributePtr theAttribute, bool theForce = false);
52
53
54   /// \brief Removes constraint from the storage
55   /// \return \c true if the constraint and all its parameters are removed successfully
56   virtual bool removeConstraint(ConstraintPtr theConstraint);
57
58   /// \brief Update SketchPlugin features after resolving constraints
59   virtual void refresh() const;
60
61   /// \brief Initialize memory for new solver's parameter
62   double* createParameter();
63   /// \brief Release memory occupied by parameters
64   void removeParameters(const GCS::SET_pD& theParams);
65
66   /// \brief Remove all features became invalid
67   virtual void removeInvalidEntities();
68
69 private:
70   /// \brief Convert feature using specified builder.
71   EntityWrapperPtr createFeature(const FeaturePtr&             theFeature,
72                                  PlaneGCSSolver_EntityBuilder* theBuilder);
73
74   /// \brief Convert attribute using specified builder.
75   EntityWrapperPtr createAttribute(const AttributePtr&           theAttribute,
76                                    PlaneGCSSolver_EntityBuilder* theBuilder);
77
78 private:
79   ConstraintID myConstraintLastID;   ///< identifier of last added constraint
80
81   /// additional constraints for correct processing of the arcs
82   std::map<EntityWrapperPtr, ConstraintWrapperPtr> myArcConstraintMap;
83
84   /// list of removed constraints to notify solver
85   std::list<GCSConstraintPtr> myRemovedConstraints;
86 };
87
88 #endif