fw4spl
Spline.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/Color.hpp"
10 #include "fwData/config.hpp"
11 #include "fwData/factory/new.hpp"
12 
13 #include <vector>
14 
15 namespace fwData
16 {
17 
22 class FWDATA_CLASS_API Spline : public Object
23 {
24 public:
25  fwCoreClassDefinitionsWithFactoryMacro( (Spline)(::fwData::Object), (()), ::fwData::factory::New< Spline >);
26 
31  class point
32  {
33  public:
34 
35  int id;
36  double p[3];
37  double normal[3];
38  ::fwData::Color::sptr c;
39  bool isVisible;
41  //------------------------------------------------------------------------------
42 
43  point& operator=( const point& _point )
44  {
45  this->id = _point.id;
46  this->p[0] = _point.p[0];
47  this->p[1] = _point.p[1];
48  this->p[2] = _point.p[2];
49  this->normal[0] = _point.normal[0];
50  this->normal[1] = _point.normal[1];
51  this->normal[2] = _point.normal[2];
52  this->isVisible = _point.isVisible;
53  c = ::fwData::Object::copy( _point.c );
54  return(*this);
55  }
56  };
57 
59  typedef std::vector< point > Points;
60 
65  FWDATA_API Spline(::fwData::Object::Key key);
66 
70  FWDATA_API virtual ~Spline();
71 
75  FWDATA_API Points& points();
76 
81  double& getRadius ();
82  const double& getRadius () const;
83  void setRadius(double _radius);
85 
90  int& getNbSides ();
91  int getNbSides () const;
92  void setNbSides (const int _nbSides);
94 
99  int& getIdSpline ();
100  int getIdSpline () const;
101  void setIdSpline (const int _idSpline);
103 
105  FWDATA_API void cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType& cache) override;
106 
107 protected:
108 
110  Points m_points;
111  double m_radius;
112  int m_nbSides;
113  int m_idSpline;
114 
115 };
116 
117 //-----------------------------------------------------------------------------
118 
119 inline double& Spline::getRadius ()
120 {
121  return m_radius;
122 }
123 
124 //-----------------------------------------------------------------------------
125 
126 inline const double& Spline::getRadius () const
127 {
128  return m_radius;
129 }
130 
131 //-----------------------------------------------------------------------------
132 
133 inline void Spline::setRadius(double _radius)
134 {
135  m_radius = _radius;
136 }
137 
138 //-----------------------------------------------------------------------------
139 
140 inline int& Spline::getNbSides ()
141 {
142  return this->m_nbSides;
143 }
144 
145 //-----------------------------------------------------------------------------
146 
147 inline int Spline::getNbSides () const
148 {
149  return m_nbSides;
150 }
151 
152 //-----------------------------------------------------------------------------
153 
154 inline void Spline::setNbSides (const int _nbSides)
155 {
156  m_nbSides = _nbSides;
157 }
158 
159 //-----------------------------------------------------------------------------
160 
161 inline int Spline::getIdSpline () const
162 {
163  return m_idSpline;
164 }
165 
166 //-----------------------------------------------------------------------------
167 
168 inline int& Spline::getIdSpline ()
169 {
170  return m_idSpline;
171 }
172 
173 //-----------------------------------------------------------------------------
174 
175 inline void Spline::setIdSpline (const int _idSpline)
176 {
177  m_idSpline = _idSpline;
178 }
179 
180 //-----------------------------------------------------------------------------
181 
182 } // namespace fwData
Points m_points
Points container.
Definition: Spline.hpp:110
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
int id
Identifier.
Definition: Spline.hpp:35
void setNbSides(const int _nbSides)
Get/Set value of the number of slices.
Definition: Spline.hpp:154
int & getNbSides()
Get/Set value of the number of slices.
Definition: Spline.hpp:140
bool isVisible
Flag if point is visible.
Definition: Spline.hpp:39
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
static FWDATA_API::fwData::Object::sptr copy(const ::fwData::Object::csptr &source)
return a copy of the source. if source is a null pointer, return a null pointer.
::fwData::Color::sptr c
Point color.
Definition: Spline.hpp:38
double & getRadius()
Get/Set value of the radius.
Definition: Spline.hpp:119
void setRadius(double _radius)
Get/Set value of the radius.
Definition: Spline.hpp:133
Base class for each data object.
std::vector< point > Points
3D point container
Definition: Spline.hpp:59
Contains the representation of the data objects used in the framework.
double normal[3]
Normal coordinates.
Definition: Spline.hpp:37
double p[3]
Point coordinates.
Definition: Spline.hpp:36
This class defines a spline object.
Definition: Spline.hpp:22
Defines a 3D point for a spline.
Definition: Spline.hpp:31
void setIdSpline(const int _idSpline)
Get/Set value of the spline identifier.
Definition: Spline.hpp:175
int & getIdSpline()
Get/Set value of the spline identifier.
Definition: Spline.hpp:168