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