1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SketchPlugin_ConstraintBase_H_
22 #define SketchPlugin_ConstraintBase_H_
24 #include "SketchPlugin.h"
25 #include <SketchPlugin_Constraint.h>
26 #include <SketchPlugin_Sketch.h>
27 #include <ModelAPI_AttributeReference.h>
28 #include <ModelAPI_AttributeRefAttr.h>
30 #include <GeomAPI_IPresentable.h>
31 #include <GeomAPI_ICustomPrs.h>
36 * Each constraint uses a set of parameters. In the SolveSpace library
37 * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB".
38 * The "ptA" and "ptB" parameters represents a point in the constraint.
39 * The "entityA" and "entityB" represents any other object (and a point too).
40 * And the "valA" represents a real value.
42 * The attributes below are named independent of the SolveSpace.
43 * Some of them may be unused.
45 * Also the list of possible attributes is provided to simplify assignment.
48 #define SKETCH_DIMENSION_COLOR "64,128,225"
50 /** \class SketchPlugin_ConstraintBase
52 * \brief Feature for creation of a new constraint between other features.
53 * Some feature's methods implemented here as dummy to
54 * Base class for all constraints.
56 class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable,
57 public GeomAPI_ICustomPrs
60 /// Returns the AIS preview
61 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
63 /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
64 * \param theFeature sub-feature
66 SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
68 /// \param theDeltaX the delta for X coordinate is moved
69 /// \param theDeltaY the delta for Y coordinate is moved
70 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
72 /// Customize presentation of the feature
73 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
74 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
76 return theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
80 /// \brief Use plugin manager for features creation
81 SketchPlugin_ConstraintBase()