Salome HOME
8a24f54a15751c4b101eec365b54743e08fe7ae3
[modules/shaper.git] / src / GeomDataAPI / GeomDataAPI_Point.h
1 // Copyright (C) 2014-2023  CEA, EDF
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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GeomDataAPI_Point_H_
21 #define GeomDataAPI_Point_H_
22
23 #include "GeomDataAPI.h"
24 #include <ModelAPI_Attribute.h>
25
26 #include <set>
27
28 class GeomAPI_Pnt;
29
30 /**\class GeomDataAPI_Point
31  * \ingroup DataModel
32  * \brief Attribute that contains 3D point coordinates. 
33  */
34
35 class GeomDataAPI_Point : public ModelAPI_Attribute
36 {
37  public:
38   /// Defines the double value
39   GEOMDATAAPI_EXPORT virtual
40     void setValue(const double theX, const double theY, const double theZ) = 0;
41   /// Defines the point
42   GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint) = 0;
43
44   /// Returns the X double value
45   GEOMDATAAPI_EXPORT virtual double x() const = 0;
46   /// Returns the Y double value
47   GEOMDATAAPI_EXPORT virtual double y() const = 0;
48   /// Returns the Z double value
49   GEOMDATAAPI_EXPORT virtual double z() const = 0;
50   /// Returns the 3D point
51   GEOMDATAAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt() = 0;
52
53   /// Defines the calculated double value
54   GEOMDATAAPI_EXPORT virtual
55     void setCalculatedValue(const double theX, const double theY, const double theZ) = 0;
56
57   /// Defines the X coordinate value
58   GEOMDATAAPI_EXPORT virtual void setX(const double theX) = 0;
59   /// Defines the Y coordinate value
60   GEOMDATAAPI_EXPORT virtual void setY(const double theY) = 0;
61   /// Defines the Z coordinate value
62   GEOMDATAAPI_EXPORT virtual void setZ(const double theZ) = 0;
63
64   /// Defines the text values
65   GEOMDATAAPI_EXPORT virtual void setText(const std::wstring& theX,
66                                           const std::wstring& theY,
67                                           const std::wstring& theZ) = 0;
68
69   /// Defines the X text value
70   GEOMDATAAPI_EXPORT virtual void setTextX(const std::wstring& theX) = 0;
71   /// Defines the Y text value
72   GEOMDATAAPI_EXPORT virtual void setTextY(const std::wstring& theY) = 0;
73   /// Defines the Z text value
74   GEOMDATAAPI_EXPORT virtual void setTextZ(const std::wstring& theZ) = 0;
75
76   /// Returns the text value for X
77   GEOMDATAAPI_EXPORT virtual std::wstring textX() = 0;
78   /// Returns the text value for Y
79   GEOMDATAAPI_EXPORT virtual std::wstring textY() = 0;
80   /// Returns the text value for Z
81   GEOMDATAAPI_EXPORT virtual std::wstring textZ() = 0;
82
83   /// Point component (x,y,z)
84   enum PointComponent { C_X = 0,
85                         C_Y = 1,
86                         C_Z = 2,
87   };
88
89   /// Allows to set expression (text) as invalid (by the parameters listener)
90   GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, const bool theFlag) = 0;
91
92   /// Returns true if text is invalid
93   GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0;
94
95   /// Allows to set expression (text) error (by the parameters listener)
96   GEOMDATAAPI_EXPORT virtual
97     void setExpressionError(int theComponent, const std::string& theError) = 0;
98
99   /// Returns an expression error
100   GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0;
101
102   /// Defines the used parameters
103   GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
104     const std::set<std::wstring>& theUsedParameters) = 0;
105
106   /// Returns the used parameters
107   GEOMDATAAPI_EXPORT virtual std::set<std::wstring> usedParameters(int theComponent) const = 0;
108
109   /// Returns the type of this class of attributes
110   static std::string typeId()
111   {
112     return std::string("Point");
113   }
114
115   /// Returns the type of this class of attributes, not static method
116   GEOMDATAAPI_EXPORT virtual std::string attributeType();
117
118  protected:
119   /// Objects are created for features automatically
120   GEOMDATAAPI_EXPORT GeomDataAPI_Point();
121   GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point();
122 };
123
124 //! Pointer on attribute object
125 typedef std::shared_ptr<GeomDataAPI_Point> AttributePointPtr;
126
127 #endif