fw4spl
V1ToV3.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 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 #include <fwAtoms/String.hpp>
8 #include <fwAtoms/Map.hpp>
9 #include <fwAtomsPatch/StructuralCreatorDB.hpp>
10 
11 #include "fwStructuralPatch/fwData/Mesh/V1ToV3.hpp"
12 
13 namespace fwStructuralPatch
14 {
15 
16 namespace fwData
17 {
18 
19 namespace Mesh
20 {
21 
22 V1ToV3::V1ToV3() : ::fwAtomsPatch::IStructuralPatch()
23 {
24  m_originClassname = "::fwData::Mesh";
25  m_targetClassname = "::fwData::Mesh";
26  m_originVersion = "1";
27  m_targetVersion = "3";
28 }
29 
30 // ----------------------------------------------------------------------------
31 
33 {
34 }
35 
36 // ----------------------------------------------------------------------------
37 
39 {
40 }
41 
42 // ----------------------------------------------------------------------------
43 
44 void V1ToV3::apply( const ::fwAtoms::Object::sptr& previous,
45  const ::fwAtoms::Object::sptr& current,
46  ::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
47 {
48  IStructuralPatch::apply(previous, current, newVersions);
49 
50  // Update object version
51  this->updateVersion(current);
52 
53  // Create helper
54  ::fwAtomsPatch::helper::Object helper(current);
55  helper.addAttribute("point_tex_coords", ::fwAtoms::Object::sptr() );
56  helper.addAttribute("cell_tex_coords", ::fwAtoms::Object::sptr() );
57  helper.addAttribute("array_map", ::fwAtoms::Map::New() );
58 }
59 
60 } // namespace Mesh
61 
62 } // namespace fwData
63 
64 } // namespace fwStructuralPatch
65 
FWSTRUCTURALPATCH_API ~V1ToV3()
Destructor.
Definition: V1ToV3.cpp:32
FWATOMSPATCH_API void updateVersion(std::shared_ptr< ::fwAtoms::Object > current)
Updates the version of the patched object.
Structural patch to convert a fwData::Mesh from version &#39;1&#39; to version &#39;3&#39;.
Definition: V1ToV3.hpp:24
Contains base functionalities used to transform objects from a version to another.
Definition: Abstract.hpp:16
std::string m_targetClassname
Target type.
FWATOMSPATCH_API IStructuralPatch()
Constructor.
std::string m_originClassname
Origin classname of the object.
Definition: IPatch.hpp:64
Contains creators and structural patches.
Definition: Landmarks1.hpp:13
std::string m_originVersion
Origin version of the object.
Definition: IPatch.hpp:67
FWSTRUCTURALPATCH_API V1ToV3()
Constructor.
Definition: V1ToV3.cpp:22
FWATOMSPATCH_API void addAttribute(const std::string &name,::fwAtoms::Base::sptr value, conditions::Abstract::sptr condition=conditions::Abstract::New())
Adds a new attribute in the current object.
std::string m_targetVersion
Target version.
Contains the representation of the data objects used in the framework.
virtual FWSTRUCTURALPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr &current,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.
Definition: V1ToV3.cpp:44