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