fw4spl
fwData/Material/V1ToV2.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 #include <fwAtoms/String.hpp>
8 #include <fwAtomsPatch/StructuralCreatorDB.hpp>
9 
10 #include "fwStructuralPatch/fwData/Material/V1ToV2.hpp"
11 
12 namespace fwStructuralPatch
13 {
14 
15 namespace fwData
16 {
17 
18 namespace Material
19 {
20 
21 V1ToV2::V1ToV2() : ::fwAtomsPatch::IStructuralPatch()
22 {
23  m_originClassname = "::fwData::Material";
24  m_targetClassname = "::fwData::Material";
25  m_originVersion = "1";
26  m_targetVersion = "2";
27 }
28 
29 // ----------------------------------------------------------------------------
30 
32 {
33 }
34 
35 // ----------------------------------------------------------------------------
36 
38 {
39 }
40 
41 // ----------------------------------------------------------------------------
42 
44  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("diffuse_texture", ::fwAtoms::Object::sptr() );
56  helper.addAttribute("diffuse_texture_filtering", ::fwAtoms::String::New("LINEAR"));
57  helper.addAttribute("diffuse_texture_wrapping", ::fwAtoms::String::New("REPEAT"));
58 }
59 
60 } // namespace Material
61 
62 } // namespace fwData
63 
64 } // namespace fwStructuralPatch
65 
virtual FWSTRUCTURALPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr &current,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.
FWATOMSPATCH_API void updateVersion(std::shared_ptr< ::fwAtoms::Object > current)
Updates the version of the patched object.
static FWATOMS_API String::sptr New(std::string value)
Construct a new Object represented a string.
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
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.
FWSTRUCTURALPATCH_API V1ToV2()
Constructor.
FWSTRUCTURALPATCH_API ~V1ToV2()
Destructor.
Structural patch to convert a fwData::Image from version &#39;1&#39; to version &#39;2&#39;.