Salome HOME
Copyright update 2020
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintBase.h
1 // Copyright (C) 2014-2020  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
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   /// Customize presentation of the feature
60   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
61                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
62   {
63     return theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
64   }
65
66  protected:
67   /// \brief Use plugin manager for features creation
68   SketchPlugin_ConstraintBase()
69   {
70   }
71 };
72
73 #endif