Salome HOME
cc8e3f64e86b8db451e1fe64a69fc830c7883aac
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.h
1 // Name   : SketchAPI_Sketch.h
2 // Purpose: 
3 //
4 // History:
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
6
7 #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
8 #define SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
9
10 //--------------------------------------------------------------------------------------
11 #include "SketchAPI.h"
12
13 #include <SketchPlugin_Sketch.h>
14 #include <SketchPlugin_SketchEntity.h>
15
16 #include <ModelHighAPI_Interface.h>
17 #include <ModelHighAPI_Macro.h>
18 //--------------------------------------------------------------------------------------
19 class ModelAPI_CompositeFeature;
20 class ModelHighAPI_Selection;
21 class SketchAPI_Line;
22 //--------------------------------------------------------------------------------------
23 /**\class SketchAPI_Sketch
24  * \ingroup CPPHighAPI
25  * \brief Interface for Sketch feature
26  */
27 class SketchAPI_Sketch : public ModelHighAPI_Interface
28 {
29 public:
30   /// Constructor without values
31   SKETCHAPI_EXPORT
32   explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
33   /// Constructor with values
34   SKETCHAPI_EXPORT
35   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
36                    const std::shared_ptr<GeomAPI_Ax3> & thePlane);
37   /// Constructor with values
38   SKETCHAPI_EXPORT
39   SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
40                    const ModelHighAPI_Selection & theExternal);
41   /// Destructor
42   SKETCHAPI_EXPORT
43   virtual ~SketchAPI_Sketch();
44
45   INTERFACE_7(SketchPlugin_Sketch::ID(),
46               origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
47               dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
48               normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
49               features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
50               external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
51               solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
52               solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
53   )
54
55   /// Set plane
56   SKETCHAPI_EXPORT
57   void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
58
59   /// Set external
60   SKETCHAPI_EXPORT
61   void setExternal(const ModelHighAPI_Selection & theExternal);
62
63   // TODO(spo): addPoint
64
65   /// Add line
66   SKETCHAPI_EXPORT
67   std::shared_ptr<SketchAPI_Line> addLine(
68       double theX1, double theY1, double theX2, double theY2);
69   /// Add line
70   SKETCHAPI_EXPORT
71   std::shared_ptr<SketchAPI_Line> addLine(
72       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
73       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
74   /// Add line
75   SKETCHAPI_EXPORT
76   std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
77   /// Add line
78   SKETCHAPI_EXPORT
79   std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
80
81   // TODO(spo): addCircle
82   // TODO(spo): addArc
83
84   // TODO(spo): set* (constraints)
85
86   // TODO(spo): setValue
87   // TODO(spo): setText
88
89 protected:
90   std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
91
92 };
93
94 //! Pointer on Sketch object
95 typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
96
97 /**\ingroup CPPHighAPI
98  * \brief Create Sketch feature
99  */
100 SKETCHAPI_EXPORT
101 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
102                     const std::shared_ptr<GeomAPI_Ax3> & thePlane);
103
104 /**\ingroup CPPHighAPI
105  * \brief Create Sketch feature
106  */
107 SKETCHAPI_EXPORT
108 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
109                     const ModelHighAPI_Selection & theExternal);
110
111 //--------------------------------------------------------------------------------------
112 //--------------------------------------------------------------------------------------
113 #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */