1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef GeomData_Point_H_
22 #define GeomData_Point_H_
25 #include "GeomDataAPI_Point.h"
27 #include <TDF_Label.hxx>
29 class ModelAPI_ExpressionDouble;
31 /**\class GeomData_Point
33 * \brief Attribute that contains 3D point.
35 class GeomData_Point : public GeomDataAPI_Point
37 enum { NUM_COMPONENTS = 3 };
38 /// Expressions for X, Y and Z
39 std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS];
41 /// Defines the double value
42 GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
44 GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
46 /// Returns the X double value
47 GEOMDATA_EXPORT virtual double x() const;
48 /// Returns the Y double value
49 GEOMDATA_EXPORT virtual double y() const;
50 /// Returns the Z double value
51 GEOMDATA_EXPORT virtual double z() const;
52 /// Defines the X coordinate value
53 GEOMDATA_EXPORT void setX(const double theX);
54 /// Defines the Y coordinate value
55 GEOMDATA_EXPORT void setY(const double theY);
56 /// Defines the Z coordinate value
57 GEOMDATA_EXPORT void setZ(const double theZ);
59 /// Returns the 3D point
60 GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
62 /// Defines the calculated double value
63 GEOMDATA_EXPORT virtual
64 void setCalculatedValue(const double theX, const double theY, const double theZ);
66 /// Defines the text values
67 GEOMDATA_EXPORT virtual void setText(const std::string& theX,
68 const std::string& theY,
69 const std::string& theZ);
70 /// Defines the X text value
71 GEOMDATA_EXPORT virtual void setTextX(const std::string& theX);
72 /// Defines the Y text value
73 GEOMDATA_EXPORT virtual void setTextY(const std::string& theY);
74 /// Defines the Z text value
75 GEOMDATA_EXPORT virtual void setTextZ(const std::string& theZ);
77 /// Returns the X text value
78 GEOMDATA_EXPORT virtual std::string textX();
79 /// Returns the Y text value
80 GEOMDATA_EXPORT virtual std::string textY();
81 /// Returns the Z text value
82 GEOMDATA_EXPORT virtual std::string textZ();
84 /// Allows to set expression (text) as invalid (by the parameters listener)
85 GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
87 /// Returns true if text is invalid
88 GEOMDATA_EXPORT virtual bool expressionInvalid(int);
90 /// Allows to set expression (text) error (by the parameters listener)
91 GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError);
93 /// Returns an expression error
94 GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
96 /// Defines the used parameters
97 GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
98 const std::set<std::string>& theUsedParameters);
100 /// Returns the used parameters
101 GEOMDATA_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const;
104 /// Initializes attributes
105 GEOMDATA_EXPORT GeomData_Point();
106 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
107 virtual void reinit();
109 friend class Model_Data;