1 // File: SketchPlugin_ConstraintBase.h
2 // Created: 08 May 2014
3 // Author: Artem ZHIDKOV
5 #ifndef SketchPlugin_ConstraintBase_H_
6 #define SketchPlugin_ConstraintBase_H_
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Constraint.h>
10 #include <SketchPlugin_Sketch.h>
11 #include <ModelAPI_AttributeReference.h>
12 #include <ModelAPI_AttributeRefAttr.h>
14 #include <GeomAPI_IPresentable.h>
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.
25 * The attributes below are named independent of the SolveSpace.
26 * Some of them may be unused.
28 * Also the list of possible attributes is provided to simplify assignment.
31 /** \class SketchPlugin_ConstraintBase
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.
37 class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable
40 /// Returns the AIS preview
41 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
43 /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
44 * \param theFeature sub-feature
46 SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
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);
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);
57 /// \brief Use plugin manager for features creation
58 SketchPlugin_ConstraintBase()