7 #include "fwStructuralPatch/fwData/Material/V3ToV4.hpp" 9 #include <fwAtoms/Boolean.hpp> 10 #include <fwAtoms/Numeric.hpp> 11 #include <fwAtoms/Numeric.hxx> 12 #include <fwAtoms/Object.hpp> 13 #include <fwAtoms/Object.hxx> 14 #include <fwAtoms/Sequence.hpp> 15 #include <fwAtoms/String.hpp> 16 #include <fwAtomsPatch/StructuralCreatorDB.hpp> 50 const ::fwAtoms::Object::sptr& current,
51 ::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
53 IStructuralPatch::apply(previous, current, newVersions);
61 ::fwAtoms::Boolean::sptr lighting = previous->getAttribute<
::fwAtoms::Boolean >(
"lighting");
62 bool bLighting = lighting->getValue();
72 ::fwAtoms::Object::sptr ambient = current->getAttribute<
::fwAtoms::Object >(
"ambient");
81 ::fwAtoms::Sequence::sptr ambientSeq = diffuse->getAttribute<
::fwAtoms::Sequence >(
"rgba");
82 ::fwAtoms::Numeric::sptr r = std::dynamic_pointer_cast<
::fwAtoms::Numeric >((*ambientSeq)[0]);
84 ::fwAtoms::Numeric::sptr g = std::dynamic_pointer_cast<
::fwAtoms::Numeric >((*ambientSeq)[1]);
86 ::fwAtoms::Numeric::sptr b = std::dynamic_pointer_cast<
::fwAtoms::Numeric >((*ambientSeq)[2]);
88 ::fwAtoms::Numeric::sptr
a = std::dynamic_pointer_cast<
::fwAtoms::Numeric >((*ambientSeq)[3]);
FWATOMS_API void setFromString(const std::string &s, NumericType type=EMPTY)
Sets Numeric's value from given string, using Numeric::valueFromString.
Structural patch to convert a fwData::Material from version '3' to version '4'.
FWSTRUCTURALPATCH_API V3ToV4()
Constructor.
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.
FWATOMS_API Base::sptr getAttribute(const std::string &key) const
Returns requested attribute if exists, empty sptr else.
FWSTRUCTURALPATCH_API ~V3ToV4()
Destructor.
FWATOMSPATCH_API void removeAttribute(const std::string &name, conditions::Abstract::sptr condition=conditions::Abstract::New())
Removes an attribute.
Contains base functionalities used to transform objects from a version to another.
Class represented a fwData::Object.
std::string m_targetClassname
Target type.
FWATOMSPATCH_API IStructuralPatch()
Constructor.
std::string m_originClassname
Origin classname of the object.
Contains creators and structural patches.
FWATOMSPATCH_API void replaceAttribute(const std::string &name,::fwAtoms::Base::sptr newValue, conditions::Abstract::sptr condition=conditions::Abstract::New())
Replaces an attribute.
std::string m_originVersion
Origin version of the object.
Represented a Boolean value.
std::string m_targetVersion
Target version.
virtual FWSTRUCTURALPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr ¤t,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.
Contains the representation of the data objects used in the framework.
Sequence represented a list of meta object.