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