Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintBase.h
1 // File:    SketchPlugin_ConstraintBase.h
2 // Created: 08 May 2014
3 // Author:  Artem ZHIDKOV
4
5 #ifndef SketchPlugin_ConstraintBase_H_
6 #define SketchPlugin_ConstraintBase_H_
7
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Constraint.h>
10 #include <SketchPlugin_Sketch.h>
11 #include <ModelAPI_AttributeReference.h>
12 #include <ModelAPI_AttributeRefAttr.h>
13
14 #include <GeomAPI_IPresentable.h>
15
16 #include <list>
17
18 /*  Description: 
19  *    Each constraint uses a set of parameters. In the SolveSpace library 
20  *    these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". 
21  *    The "ptA" and "ptB" parameters represents a point in the constraint.
22  *    The "entityA" and "entityB" represents any other object (and a point too).
23  *    And the "valA" represents a real value.
24  *
25  *    The attributes below are named independent of the SolveSpace.
26  *    Some of them may be unused. 
27  *
28  *    Also the list of possible attributes is provided to simplify assignment.
29  */
30
31 /** \class SketchPlugin_ConstraintBase
32  *  \ingroup DataModel
33  *  \brief Feature for creation of a new constraint between other features.
34  *         Some feature's methods implemented here as dummy to
35  *         Base class for all constraints.
36  */
37 class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable
38 {
39  public:
40   /// Returns the AIS preview
41   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
42
43   /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
44    *  \param theFeature sub-feature
45    */
46   SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
47   /// Moves the feature
48   /// \param theDeltaX the delta for X coordinate is moved
49   /// \param theDeltaY the delta for Y coordinate is moved
50   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
51
52   /// Return the distance between the feature and the point
53   /// \param thePoint the point
54   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
55
56  protected:
57   /// \brief Use plugin manager for features creation
58   SketchPlugin_ConstraintBase()
59   {
60   }
61 };
62
63 #endif