fw4spl
src/fwData/Resection.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
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 
8 #include "fwData/registry/macros.hpp"
9 #include "fwData/Exception.hpp"
10 #include "fwData/Resection.hpp"
11 
12 #include <fwCom/Signal.hpp>
13 #include <fwCom/Signal.hxx>
14 
15 #include <fwCore/base.hpp>
16 
17 fwDataRegisterMacro( ::fwData::Resection );
18 
19 namespace fwData
20 {
21 
22 const ::fwCom::Signals::SignalKeyType Resection::s_RECONSTRUCTION_ADDED_SIG = "reconstructionAdded";
23 const ::fwCom::Signals::SignalKeyType Resection::s_VISIBILITY_MODIFIED_SIG = "pointTexCoordsModified";
24 
25 //------------------------------------------------------------------------------
26 
27 Resection::Resection (::fwData::Object::Key key) : m_isSafePart(true),
28  m_isValid(false),
29  m_isVisible(true)
30 {
31  m_planeList = ::fwData::PlaneList::New();
32  m_sigReconstructionAdded = ReconstructionAddedSignalType::New();
33  m_sigVisibilityModified = VisibilityModifiedSignalType::New();
34 
35  m_signals( s_RECONSTRUCTION_ADDED_SIG, m_sigReconstructionAdded)
36  ( s_VISIBILITY_MODIFIED_SIG, m_sigVisibilityModified);
37 }
38 
39 //------------------------------------------------------------------------------
40 
42 {
43 }
44 
45 //------------------------------------------------------------------------------
46 
47 void Resection::shallowCopy(const Object::csptr &_source )
48 {
49  Resection::csptr other = Resection::dynamicConstCast(_source);
50  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
51  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
52  + " to " + this->getClassname()), !bool(other) );
53  this->fieldShallowCopy( _source );
54 
55  m_name = other->m_name;
56  m_isSafePart = other->m_isSafePart;
57  m_isValid = other->m_isValid;
58  m_isVisible = other->m_isVisible;
59  m_planeList = other->m_planeList;
60  m_vInputs = other->m_vInputs;
61  m_vOutputs = other->m_vOutputs;
62 }
63 
64 //------------------------------------------------------------------------------
65 
66 void Resection::cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache)
67 {
68  Resection::csptr other = Resection::dynamicConstCast(_source);
69  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
70  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
71  + " to " + this->getClassname()), !bool(other) );
72  this->fieldDeepCopy( _source, cache );
73 
74  m_name = other->m_name;
75  m_isSafePart = other->m_isSafePart;
76  m_isValid = other->m_isValid;
77  m_isVisible = other->m_isVisible;
78  m_planeList = ::fwData::Object::copy(other->m_planeList, cache);
79 
80  this->m_vInputs.clear();
81  for(const ResectionInputs::value_type &resec : other->m_vInputs)
82  {
83  m_vInputs.push_back( ::fwData::Object::copy(resec, cache) );
84  }
85 
86  this->m_vOutputs.clear();
87  for(const ResectionOutputs::value_type &resec : other->m_vOutputs)
88  {
89  m_vOutputs.push_back( ::fwData::Object::copy(resec, cache) );
90  }
91 }
92 
93 //------------------------------------------------------------------------------
94 
95 } // namespace fwData
96 
97 
bool m_isSafePart
flag if the part is safe
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
This class defines a resection.
virtual FWDATA_API ~Resection()
Destructor.
ResectionOutputs m_vOutputs
Outputs (reconstructions)
FWDATA_API Resection(::fwData::Object::Key key)
Constructor.
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
ResectionInputs m_vInputs
Inputs (reconstructions)
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.
std::string m_name
Resection name.
bool m_isValid
flag if the resection is valid
bool m_isVisible
flag if the resection is visible
::fwData::PlaneList::sptr m_planeList
Planes list.
Contains the representation of the data objects used in the framework.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_RECONSTRUCTION_ADDED_SIG
Key in m_signals map of signal m_sigReconstructionAdded.
FWDATA_API void fieldShallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_VISIBILITY_MODIFIED_SIG
Key in m_signals map of signal m_sigVisibilityModified.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
FWDATA_API void shallowCopy(const Object::csptr &_source) override
Defines shallow copy.
FWDATA_API void cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.