]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchAPI/SketchAPI_MacroCircle.h
Salome HOME
bos#35152 [EDF] (2023-T1) Sketch Circle should allow user to position construction...
[modules/shaper.git] / src / SketchAPI / SketchAPI_MacroCircle.h
1 // Copyright (C) 2014-2023  CEA, EDF
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 SketchAPI_MacroCircle_H_
21 #define SketchAPI_MacroCircle_H_
22
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
25
26 #include <SketchPlugin_MacroCircle.h>
27
28 class ModelHighAPI_Selection;
29
30 /// \class SketchAPI_MacroCircle
31 /// \ingroup CPPHighAPI
32 /// \brief Interface for Circle feature.
33 class SketchAPI_MacroCircle: public SketchAPI_SketchEntity
34 {
35 public:
36   /// Constructor without values.
37   SKETCHAPI_EXPORT
38   explicit SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature);
39
40   /// Constructor with values.
41   SKETCHAPI_EXPORT
42   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
43                         double theCenterX,
44                         double theCenterY,
45                         double thePassedX,
46                         double thePassedY,
47                         double theAngle);
48
49   /// Constructor with values.
50   SKETCHAPI_EXPORT
51   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
52                         const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
53                         const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
54                         double theAngle);
55
56   /// Constructor with values.
57   SKETCHAPI_EXPORT
58   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
59                         double theX1, double theY1,
60                         double theX2, double theY2,
61                         double theX3, double theY3,
62                         double theAngle);
63
64   /// Constructor with values.
65   SKETCHAPI_EXPORT
66   SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
67                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
68                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
69                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
70                         double theAngle);
71
72   /// Destructor.
73   SKETCHAPI_EXPORT
74   virtual ~SketchAPI_MacroCircle();
75
76   INTERFACE_7(SketchPlugin_MacroCircle::ID(),
77               circleType, SketchPlugin_MacroCircle::CIRCLE_TYPE(),
78               ModelAPI_AttributeString, /** Circle type */,
79               centerPoint, SketchPlugin_MacroCircle::CENTER_POINT_ID(),
80               GeomDataAPI_Point2D, /** Center point */,
81               passedPoint, SketchPlugin_MacroCircle::PASSED_POINT_ID(),
82               GeomDataAPI_Point2D, /** Passed point */,
83               firstPoint, SketchPlugin_MacroCircle::FIRST_POINT_ID(),
84               GeomDataAPI_Point2D, /** First point */,
85               secondPoint, SketchPlugin_MacroCircle::SECOND_POINT_ID(),
86               GeomDataAPI_Point2D, /** Second point */,
87               thirdPoint, SketchPlugin_MacroCircle::THIRD_POINT_ID(),
88               GeomDataAPI_Point2D, /** Third point */,
89               angle, SketchPlugin_MacroCircle::CIRCLE_ROTATE_ANGLE_ID(),
90               ModelAPI_AttributeDouble, /** Angle */)
91
92     /// Returns created points on circle
93     SKETCHAPI_EXPORT
94     std::shared_ptr<SketchAPI_SketchEntity> createdPoint() const;
95 private:
96   /// Set by center and passed points.
97   void setByCenterAndPassedPoints(double theCenterX, double theCenterY,
98                                   double thePassedX, double thePassedY,
99                                   double theAngle);
100
101   /// Set by center and passed points.
102   void setByCenterAndPassedPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
103                                   const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
104                                   double theAngle);
105
106   /// Set by three points.
107   void setByThreePoints(double theX1, double theY1,
108                         double theX2, double theY2,
109                         double theX3, double theY3,
110                         double theAngle);
111
112   /// Set by three points.
113   void setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
114                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
115                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
116                         double theAngle);
117 };
118
119 /// Pointer on Circle object.
120 typedef std::shared_ptr<SketchAPI_MacroCircle> MacroCirclePtr;
121
122 #endif // SketchAPI_MacroCircle_H_