Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchAPI / SketchAPI_MacroArc.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 SketchAPI_MacroArc_H_
22 #define SketchAPI_MacroArc_H_
23
24 #include "SketchAPI.h"
25 #include "SketchAPI_SketchEntity.h"
26
27 #include <GeomDataAPI_Point2D.h>
28
29 #include <SketchPlugin_MacroArc.h>
30
31 class ModelHighAPI_RefAttr;
32 class ModelHighAPI_Selection;
33
34 /// \class SketchAPI_MacroArc
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Arc feature.
37 class SketchAPI_MacroArc: public SketchAPI_SketchEntity
38 {
39 public:
40   /// Constructor without values.
41   SKETCHAPI_EXPORT
42   explicit SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   SKETCHAPI_EXPORT
46   SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                 double theCenterX, double theCenterY,
48                 double theStartX, double theStartY,
49                 double theEndX, double theEndY,
50                 bool theInversed);
51
52   /// Constructor with values.
53   SKETCHAPI_EXPORT
54   SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55                 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
56                 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
57                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
58                 bool theInversed);
59
60   /// Constructor with values.
61   SKETCHAPI_EXPORT
62   SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63                 double theStartX, double theStartY,
64                 double theEndX, double theEndY,
65                 double thePassedX, double thePassedY);
66
67   /// Constructor with values.
68   SKETCHAPI_EXPORT
69   SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
70                 const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
71                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
72                 const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
73
74   /// Constructor with values.
75   SKETCHAPI_EXPORT
76   SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
77                 const ModelHighAPI_RefAttr& theTangentPoint,
78                 double theEndX, double theEndY,
79                 bool theInversed);
80
81   /// Constructor with values.
82   SKETCHAPI_EXPORT
83   SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
84                 const ModelHighAPI_RefAttr& theTangentPoint,
85                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
86                 bool theInversed);
87
88   /// Destructor.
89   SKETCHAPI_EXPORT
90   virtual ~SketchAPI_MacroArc();
91
92   void test() {
93     SketchPlugin_MacroArc::ID();
94   }
95
96   INTERFACE_12(SketchPlugin_MacroArc::ID(),
97                arcType, SketchPlugin_MacroArc::ARC_TYPE(),
98                ModelAPI_AttributeString, /** Arc type */,
99                center, SketchPlugin_MacroArc::CENTER_POINT_ID(),
100                GeomDataAPI_Point2D, /** Center point */,
101                startPoint1, SketchPlugin_MacroArc::START_POINT_1_ID(),
102                GeomDataAPI_Point2D, /** Start point */,
103                endPoint1, SketchPlugin_MacroArc::END_POINT_1_ID(),
104                GeomDataAPI_Point2D, /** End point */,
105                startPoint2, SketchPlugin_MacroArc::START_POINT_2_ID(),
106                GeomDataAPI_Point2D, /** Start point */,
107                endPoint2, SketchPlugin_MacroArc::END_POINT_2_ID(),
108                GeomDataAPI_Point2D, /** End point */,
109                passedPoint, SketchPlugin_MacroArc::PASSED_POINT_ID(),
110                GeomDataAPI_Point2D, /** Passed point */,
111                tangentPoint, SketchPlugin_MacroArc::TANGENT_POINT_ID(),
112                ModelAPI_AttributeRefAttr, /** Tangent point */,
113                endPoint3, SketchPlugin_MacroArc::END_POINT_3_ID(),
114                GeomDataAPI_Point2D, /** End point */,
115                reversed, SketchPlugin_MacroArc::REVERSED_ID(),
116                ModelAPI_AttributeBoolean, /** Reversed flag */,
117                radius, SketchPlugin_MacroArc::RADIUS_ID(),
118                ModelAPI_AttributeDouble, /** Radius */,
119                angle, SketchPlugin_MacroArc::ANGLE_ID(),
120                ModelAPI_AttributeDouble, /** Angle */)
121
122 private:
123
124   /// Set by center and start, end point.
125   SKETCHAPI_EXPORT
126   void setByCenterStartEnd(double theCenterX, double theCenterY,
127                            double theStartX, double theStartY,
128                            double theEndX, double theEndY,
129                            bool theInversed);
130
131   /// Set by center and start, end point.
132   SKETCHAPI_EXPORT
133   void setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
134                            const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
135                            const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
136                            bool theInversed);
137
138   /// Set by start, end and passed points.
139   SKETCHAPI_EXPORT
140   void setByStartEndPassed(double theStartX, double theStartY,
141                            double theEndX, double theEndY,
142                            double thePassedX, double thePassedY);
143
144   /// Set by start, end and passed points.
145   SKETCHAPI_EXPORT
146   void setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
147                            const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
148                            const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
149
150   /// Set by tangent and end point.
151   SKETCHAPI_EXPORT
152   void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
153                     double theEndX, double theEndY,
154                     bool theInversed);
155
156   /// Set by tangent and end point.
157   SKETCHAPI_EXPORT
158   void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
159                     const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
160                     bool theInversed);
161 };
162
163 /// Pointer on Arc object.
164 typedef std::shared_ptr<SketchAPI_MacroArc> MacroArcPtr;
165
166 #endif // SketchAPI_MacroArc_H_