Salome HOME
Issue #718 - Translation with parameters - wrong coordinates
[modules/shaper.git] / src / GeomData / GeomData_Point2D.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomData_Point2D.h
4 // Created:     24 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomData_Point2D_H_
8 #define GeomData_Point2D_H_
9
10 #include "GeomData.h"
11 #include "GeomDataAPI_Point2D.h"
12 #include <TDataStd_RealArray.hxx>
13 #include <TDataStd_ExtStringArray.hxx>
14 #include <TDataStd_BooleanArray.hxx>
15 #include <TDF_Label.hxx>
16
17 /**\class GeomData_Point2D
18  * \ingroup DataModel
19  * \brief Attribute that contains 2D point.
20  */
21
22 class GeomData_Point2D : public GeomDataAPI_Point2D
23 {
24   Handle_TDataStd_RealArray myCoords;  ///< X and Y doubles as real array attribute [0; 1]
25   Handle_TDataStd_ExtStringArray myTextArray;  ///< Text representation of the X, Y and Z attributes [0; 2]
26   Handle_TDataStd_BooleanArray myExpressionInvalidArray;  ///< Flag of invalid expression of the X, Y and Z attributes [0; 2]
27  public:
28   /// Defines the double value
29   GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY);
30   /// Defines the point
31   GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
32
33   /// Returns the X double value
34   GEOMDATA_EXPORT virtual double x() const;
35   /// Returns the Y double value
36   GEOMDATA_EXPORT virtual double y() const;
37   /// Returns the 2D point
38   GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt();
39
40   /// Defines the calculated double value
41   GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX, const double theY);
42
43   /// Defines the text values
44   GEOMDATA_EXPORT virtual void setText(const std::string& theX,
45                                        const std::string& theY);
46
47   /// Returns the text values
48   GEOMDATA_EXPORT virtual std::string textX();
49   GEOMDATA_EXPORT virtual std::string textY();
50
51   /// Allows to set expression (text) as invalid (by the parameters listener)
52   GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
53
54   /// Returns true if text is invalid
55   GEOMDATA_EXPORT virtual bool expressionInvalid(int);
56
57  protected:
58   /// Initializes attributes
59   GEOMDATA_EXPORT GeomData_Point2D(TDF_Label& theLabel);
60
61   friend class Model_Data;
62 };
63
64 #endif