1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomData_Point2D.h
4 // Created: 24 Apr 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef GeomData_Point2D_H_
8 #define GeomData_Point2D_H_
11 #include "GeomDataAPI_Point2D.h"
13 #include <TDF_Label.hxx>
15 class ModelAPI_ExpressionDouble;
17 /**\class GeomData_Point2D
19 * \brief Attribute that contains 2D point.
22 class GeomData_Point2D : public GeomDataAPI_Point2D
24 enum { NUM_COMPONENTS = 2 };
25 std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS]; ///< Expressions for X, Y
27 /// Defines the double value
28 GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY);
30 GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
32 /// Returns the X double value
33 GEOMDATA_EXPORT virtual double x() const;
34 /// Returns the Y double value
35 GEOMDATA_EXPORT virtual double y() const;
36 /// Returns the 2D point
37 GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt();
39 /// Defines the calculated double value
40 GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX, const double theY);
42 /// Defines the text values
43 GEOMDATA_EXPORT virtual void setText(const std::string& theX,
44 const std::string& theY);
46 /// Returns the text values
47 GEOMDATA_EXPORT virtual std::string textX();
48 GEOMDATA_EXPORT virtual std::string textY();
50 /// Allows to set expression (text) as invalid (by the parameters listener)
51 GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
53 /// Returns true if text is invalid
54 GEOMDATA_EXPORT virtual bool expressionInvalid(int);
56 /// Allows to set expression (text) error (by the parameters listener)
57 GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError);
59 /// Returns an expression error
60 GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
62 /// Defines the used parameters
63 GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent,
64 const std::set<std::string>& theUsedParameters);
66 /// Returns the used parameters
67 GEOMDATA_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const;
70 /// Initializes attributes
71 GEOMDATA_EXPORT GeomData_Point2D(TDF_Label& theLabel);
73 friend class Model_Data;