Salome HOME
e6dc4ba55f8411abc90c2c3f5d8771376f236615
[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
13 #include <TDF_Label.hxx>
14
15 class ModelAPI_ExpressionDouble;
16
17 /**\class GeomData_Point
18  * \ingroup DataModel
19  * \brief Attribute that contains 3D point.
20  */
21 class GeomData_Point : public GeomDataAPI_Point
22 {
23   enum { NUM_COMPONENTS = 3 };
24   /// Expressions for X, Y and Z 
25   std::shared_ptr<ModelAPI_ExpressionDouble> myExpression[NUM_COMPONENTS]; 
26  public:
27   /// Defines the double value
28   GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
29   /// Defines the point
30   GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
31
32   /// Returns the X double value
33   GEOMDATA_EXPORT virtual double x() const;
34   /// Returns the Y double value
35   GEOMDATA_EXPORT virtual double y() const;
36   /// Returns the Z double value
37   GEOMDATA_EXPORT virtual double z() const;
38   /// Returns the 3D point
39   GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
40
41   /// Defines the calculated double value
42   GEOMDATA_EXPORT virtual 
43     void setCalculatedValue(const double theX, const double theY, const double theZ);
44
45   /// Defines the text values
46   GEOMDATA_EXPORT virtual void setText(const std::string& theX,
47                                        const std::string& theY,
48                                        const std::string& theZ);
49
50   /// Returns the X text value
51   GEOMDATA_EXPORT virtual std::string textX();
52   /// Returns the Y text value
53   GEOMDATA_EXPORT virtual std::string textY();
54   /// Returns the Z text value
55   GEOMDATA_EXPORT virtual std::string textZ();
56
57   /// Allows to set expression (text) as invalid (by the parameters listener)
58   GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
59
60   /// Returns true if text is invalid
61   GEOMDATA_EXPORT virtual bool expressionInvalid(int);
62
63   /// Allows to set expression (text) error (by the parameters listener)
64   GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, const std::string& theError);
65
66   /// Returns an expression error
67   GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
68
69   /// Defines the used parameters
70   GEOMDATA_EXPORT virtual void setUsedParameters(int theComponent, 
71     const std::set<std::string>& theUsedParameters);
72
73   /// Returns the used parameters
74   GEOMDATA_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const;
75
76  protected:
77   /// Initializes attributes
78   GEOMDATA_EXPORT GeomData_Point();
79   /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
80   virtual void reinit();
81
82   friend class Model_Data;
83 };
84
85 #endif