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 email : webmaster.salome@opencascade.com<mailto: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 /// Returns the 3D point
52 GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
54 /// Defines the calculated double value
55 GEOMDATA_EXPORT virtual
56 void setCalculatedValue(const double theX, const double theY, const double theZ);
58 /// Defines the text values
59 GEOMDATA_EXPORT virtual void setText(const std::string& theX,
60 const std::string& theY,
61 const std::string& theZ);
63 /// Returns the X text value
64 GEOMDATA_EXPORT virtual std::string textX();
65 /// Returns the Y text value
66 GEOMDATA_EXPORT virtual std::string textY();
67 /// Returns the Z text value
68 GEOMDATA_EXPORT virtual std::string textZ();
70 /// Allows to set expression (text) as invalid (by the parameters listener)
71 GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
73 /// Returns true if text is invalid
74 GEOMDATA_EXPORT virtual bool expressionInvalid(int);
76 /// Allows to set expression (text) error (by the parameters listener)
77 GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError);
79 /// Returns an expression error
80 GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
82 /// Defines the used parameters
83 GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
84 const std::set<std::string>& theUsedParameters);
86 /// Returns the used parameters
87 GEOMDATA_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const;
90 /// Initializes attributes
91 GEOMDATA_EXPORT GeomData_Point();
92 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
93 virtual void reinit();
95 friend class Model_Data;