Salome HOME
Issue #273: Add copyright string
[modules/shaper.git] / src / GeomDataAPI / GeomDataAPI_Point2D.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomDataAPI_Point2D.h
4 // Created:     24 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomDataAPI_Point2D_H_
8 #define GeomDataAPI_Point2D_H_
9
10 #include "GeomDataAPI.h"
11 #include <ModelAPI_Attribute.h>
12
13 class GeomAPI_Pnt2d;
14
15 /**\class GeomDataAPI_Point2D
16  * \ingroup DataModel
17  * \brief Attribute that contains 2D point coordinates.
18  */
19
20 class GeomDataAPI_Point2D : public ModelAPI_Attribute
21 {
22  public:
23   /// Defines the double value
24   virtual void setValue(const double theX, const double theY) = 0;
25   /// Defines the point
26   virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
27
28   /// Returns the X double value
29   virtual double x() const = 0;
30   /// Returns the Y double value
31   virtual double y() const = 0;
32   /// Returns the 2D point
33   virtual std::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
34
35   /// Appends the delta values to point
36   void move(const double theDeltaX, const double theDeltaY)
37   {
38     setValue(x() + theDeltaX, y() + theDeltaY);
39   }
40
41
42   /// Returns the type of this class of attributes
43   static inline std::string type()
44   {
45     return std::string("Point2D");
46   }
47
48   /// Returns the type of this class of attributes, not static method
49   virtual std::string attributeType()
50   {
51     return type();
52   }
53
54  protected:
55   /// Objects are created for features automatically
56   GeomDataAPI_Point2D()
57   {
58   }
59 };
60
61 #endif