Salome HOME
Create text representation of components X, Y, Z for Point & Point2D
[modules/shaper.git] / src / GeomData / GeomData_Point.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomData_Point.h
4 // Created:     24 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomData_Point_H_
8 #define GeomData_Point_H_
9
10 #include "GeomData.h"
11 #include "GeomDataAPI_Point.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_Point
18  * \ingroup DataModel
19  * \brief Attribute that contains 3D point.
20  */
21
22 class GeomData_Point : public GeomDataAPI_Point
23 {
24   Handle_TDataStd_RealArray myCoords;  ///< X, Y and Z doubles as real array attribute [0; 2]
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, const double theZ);
30   /// Defines the point
31   GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& 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 Z double value
38   GEOMDATA_EXPORT virtual double z() const;
39   /// Returns the 3D point
40   GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
41
42   /// Defines the text values
43   GEOMDATA_EXPORT virtual void setText(const std::string& theX,
44                                        const std::string& theY,
45                                        const std::string& theZ);
46
47   /// Returns the X text value
48   GEOMDATA_EXPORT virtual std::string textX();
49   /// Returns the Y text value
50   GEOMDATA_EXPORT virtual std::string textY();
51   /// Returns the Z text value
52   GEOMDATA_EXPORT virtual std::string textZ();
53
54   /// Allows to set expression (text) as invalid (by the parameters listener)
55   GEOMDATA_EXPORT virtual void setExpressionInvalid(int, bool theFlag);
56
57   /// Returns true if text is invalid
58   GEOMDATA_EXPORT virtual bool expressionInvalid(int);
59
60  protected:
61   /// Initializes attributes
62   GEOMDATA_EXPORT GeomData_Point(TDF_Label& theLabel);
63
64   friend class Model_Data;
65 };
66
67 #endif