fw4spl
Point.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwData/config.hpp"
10 #include "fwData/factory/new.hpp"
11 #include "fwData/Object.hpp"
12 
13 #include <array>
14 
15 fwCampAutoDeclareDataMacro((fwData)(Point), FWDATA_API);
16 
17 namespace fwData
18 {
22 class FWDATA_CLASS_API Point : public Object
23 {
24 
25 public:
26 
27  typedef double PointCoordType;
28  typedef std::array<double, 3> PointCoordArrayType;
29 
31  ((::fwData::factory::New< Point >, () ))
32  ((PointFactory, ((float))((float)(0.0f)) ((float) (0.0f)) ))
33  ((PointFactory, ((double))((double)(0.0)) ((double) (0.0)) ))
34  ((PointFactory, ((const PointCoordArrayType&)) ))
35  ((PointFactory, ((Point::sptr)) ))
36  );
37 
38  fwCampMakeFriendDataMacro((fwData)(Point));
39 
44  FWDATA_API Point(::fwData::Object::Key key);
45 
47  FWDATA_API virtual ~Point();
48 
50  FWDATA_API void shallowCopy( const Object::csptr& _source ) override;
51 
53  FWDATA_API void cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType& cache) override;
54 
57  PointCoordArrayType& getCoord ();
58  const PointCoordArrayType& getCoord() const;
59  void setCoord(const PointCoordArrayType& _vCoord);
61 
62 protected:
63 
65  FWDATA_API static Point::sptr PointFactory(float x, float y, float z);
66  FWDATA_API static Point::sptr PointFactory(double x, double y, double z);
67  FWDATA_API static Point::sptr PointFactory(const PointCoordArrayType& coord);
68  FWDATA_API static Point::sptr PointFactory(Point::sptr p);
69 
71  PointCoordArrayType m_vCoord;
72 
73 }; // end class Point
74 
75 //-----------------------------------------------------------------------------
76 
77 inline Point::PointCoordArrayType& Point::getCoord ()
78 {
79  return this->m_vCoord;
80 }
81 
82 //-----------------------------------------------------------------------------
83 
84 inline const Point::PointCoordArrayType& Point::getCoord() const
85 {
86  return this->m_vCoord;
87 }
88 
89 //-----------------------------------------------------------------------------
90 
91 inline void Point::setCoord(const PointCoordArrayType& _vCoord)
92 {
93  this->m_vCoord = _vCoord;
94 }
95 
96 //-----------------------------------------------------------------------------
97 
98 } // end namespace fwData
#define fwCoreClassDefinitionsWithNFactoriesMacro(_classinfo_, _factories_args_)
Generate common construction methods for classes with several factories.
This class define a 3D point.
Definition: Point.hpp:22
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
PointCoordArrayType & getCoord()
get/set point coordinates
Definition: Point.hpp:77
Base class for each data object.
Contains the representation of the data objects used in the framework.
void setCoord(const PointCoordArrayType &_vCoord)
get/set point coordinates
Definition: Point.hpp:91
PointCoordArrayType m_vCoord
point coordinates
Definition: Point.hpp:71