Salome HOME
Added option to create Construction Point by intersection of line and plane.
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Point.h
1 // Name   : ConstructionAPI_Point.h
2 // Purpose: 
3 //
4 // History:
5 // 29/03/16 - Sergey POKHODENKO - Creation of the file
6
7 #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
8 #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
9
10 #include "ConstructionAPI.h"
11
12 #include <ConstructionPlugin_Point.h>
13
14 #include <ModelHighAPI_Interface.h>
15 #include <ModelHighAPI_Macro.h>
16
17 class ModelAPI_AttributeDouble;
18 class ModelAPI_Document;
19 class ModelHighAPI_Double;
20
21 /// \class ConstructionAPI_Point
22 /// \ingroup CPPHighAPI
23 /// \brief Interface for Point feature.
24 class ConstructionAPI_Point: public ModelHighAPI_Interface
25 {
26 public:
27   /// Constructor without values.
28   CONSTRUCTIONAPI_EXPORT
29   explicit ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature);
30
31   /// Constructor with values.
32   CONSTRUCTIONAPI_EXPORT
33   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
34                         const ModelHighAPI_Double& theX,
35                         const ModelHighAPI_Double& theY,
36                         const ModelHighAPI_Double& theZ);
37
38   /// Constructor with values.
39   CONSTRUCTIONAPI_EXPORT
40   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
41                         const ModelHighAPI_Selection& theEdge,
42                         const ModelHighAPI_Double& theDistanceValue,
43                         const bool theDistancePercent = false,
44                         const bool theReverse = false);
45
46   /// Constructor with values.
47   CONSTRUCTIONAPI_EXPORT
48   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
49                         const ModelHighAPI_Selection& theObject1,
50                         const ModelHighAPI_Selection& theObject2);
51
52   /// Destructor.
53   CONSTRUCTIONAPI_EXPORT
54   virtual ~ConstructionAPI_Point();
55
56   INTERFACE_14(ConstructionPlugin_Point::ID(),
57                creationMethod, ConstructionPlugin_Point::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
58                x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
59                y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
60                z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
61                edge, ConstructionPlugin_Point::EDGE(), ModelAPI_AttributeSelection, /** Edge attribute */,
62                distanceValue, ConstructionPlugin_Point::DISTANCE_VALUE(), ModelAPI_AttributeDouble, /** Distance value attribute */,
63                distancePercent, ConstructionPlugin_Point::DISTANCE_PERCENT(), ModelAPI_AttributeBoolean, /** Distance percent attribute */,
64                reverse, ConstructionPlugin_Point::REVERSE(), ModelAPI_AttributeBoolean, /** Reverse attribute */,
65                point, ConstructionPlugin_Point::POINT(), ModelAPI_AttributeSelection, /** Point attribute */,
66                plane, ConstructionPlugin_Point::PLANE(), ModelAPI_AttributeSelection, /** Plane attribute */,
67                firstLine, ConstructionPlugin_Point::FIRST_LINE(), ModelAPI_AttributeSelection, /** First line attribute */,
68                secondLine, ConstructionPlugin_Point::SECOND_LINE(), ModelAPI_AttributeSelection, /** Second line attribute */,
69                intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(), ModelAPI_AttributeSelection, /** Intersection line attribute */,
70                intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(), ModelAPI_AttributeSelection, /** Intersection plane attribute */
71   )
72
73   /// Set point values.
74   CONSTRUCTIONAPI_EXPORT
75   void setByXYZ(const ModelHighAPI_Double & theX,
76                 const ModelHighAPI_Double & theY,
77                 const ModelHighAPI_Double & theZ);
78
79   /// Set edge and distance on it for point.
80   CONSTRUCTIONAPI_EXPORT
81   void setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
82                            const ModelHighAPI_Double& theDistanceValue,
83                            const bool theDistancePercent = false,
84                            const bool theReverse = false);
85
86   /// Set point and plane for projection.
87   CONSTRUCTIONAPI_EXPORT
88   void setByProjection(const ModelHighAPI_Selection& theVertex,
89                        const ModelHighAPI_Selection& theFace);
90
91   /// Set lines for intersections.
92   CONSTRUCTIONAPI_EXPORT
93   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
94                               const ModelHighAPI_Selection& theEdge2);
95
96   /// Set line and plane for intersections.
97   CONSTRUCTIONAPI_EXPORT
98   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
99                                      const ModelHighAPI_Selection& theFace);
100 };
101
102 /// Pointer on Point object.
103 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
104
105 /// \ingroup CPPHighAPI
106 /// \brief Create Point feature
107 CONSTRUCTIONAPI_EXPORT
108 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
109                   const ModelHighAPI_Double & theX,
110                   const ModelHighAPI_Double & theY,
111                   const ModelHighAPI_Double & theZ);
112
113 /// \ingroup CPPHighAPI
114 /// \brief Create Point feature
115 CONSTRUCTIONAPI_EXPORT
116 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
117                   const ModelHighAPI_Selection& theEdge,
118                   const ModelHighAPI_Double& theDistanceValue,
119                   const bool theDistancePercent = false,
120                   const bool theReverse = false);
121
122 /// \ingroup CPPHighAPI
123 /// \brief Create Point feature
124 CONSTRUCTIONAPI_EXPORT
125 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
126                   const ModelHighAPI_Selection& theObject1,
127                   const ModelHighAPI_Selection& theObject2);
128
129 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */