1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomDataAPI_Point2D.h
4 // Created: 24 Apr 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef GeomDataAPI_Point2D_H_
8 #define GeomDataAPI_Point2D_H_
10 #include <GeomDataAPI.h>
11 #include <ModelAPI_Attribute.h>
12 #include <ModelAPI_Data.h>
18 /**\class GeomDataAPI_Point2D
20 * \brief Attribute that contains 2D point coordinates.
23 class GeomDataAPI_Point2D : public ModelAPI_Attribute
26 /// Defines the double value
27 GEOMDATAAPI_EXPORT virtual void setValue(const double theX, const double theY) = 0;
29 GEOMDATAAPI_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
31 /// Returns the X double value
32 GEOMDATAAPI_EXPORT virtual double x() const = 0;
33 /// Returns the Y double value
34 GEOMDATAAPI_EXPORT virtual double y() const = 0;
35 /// Returns the 2D point
36 GEOMDATAAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
38 /// Defines the calculated double value
39 GEOMDATAAPI_EXPORT virtual void setCalculatedValue(const double theX, const double theY) = 0;
41 /// Defines the text values
42 GEOMDATAAPI_EXPORT virtual void setText(const std::string& theX,
43 const std::string& theY) = 0;
45 /// Returns the text value for X
46 GEOMDATAAPI_EXPORT virtual std::string textX() = 0;
47 /// Returns the text value for Y
48 GEOMDATAAPI_EXPORT virtual std::string textY() = 0;
50 /// Point component (x,y)
51 enum PointComponent { C_X = 0,
55 /// Allows to set expression (text) as invalid (by the parameters listener)
56 GEOMDATAAPI_EXPORT virtual void setExpressionInvalid(int theComponent, const bool theFlag) = 0;
58 /// Returns true if text is invalid
59 GEOMDATAAPI_EXPORT virtual bool expressionInvalid(int theComponent) = 0;
61 /// Allows to set expression (text) error (by the parameters listener)
62 GEOMDATAAPI_EXPORT virtual
63 void setExpressionError(int theComponent, const std::string& theError) = 0;
65 /// Returns an expression error
66 GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0;
68 /// Defines the used parameters
69 GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
70 const std::set<std::string>& theUsedParameters) = 0;
72 /// Returns the used parameters
73 GEOMDATAAPI_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const = 0;
75 /// Appends the delta values to point
76 GEOMDATAAPI_EXPORT void move(const double theDeltaX, const double theDeltaY);
78 /// Returns the type of this class of attributes
79 static std::string typeId()
81 return std::string("Point2D");
84 /// Returns the type of this class of attributes, not static method
85 GEOMDATAAPI_EXPORT virtual std::string attributeType();
87 /// Returns this attribute from the data if it is possible
88 /// \param theData a model data
89 /// \param theAttribute an attribute index
90 static GEOMDATAAPI_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPoint2D(const DataPtr& theData,
91 const std::string& theAttribute);
94 /// Objects are created for features automatically
95 GEOMDATAAPI_EXPORT GeomDataAPI_Point2D();
96 GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2D();
99 //! Pointer on attribute object
100 typedef std::shared_ptr<GeomDataAPI_Point2D> AttributePoint2DPtr;