14 #include <vtkObjectFactory.h> 24 const std::string ParamapPresetsParser::PRESET =
"preset";
25 const std::string ParamapPresetsParser::TYPE =
"type";
26 const std::string ParamapPresetsParser::CODE_VALUE =
"code_value";
27 const std::string ParamapPresetsParser::CODE_SCHEME =
"coding_scheme";
34 if (!presetResource)
return false;
37 vtkXMLParser::SetStream(&presetStream);
38 if (!vtkXMLParser::Parse())
41 MITK_INFO<<
"ParamapPresetsParser::LoadPreset xml file cannot parse!"<<std::endl;
53 vtkXMLParser::SetFileName(fileName.c_str());
55 if (!vtkXMLParser::Parse())
58 MITK_INFO<<
"ParamapPresetsParser::LoadPreset xml file cannot parse!"<<std::endl;
66 void ParamapPresetsParser::StartElement(
const char *elementName,
const char **atts)
68 std::string elementNameString = elementName;
69 if (elementNameString == PRESET)
71 m_presetName = ReadXMLStringAttribute(
"name", atts);
74 else if (elementNameString == TYPE)
76 std::string value = ReadXMLStringAttribute(CODE_VALUE, atts);
77 std::string scheme = ReadXMLStringAttribute(CODE_SCHEME, atts);
78 m_Type[m_presetName] =
Type(value, scheme);
83 std::string ParamapPresetsParser::ReadXMLStringAttribute(
const std::string& name,
const char **atts)
87 const char** attsIter = atts;
89 while (*attsIter !=
nullptr)
91 if (name == *attsIter)
void NewPresets(ParamapPrestsType &newType)
DataCollection - Class to facilitate loading/accessing structured data.
ParamapPrestsType const GetTypePresets()
Module * GetModule() const
vtkStandardNewMacro(AnatomicalStructureColorPresets)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Type GetType(const std::string &name)