1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_ConstraintBase.h
4 // Created: 08 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_ConstraintBase_H_
8 #define SketchPlugin_ConstraintBase_H_
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Constraint.h>
12 #include <SketchPlugin_Sketch.h>
13 #include <ModelAPI_AttributeReference.h>
14 #include <ModelAPI_AttributeRefAttr.h>
16 #include <GeomAPI_IPresentable.h>
21 * Each constraint uses a set of parameters. In the SolveSpace library
22 * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB".
23 * The "ptA" and "ptB" parameters represents a point in the constraint.
24 * The "entityA" and "entityB" represents any other object (and a point too).
25 * And the "valA" represents a real value.
27 * The attributes below are named independent of the SolveSpace.
28 * Some of them may be unused.
30 * Also the list of possible attributes is provided to simplify assignment.
33 #define SKETCH_DIMENSION_COLOR "64,128,225"
35 /** \class SketchPlugin_ConstraintBase
37 * \brief Feature for creation of a new constraint between other features.
38 * Some feature's methods implemented here as dummy to
39 * Base class for all constraints.
41 class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable
44 /// Returns the AIS preview
45 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
47 /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
48 * \param theFeature sub-feature
50 SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
52 /// \param theDeltaX the delta for X coordinate is moved
53 /// \param theDeltaY the delta for Y coordinate is moved
54 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
56 /// Return the distance between the feature and the point
57 /// \param thePoint the point
58 virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
61 /// \brief Use plugin manager for features creation
62 SketchPlugin_ConstraintBase()