1 // Copyright (C) 2014-2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GeomData_Point_H_
21 #define GeomData_Point_H_
24 #include "GeomDataAPI_Point.h"
26 #include <TDF_Label.hxx>
28 class ModelAPI_ExpressionDouble;
30 /**\class GeomData_Point
32 * \brief Attribute that contains 3D point.
34 class GeomData_Point : public GeomDataAPI_Point
36 enum { NUM_COMPONENTS = 3 };
37 /// Expressions for X, Y and Z
38 std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS];
40 /// Defines the double value
41 GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
43 GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
45 /// Returns the X double value
46 GEOMDATA_EXPORT virtual double x() const;
47 /// Returns the Y double value
48 GEOMDATA_EXPORT virtual double y() const;
49 /// Returns the Z double value
50 GEOMDATA_EXPORT virtual double z() const;
51 /// Defines the X coordinate value
52 GEOMDATA_EXPORT void setX(const double theX);
53 /// Defines the Y coordinate value
54 GEOMDATA_EXPORT void setY(const double theY);
55 /// Defines the Z coordinate value
56 GEOMDATA_EXPORT void setZ(const double theZ);
58 /// Returns the 3D point
59 GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
61 /// Defines the calculated double value
62 GEOMDATA_EXPORT virtual
63 void setCalculatedValue(const double theX, const double theY, const double theZ);
65 /// Defines the text values
66 GEOMDATA_EXPORT virtual void setText(const std::wstring& theX,
67 const std::wstring& theY,
68 const std::wstring& theZ);
69 /// Defines the X text value
70 GEOMDATA_EXPORT virtual void setTextX(const std::wstring& theX);
71 /// Defines the Y text value
72 GEOMDATA_EXPORT virtual void setTextY(const std::wstring& theY);
73 /// Defines the Z text value
74 GEOMDATA_EXPORT virtual void setTextZ(const std::wstring& theZ);
76 /// Returns the X text value
77 GEOMDATA_EXPORT virtual std::wstring textX();
78 /// Returns the Y text value
79 GEOMDATA_EXPORT virtual std::wstring textY();
80 /// Returns the Z text value
81 GEOMDATA_EXPORT virtual std::wstring textZ();
83 /// Allows to set expression (text) as invalid (by the parameters listener)
84 GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
86 /// Returns true if text is invalid
87 GEOMDATA_EXPORT virtual bool expressionInvalid(int);
89 /// Allows to set expression (text) error (by the parameters listener)
90 GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError);
92 /// Returns an expression error
93 GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
95 /// Defines the used parameters
96 GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
97 const std::set<std::wstring>& theUsedParameters);
99 /// Returns the used parameters
100 GEOMDATA_EXPORT virtual std::set<std::wstring> usedParameters(int theComponent) const;
103 /// Initializes attributes
104 GEOMDATA_EXPORT GeomData_Point();
105 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
106 virtual void reinit();
108 friend class Model_Data;