Salome HOME
Issue #718 - Translation with parameters - wrong coordinates
[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 class GeomAPI_Pnt2d;
14
15 /**\class GeomDataAPI_Point2D
16  * \ingroup DataModel
17  * \brief Attribute that contains 2D point coordinates.
18  */
19
20 class GeomDataAPI_Point2D : public ModelAPI_Attribute
21 {
22  public:
23   /// Defines the double value
24   GEOMDATAAPI_EXPORT virtual void setValue(const double theX, const double theY) = 0;
25   /// Defines the point
26   GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
27
28   /// Returns the X double value
29   GEOMDATAAPI_EXPORT virtual double x() const = 0;
30   /// Returns the Y double value
31   GEOMDATAAPI_EXPORT virtual double y() const = 0;
32   /// Returns the 2D point
33   GEOMDATAAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
34
35   /// Defines the calculated double value
36   GEOMDATAAPI_EXPORT virtual void setCalculatedValue(const double theX, const double theY) = 0;
37
38   /// Defines the text values
39   GEOMDATAAPI_EXPORT virtual void setText(const std::string& theX,
40                                           const std::string& theY) = 0;
41
42   /// Returns the text values
43   GEOMDATAAPI_EXPORT virtual std::string textX() = 0;
44   GEOMDATAAPI_EXPORT virtual std::string textY() = 0;
45
46   enum PointComponent { C_X = 0,
47                         C_Y = 1,
48   };
49
50   /// Allows to set expression (text) as invalid (by the parameters listener)
51   GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, const bool theFlag) = 0;
52
53   /// Returns true if text is invalid
54   GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0;
55
56   /// Appends the delta values to point
57   GEOMDATAAPI_EXPORT void move(const double theDeltaX, const double theDeltaY);
58
59   /// Returns the type of this class of attributes
60   static std::string typeId()
61   {
62     return std::string("Point2D");
63   }
64
65   /// Returns the type of this class of attributes, not static method
66   GEOMDATAAPI_EXPORT virtual std::string attributeType();
67
68  protected:
69   /// Objects are created for features automatically
70   GEOMDATAAPI_EXPORT GeomDataAPI_Point2D();
71   GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2D();
72 };
73
74 //! Pointer on attribute object
75 typedef std::shared_ptr<GeomDataAPI_Point2D> AttributePoint2DPtr;
76
77 #endif