fw4spl
Viewport.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 "fwRenderQt/data/Viewport.hpp"
8 
9 #include <fwData/registry/macros.hpp>
10 
11 fwDataRegisterMacro(::fwRenderQt::data::Viewport);
12 
13 namespace fwRenderQt
14 {
15 namespace data
16 {
17 
18 //------------------------------------------------------------------------------
19 
20 void Viewport::shallowCopy(const ::fwData::Object::csptr& _source )
21 {
22  Viewport::csptr other = Viewport::dynamicConstCast(_source);
23  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
24  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
25  + " to " + this->getClassname()), !bool(other) );
26  this->fieldShallowCopy( _source );
27 
28  m_x = other->m_x;
29  m_y = other->m_y;
30  m_width = other->m_width;
31  m_height = other->m_height;
32 }
33 
34 //------------------------------------------------------------------------------
35 
36 void Viewport::cachedDeepCopy(const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache )
37 {
38  Viewport::csptr other = Viewport::dynamicConstCast(_source);
39  FW_RAISE_EXCEPTION_IF( ::fwData::Exception(
40  "Unable to copy" + (_source ? _source->getClassname() : std::string("<NULL>"))
41  + " to " + this->getClassname()), !bool(other) );
42  this->fieldDeepCopy( _source, cache );
43 
44  m_x = other->m_x;
45  m_y = other->m_y;
46  m_width = other->m_width;
47  m_height = other->m_height;
48 }
49 
50 } // namespace data
51 } // namespace fwRenderQt
52 
Implements data exception class.
virtual const std::string & getClassname() const override
return full object&#39;s classname with its namespace, i.e. fwCore::BaseObject
Definition: Viewport.hpp:28
FWRENDERQT_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
Definition: Viewport.cpp:36
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
FWDATA_API void fieldShallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)
Manage the current viewport of the fwRenderQt.
Definition: Viewport.hpp:23
FWRENDERQT_API void shallowCopy(const ::fwData::Object::csptr &_source) override
Defines shallow copy.
Definition: Viewport.cpp:20
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12