fw4spl
src/fwMedData/NavigationSeries.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
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 #include "fwMedData/NavigationSeries.hpp"
8 
9 #include <fwData/Exception.hpp>
10 #include <fwData/registry/macros.hpp>
11 
12 fwDataRegisterMacro( ::fwMedData::NavigationSeries );
13 
14 namespace fwMedData
15 {
16 
18  Series(key)
19 {
20 }
21 
22 //------------------------------------------------------------------------------
23 
25 {
26 }
27 
28 //------------------------------------------------------------------------------
29 
30 void NavigationSeries::shallowCopy(const ::fwData::Object::csptr& _source)
31 {
32  NavigationSeries::csptr other = NavigationSeries::dynamicConstCast(_source);
33  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
34  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
35  + " to " + this->getClassname()), !bool(other) );
36 
37  this->::fwMedData::Series::shallowCopy(_source);
38 
39  m_position = other->m_position;
40  m_move = other->m_move;
41  m_lookAt = other->m_lookAt;
42 }
43 
44 //------------------------------------------------------------------------------
45 
46 void NavigationSeries::cachedDeepCopy(const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache)
47 {
48  NavigationSeries::csptr other = NavigationSeries::dynamicConstCast(_source);
49  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
50  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
51  + " to " + this->getClassname()), !bool(other) );
52 
53  this->::fwMedData::Series::cachedDeepCopy(_source, cache);
54 
55  m_position = other->m_position;
56  m_move = other->m_move;
57  m_lookAt = other->m_lookAt;
58 }
59 
60 //------------------------------------------------------------------------------
61 
62 void NavigationSeries::addPosition(TimestampType time, const CoordinateType& pos)
63 {
64  m_position[time] = pos;
65 }
66 
67 //------------------------------------------------------------------------------
68 
69 void NavigationSeries::addMove(TimestampType time, const CoordinateType& dir)
70 {
71  m_move[time] = dir;
72 }
73 
74 //------------------------------------------------------------------------------
75 
76 void NavigationSeries::addLookAt(TimestampType time, const CoordinateType& point)
77 {
78  m_lookAt[time] = point;
79 }
80 
81 //------------------------------------------------------------------------------
82 
83 void NavigationSeries::erasePosition(TimestampType time)
84 {
85  m_position.erase(time);
86 }
87 
88 //------------------------------------------------------------------------------
89 
90 void NavigationSeries::eraseMove(TimestampType time)
91 {
92  m_move.erase(time);
93 }
94 
95 //------------------------------------------------------------------------------
96 
97 void NavigationSeries::eraseLookAt(TimestampType time)
98 {
99  m_lookAt.erase(time);
100 }
101 
102 //------------------------------------------------------------------------------
103 
105 {
106  m_position.clear();
107 }
108 
109 //------------------------------------------------------------------------------
110 
112 {
113  m_move.clear();
114 }
115 
116 //------------------------------------------------------------------------------
117 
119 {
120  m_lookAt.clear();
121 }
122 
123 //------------------------------------------------------------------------------
124 
125 const NavigationSeries::ContainerType& NavigationSeries::getPositionMap() const
126 {
127  return m_position;
128 }
129 
130 //------------------------------------------------------------------------------
131 
132 const NavigationSeries::ContainerType& NavigationSeries::getMoveMap() const
133 {
134  return m_move;
135 }
136 
137 //------------------------------------------------------------------------------
138 
139 const NavigationSeries::ContainerType& NavigationSeries::getLookAtMap() const
140 {
141  return m_lookAt;
142 }
143 
144 } // namespace fwMedData
145 
FWMEDDATA_API void erasePosition(TimestampType time)
Removes the position (if one exists) associate with the specified timestamp.
FWMEDDATA_API void addMove(TimestampType time, const CoordinateType &dir)
Adds a move direction associate with the specified timestamp.
FWMEDDATA_API const ContainerType & getPositionMap() const
Returns positions map container.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
virtual FWMEDDATA_API ~NavigationSeries()
Destructor.
FWMEDDATA_API void addLookAt(TimestampType time, const CoordinateType &point)
Adds a lookAt point associate with the specified timestamp.
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
Namespace containing medical data.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
FWMEDDATA_API NavigationSeries(::fwData::Object::Key key)
Constructor.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
FWMEDDATA_API void clearMove()
Clear all move directions.
FWMEDDATA_API void addPosition(TimestampType time, const CoordinateType &pos)
Adds a position associate with the specified timestamp.
Holds navigation information.
FWMEDDATA_API void clearLookAt()
Clear all lookAt points.
FWMEDDATA_API const ContainerType & getMoveMap() const
Returns move map container.
FWMEDDATA_API void eraseLookAt(TimestampType time)
Removes the lookAt point (if one exists) associate with the specified timestamp.
FWMEDDATA_API void clearPosition()
Clear all positions.
FWMEDDATA_API const ContainerType & getLookAtMap() const
Returns lokAt map container.
FWMEDDATA_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
FWMEDDATA_API void eraseMove(TimestampType time)
Removes the move direction (if one exists) associate with the specified timestamp.