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 void setExpressionError(int theComponent, const std::string& theError) = 0;
64 /// Returns an expression error
65 GEOMDATAAPI_EXPORT virtual std::string expressionError(int theComponent) = 0;
67 /// Defines the used parameters
68 GEOMDATAAPI_EXPORT virtual void setUsedParameters(int theComponent,
69 const std::set<std::string>& theUsedParameters) = 0;
71 /// Returns the used parameters
72 GEOMDATAAPI_EXPORT virtual std::set<std::string> usedParameters(int theComponent) const = 0;
74 /// Appends the delta values to point
75 GEOMDATAAPI_EXPORT void move(const double theDeltaX, const double theDeltaY);
77 /// Returns the type of this class of attributes
78 static std::string typeId()
80 return std::string("Point2D");
83 /// Returns the type of this class of attributes, not static method
84 GEOMDATAAPI_EXPORT virtual std::string attributeType();
86 /// Returns this attribute from the data if it is possible
87 /// \param theData a model data
88 /// \param theAttribute an attribute index
89 static GEOMDATAAPI_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPoint2D(const DataPtr& theData,
90 const std::string& theAttribute);
93 /// Objects are created for features automatically
94 GEOMDATAAPI_EXPORT GeomDataAPI_Point2D();
95 GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2D();
98 //! Pointer on attribute object
99 typedef std::shared_ptr<GeomDataAPI_Point2D> AttributePoint2DPtr;