Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintBase.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SketchPlugin_ConstraintBase_H_
22 #define SketchPlugin_ConstraintBase_H_
23
24 #include "SketchPlugin.h"
25 #include <SketchPlugin_Constraint.h>
26 #include <SketchPlugin_Sketch.h>
27 #include <ModelAPI_AttributeReference.h>
28 #include <ModelAPI_AttributeRefAttr.h>
29
30 #include <GeomAPI_IPresentable.h>
31 #include <GeomAPI_ICustomPrs.h>
32
33 #include <list>
34
35 /** Description: 
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.
41  *
42  *    The attributes below are named independent of the SolveSpace.
43  *    Some of them may be unused. 
44  *
45  *    Also the list of possible attributes is provided to simplify assignment.
46  */
47
48 #define SKETCH_DIMENSION_COLOR "64,128,225"
49
50 /** \class SketchPlugin_ConstraintBase
51  *  \ingroup Plugins
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.
55  */
56 class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable,
57                                     public GeomAPI_ICustomPrs
58 {
59  public:
60   /// Returns the AIS preview
61   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
62
63   /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
64    *  \param theFeature sub-feature
65    */
66   SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
67   /// Moves the feature
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);
71
72       /// Customize presentation of the feature
73   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
74                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
75   {
76     return theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
77   }
78
79  protected:
80   /// \brief Use plugin manager for features creation
81   SketchPlugin_ConstraintBase()
82   {
83   }
84 };
85
86 #endif