]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_ConstraintBase.h
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 email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef SketchPlugin_ConstraintBase_H_
21 #define SketchPlugin_ConstraintBase_H_
22
23 #include "SketchPlugin.h"
24 #include <SketchPlugin_Constraint.h>
25 #include <SketchPlugin_Sketch.h>
26 #include <ModelAPI_AttributeReference.h>
27 #include <ModelAPI_AttributeRefAttr.h>
28
29 #include <GeomAPI_IPresentable.h>
30 #include <GeomAPI_ICustomPrs.h>
31
32 #include <list>
33
34 /** Description: 
35  *    Each constraint uses a set of parameters. In the SolveSpace library 
36  *    these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". 
37  *    The "ptA" and "ptB" parameters represents a point in the constraint.
38  *    The "entityA" and "entityB" represents any other object (and a point too).
39  *    And the "valA" represents a real value.
40  *
41  *    The attributes below are named independent of the SolveSpace.
42  *    Some of them may be unused. 
43  *
44  *    Also the list of possible attributes is provided to simplify assignment.
45  */
46
47 #define SKETCH_DIMENSION_COLOR "64,128,225"
48
49 /** \class SketchPlugin_ConstraintBase
50  *  \ingroup Plugins
51  *  \brief Feature for creation of a new constraint between other features.
52  *         Some feature's methods implemented here as dummy to
53  *         Base class for all constraints.
54  */
55 class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable,
56                                     public GeomAPI_ICustomPrs
57 {
58  public:
59   /// Returns the AIS preview
60   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
61
62   /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
63    *  \param theFeature sub-feature
64    */
65   SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
66   /// Moves the feature
67   /// \param theDeltaX the delta for X coordinate is moved
68   /// \param theDeltaY the delta for Y coordinate is moved
69   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
70
71       /// Customize presentation of the feature
72   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
73                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
74   {
75     return theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
76   }
77
78  protected:
79   /// \brief Use plugin manager for features creation
80   SketchPlugin_ConstraintBase()
81   {
82   }
83 };
84
85 #endif