1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SketcherPrs_Factory_H_
22 #define SketcherPrs_Factory_H_
24 #include "SketcherPrs.h"
25 #include <SketchPlugin_Sketch.h>
27 #include <ModelAPI_Feature.h>
28 #include <ModelAPI_CompositeFeature.h>
30 #include <GeomAPI_Ax3.h>
31 #include <GeomAPI_AISObject.h>
33 #define GET_CONSTRAINT_PRS(NAME) \
34 static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
35 SketchPlugin_Sketch* theSketcher, \
36 AISObjectPtr thePrevious);
39 * Class which creates constraints presentations
41 class SKETCHERPRS_EXPORT SketcherPrs_Factory
44 /// Creates collinear constraint presentation
45 /// \param theConstraint the constraint
46 /// \param thePlane the current sketch plane
47 /// \param thePrevious the previous presentation
48 GET_CONSTRAINT_PRS(collinearConstraint)
50 /// Creates parallel constraint presentation
51 /// \param theConstraint the constraint
52 /// \param thePlane the current sketch plane
53 /// \param thePrevious the previous presentation
54 GET_CONSTRAINT_PRS(parallelConstraint)
56 /// Creates coincedent perpendicular presentation
57 /// \param theConstraint the constraint
58 /// \param thePlane the current sketch plane
59 /// \param thePrevious the previous presentation
60 GET_CONSTRAINT_PRS(perpendicularConstraint)
62 /// Creates rigid constraint presentation
63 /// \param theConstraint the constraint
64 /// \param thePlane the current sketch plane
65 /// \param thePrevious the previous presentation
66 GET_CONSTRAINT_PRS(rigidConstraint)
68 /// Creates horizontal constraint presentation
69 /// \param theConstraint the constraint
70 /// \param thePlane the current sketch plane
71 /// \param thePrevious the previous presentation
72 GET_CONSTRAINT_PRS(horisontalConstraint)
74 /// Creates vertical constraint presentation
75 /// \param theConstraint the constraint
76 /// \param thePlane the current sketch plane
77 /// \param thePrevious the previous presentation
78 GET_CONSTRAINT_PRS(verticalConstraint)
80 /// Creates equal constraint presentation
81 /// \param theConstraint the constraint
82 /// \param thePlane the current sketch plane
83 /// \param thePrevious the previous presentation
84 GET_CONSTRAINT_PRS(equalConstraint)
86 /// Creates tangent constraiont presentation
87 /// \param theConstraint the constraint
88 /// \param thePlane the current sketch plane
89 /// \param thePrevious the previous presentation
90 GET_CONSTRAINT_PRS(tangentConstraint)
92 /// Creates middle constraint presentation
93 /// \param theConstraint the constraint
94 /// \param thePlane the current sketch plane
95 /// \param thePrevious the previous presentation
96 GET_CONSTRAINT_PRS(middleConstraint)
98 /// Creates mirror constraint presentation
99 /// \param theConstraint the constraint
100 /// \param thePlane the current sketch plane
101 /// \param thePrevious the previous presentation
102 GET_CONSTRAINT_PRS(mirrorConstraint)
104 /// Creates translate constraint presentation
105 /// \param theConstraint the constraint
106 /// \param thePlane the current sketch plane
107 /// \param thePrevious the previous presentation
108 GET_CONSTRAINT_PRS(translateConstraint)
110 /// Creates rotate constraint presentation
111 /// \param theConstraint the constraint
112 /// \param thePlane the current sketch plane
113 /// \param thePrevious the previous presentation
114 GET_CONSTRAINT_PRS(rotateConstraint)
116 /// Creates coincedent constraint presentation
117 /// \param theConstraint the constraint
118 /// \param thePlane the current sketch plane
119 /// \param thePrevious the previous presentation
120 GET_CONSTRAINT_PRS(coincidentConstraint)
122 #define GET_CONSTRAINT2_PRS(NAME) \
123 static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
124 const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
125 AISObjectPtr thePrevious);
127 /// Creates angle constraint presentation
128 /// \param theConstraint the constraint
129 /// \param thePlane the current sketch plane
130 /// \param thePrevious the previous presentation
131 GET_CONSTRAINT2_PRS(angleConstraint)
133 /// Creates length dimension presentation
134 /// \param theConstraint the constraint
135 /// \param thePlane the current sketch plane
136 /// \param thePrevious the previous presentation
137 GET_CONSTRAINT2_PRS(lengthDimensionConstraint)
139 /// Creates radius dimension presentation
140 /// \param theConstraint the constraint
141 /// \param thePlane the current sketch plane
142 /// \param thePrevious the previous presentation
143 GET_CONSTRAINT2_PRS(radiusConstraint)