]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionAPI/ConstructionAPI_Point.h
Salome HOME
2.3.2 Point creation: 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_14(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
97
98   /// Set point values.
99   CONSTRUCTIONAPI_EXPORT
100   void setByXYZ(const ModelHighAPI_Double & theX,
101                 const ModelHighAPI_Double & theY,
102                 const ModelHighAPI_Double & theZ);
103
104   /// Set edge and distance on it for point.
105   CONSTRUCTIONAPI_EXPORT
106   void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
107                          const ModelHighAPI_Double& theOffset,
108                          const bool theUseRatio = false,
109                          const bool theReverse = false);
110
111   /*
112   /// Set point and plane for projection.
113   CONSTRUCTIONAPI_EXPORT
114   void setByProjection(const ModelHighAPI_Selection& theVertex,
115                        const ModelHighAPI_Selection& theFace);
116
117   /// Set lines for intersections.
118   CONSTRUCTIONAPI_EXPORT
119   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
120                               const ModelHighAPI_Selection& theEdge2);
121   */
122   /// Set line and plane for intersections.
123   CONSTRUCTIONAPI_EXPORT
124   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
125                                      const ModelHighAPI_Selection& theFace);
126
127   /// Dump wrapped feature
128   CONSTRUCTIONAPI_EXPORT
129   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
130 };
131
132 /// Pointer on Point object.
133 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
134
135 /// \ingroup CPPHighAPI
136 /// \brief Create Point feature
137 CONSTRUCTIONAPI_EXPORT
138 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
139                   const ModelHighAPI_Double & theX,
140                   const ModelHighAPI_Double & theY,
141                   const ModelHighAPI_Double & theZ);
142
143 /// \ingroup CPPHighAPI
144 /// \brief Create Point feature
145 CONSTRUCTIONAPI_EXPORT
146 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
147                   const ModelHighAPI_Selection& theEdge,
148                   const ModelHighAPI_Double& theOffset,
149                   const bool theUseRatio = false,
150                   const bool theReverse = false);
151
152 /// \ingroup CPPHighAPI
153 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
154 CONSTRUCTIONAPI_EXPORT
155 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
156                   const ModelHighAPI_Selection& theObject1,
157                   const ModelHighAPI_Selection& theObject2);
158
159 /// \ingroup CPPHighAPI
160 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
161 /// with positive distance from the plane and flag to reverse the offset direction.
162 CONSTRUCTIONAPI_EXPORT
163 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
164                   const ModelHighAPI_Selection& theObject1,
165                   const ModelHighAPI_Selection& theObject2,
166                   const ModelHighAPI_Double& theDistanceValue,
167                   const bool theReverse = false);
168
169 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */