Salome HOME
Copyright update 2022
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Constraint.h
1 // Copyright (C) 2014-2022  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_Constraint_H_
21 #define SketchPlugin_Constraint_H_
22
23 #include <SketchPlugin_Feature.h>
24
25 #include <string>
26
27 /// Size of the list of constraint attributes
28 const int CONSTRAINT_ATTR_SIZE = 4;
29
30 /** \class SketchPlugin_Constraint
31  *  \brief Abstract interface to the SketchPlugin_ConstraintBase
32  *         For more info see: SketchPlugin_ConstraintBase.h
33  */
34 class SketchPlugin_Constraint : public SketchPlugin_Feature
35 {
36  public:
37   /// The value parameter for the constraint
38   inline static const std::string& VALUE()
39   {
40     static const std::string MY_CONSTRAINT_VALUE("ConstraintValue");
41     return MY_CONSTRAINT_VALUE;
42   }
43   /// The 2D value parameter for the constraint
44   inline static const std::string& FLYOUT_VALUE_PNT()
45   {
46     static const std::string MY_FLYOUT_VALUE_PNT("ConstraintFlyoutValuePnt");
47     return MY_FLYOUT_VALUE_PNT;
48   }
49   /// First entity for the constraint
50   inline static const std::string& ENTITY_A()
51   {
52     static const std::string MY_ENTITY_A("ConstraintEntityA");
53     return MY_ENTITY_A;
54   }
55   /// Second entity for the constraint
56   inline static const std::string& ENTITY_B()
57   {
58     static const std::string MY_ENTITY_B("ConstraintEntityB");
59     return MY_ENTITY_B;
60   }
61   /// Third entity for the constraint
62   inline static const std::string& ENTITY_C()
63   {
64     static const std::string MY_ENTITY_C("ConstraintEntityC");
65     return MY_ENTITY_C;
66   }
67   /// Fourth entity for the constraint
68   inline static const std::string& ENTITY_D()
69   {
70     static const std::string MY_ENTITY_D("ConstraintEntityD");
71     return MY_ENTITY_D;
72   }
73
74   /// List of constraint attributes
75   inline static const std::string& ATTRIBUTE(const int theNumber)
76   {
77     switch (theNumber) {
78       case 0:
79         return ENTITY_A();
80       case 1:
81         return ENTITY_B();
82       case 2:
83         return ENTITY_C();
84       case 3:
85         return ENTITY_D();
86       default:
87         break;
88     }
89     static const std::string EMPTY_STRING("");
90     return EMPTY_STRING;
91   }
92
93  protected:
94   /// \brief Use plugin manager for features creation
95   SketchPlugin_Constraint();
96 };
97
98 typedef std::shared_ptr<SketchPlugin_Constraint> ConstraintPtr;
99
100 #endif