]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionAPI/ConstructionAPI_Point.h
Salome HOME
2.3.3.1 Point creation by projection of another point on a line
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Point.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
22 #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
23
24 #include "ConstructionAPI.h"
25
26 #include <ConstructionPlugin_Point.h>
27
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30
31 class ModelAPI_AttributeDouble;
32 class ModelAPI_Document;
33 class ModelHighAPI_Double;
34
35 /// \class ConstructionAPI_Point
36 /// \ingroup CPPHighAPI
37 /// \brief Interface for Point feature.
38 class ConstructionAPI_Point: public ModelHighAPI_Interface
39 {
40 public:
41   /// Constructor without values.
42   CONSTRUCTIONAPI_EXPORT
43   explicit ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature);
44
45   /// Constructor with values.
46   CONSTRUCTIONAPI_EXPORT
47   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
48                         const ModelHighAPI_Double& theX,
49                         const ModelHighAPI_Double& theY,
50                         const ModelHighAPI_Double& theZ);
51
52   /// Constructor with values.
53   CONSTRUCTIONAPI_EXPORT
54   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55                         const ModelHighAPI_Selection& theEdge,
56                         const ModelHighAPI_Double& theOffset,
57                         const bool theUseRatio = false,
58                         const bool theReverse = false);
59
60   /// Constructor with values: intersected objects.
61   CONSTRUCTIONAPI_EXPORT
62   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63                         const ModelHighAPI_Selection& theObject1,
64                         const ModelHighAPI_Selection& theObject2);
65
66   /// Destructor.
67   CONSTRUCTIONAPI_EXPORT
68   virtual ~ConstructionAPI_Point();
69
70   INTERFACE_18(ConstructionPlugin_Point::ID(),
71                x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
72                y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
73                z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
74                creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
75                ModelAPI_AttributeString, /** Creation method */,
76                intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
77                ModelAPI_AttributeSelection, /** Line for intersection */,
78                intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
79                ModelAPI_AttributeSelection, /** Plane for intersection */,
80                useOffset, ConstructionPlugin_Point::USE_OFFSET(),
81                ModelAPI_AttributeString, /** Use offset */,
82                offset, ConstructionPlugin_Point::OFFSET(),
83                ModelAPI_AttributeDouble, /** Offset */,
84                reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
85                ModelAPI_AttributeBoolean, /** Reverse offset */,
86                edge, ConstructionPlugin_Point::EDGE(),
87                ModelAPI_AttributeSelection, /** Edge */,
88                offsetType, ConstructionPlugin_Point::OFFSET_TYPE(),
89                ModelAPI_AttributeString, /** Type of the offset on edge */,
90                distance, ConstructionPlugin_Point::DISTANCE(),
91                ModelAPI_AttributeDouble, /** Distance */,
92                ratio, ConstructionPlugin_Point::RATIO(),
93                ModelAPI_AttributeDouble, /** Ratio */,
94                reverse, ConstructionPlugin_Point::REVERSE(),
95                ModelAPI_AttributeBoolean, /** Reverse */,
96                poinToProjectOnFace, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_FACE(),
97                ModelAPI_AttributeSelection, /** Point to project on face */,
98                faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(),
99                ModelAPI_AttributeSelection, /** Face for point projection */,
100                poinToProjectOnEdge, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_EDGE(),
101                ModelAPI_AttributeSelection, /** Point to project on edge */,
102                edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(),
103                ModelAPI_AttributeSelection, /** Edge for point projection */)
104
105
106   /// Set point values.
107   CONSTRUCTIONAPI_EXPORT
108   void setByXYZ(const ModelHighAPI_Double & theX,
109                 const ModelHighAPI_Double & theY,
110                 const ModelHighAPI_Double & theZ);
111
112   /// Set edge and distance on it for point.
113   CONSTRUCTIONAPI_EXPORT
114   void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
115                          const ModelHighAPI_Double& theOffset,
116                          const bool theUseRatio = false,
117                          const bool theReverse = false);
118
119   /// Set point and edge for projection.
120   CONSTRUCTIONAPI_EXPORT
121   void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
122                              const ModelHighAPI_Selection& theEdge);
123
124   /// Set point and face for projection.
125   CONSTRUCTIONAPI_EXPORT
126   void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
127                              const ModelHighAPI_Selection& theFace);
128
129   /*
130   /// Set lines for intersections.
131   CONSTRUCTIONAPI_EXPORT
132   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
133                               const ModelHighAPI_Selection& theEdge2);
134   */
135
136   /// Set line and plane for intersections.
137   CONSTRUCTIONAPI_EXPORT
138   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
139                                      const ModelHighAPI_Selection& theFace);
140
141   /// Dump wrapped feature
142   CONSTRUCTIONAPI_EXPORT
143   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
144 };
145
146 /// Pointer on Point object.
147 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
148
149 /// \ingroup CPPHighAPI
150 /// \brief Create Point feature
151 CONSTRUCTIONAPI_EXPORT
152 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
153                   const ModelHighAPI_Double & theX,
154                   const ModelHighAPI_Double & theY,
155                   const ModelHighAPI_Double & theZ);
156
157 /// \ingroup CPPHighAPI
158 /// \brief Create Point feature
159 CONSTRUCTIONAPI_EXPORT
160 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
161                   const ModelHighAPI_Selection& theEdge,
162                   const ModelHighAPI_Double& theOffset,
163                   const bool theUseRatio = false,
164                   const bool theReverse = false);
165
166 /// \ingroup CPPHighAPI
167 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
168 CONSTRUCTIONAPI_EXPORT
169 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
170                   const ModelHighAPI_Selection& theObject1,
171                   const ModelHighAPI_Selection& theObject2);
172
173 /// \ingroup CPPHighAPI
174 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
175 /// with positive distance from the plane and flag to reverse the offset direction.
176 CONSTRUCTIONAPI_EXPORT
177 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
178                   const ModelHighAPI_Selection& theObject1,
179                   const ModelHighAPI_Selection& theObject2,
180                   const ModelHighAPI_Double& theDistanceValue,
181                   const bool theReverse = false);
182
183 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */