Salome HOME
Introduce ModelAPI_Expression.
[modules/shaper.git] / src / GeomDataAPI / GeomDataAPI_Point2D.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomDataAPI_Point2D.h
4 // Created:     24 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomDataAPI_Point2D_H_
8 #define GeomDataAPI_Point2D_H_
9
10 #include <GeomDataAPI.h>
11 #include <ModelAPI_Attribute.h>
12
13 #include <set>
14
15 class GeomAPI_Pnt2d;
16
17 /**\class GeomDataAPI_Point2D
18  * \ingroup DataModel
19  * \brief Attribute that contains 2D point coordinates.
20  */
21
22 class GeomDataAPI_Point2D : public ModelAPI_Attribute
23 {
24  public:
25   /// Defines the double value
26   GEOMDATAAPI_EXPORT virtual void setValue(const double theX, const double theY) = 0;
27   /// Defines the point
28   GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
29
30   /// Returns the X double value
31   GEOMDATAAPI_EXPORT virtual double x() const = 0;
32   /// Returns the Y double value
33   GEOMDATAAPI_EXPORT virtual double y() const = 0;
34   /// Returns the 2D point
35   GEOMDATAAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
36
37   /// Defines the calculated double value
38   GEOMDATAAPI_EXPORT virtual void setCalculatedValue(const double theX, const double theY) = 0;
39
40   /// Defines the text values
41   GEOMDATAAPI_EXPORT virtual void setText(const std::string& theX,
42                                           const std::string& theY) = 0;
43
44   /// Returns the text values
45   GEOMDATAAPI_EXPORT virtual std::string textX() = 0;
46   GEOMDATAAPI_EXPORT virtual std::string textY() = 0;
47
48   enum PointComponent { C_X = 0,
49                         C_Y = 1,
50   };
51
52   /// Allows to set expression (text) as invalid (by the parameters listener)
53   GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, const bool theFlag) = 0;
54
55   /// Returns true if text is invalid
56   GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0;
57
58   /// Allows to set expression (text) error (by the parameters listener)
59   GEOMDATAAPI_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError) = 0;
60
61   /// Returns an expression error
62   GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0;
63
64   /// Defines the used parameters
65   GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent, 
66     const std::set<std::string>& theUsedParameters) = 0;
67
68   /// Returns the used parameters
69   GEOMDATAAPI_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const = 0;
70
71   /// Appends the delta values to point
72   GEOMDATAAPI_EXPORT void move(const double theDeltaX, const double theDeltaY);
73
74   /// Returns the type of this class of attributes
75   static std::string typeId()
76   {
77     return std::string("Point2D");
78   }
79
80   /// Returns the type of this class of attributes, not static method
81   GEOMDATAAPI_EXPORT virtual std::string attributeType();
82
83  protected:
84   /// Objects are created for features automatically
85   GEOMDATAAPI_EXPORT GeomDataAPI_Point2D();
86   GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2D();
87 };
88
89 //! Pointer on attribute object
90 typedef std::shared_ptr<GeomDataAPI_Point2D> AttributePoint2DPtr;
91
92 #endif