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