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