43 std::vector<itk::SmartPointer<BaseData>> result;
51 TiXmlHandle docHandle(&doc);
53 for (TiXmlElement *geomDataElement = docHandle.FirstChildElement(
"GeometryData").ToElement();
54 geomDataElement !=
nullptr;
55 geomDataElement = geomDataElement->NextSiblingElement())
57 for (TiXmlElement *currentElement = geomDataElement->FirstChildElement(); currentElement !=
nullptr;
58 currentElement = currentElement->NextSiblingElement())
62 std::string tagName = currentElement->Value();
63 if (tagName ==
"Geometry3D")
66 if (restoredGeometry.IsNotNull())
69 newGeometryData->SetGeometry(restoredGeometry);
70 result.push_back(newGeometryData.GetPointer());
74 MITK_ERROR <<
"Invalid <Geometry3D> tag encountered. Skipping.";
77 else if (tagName ==
"ProportionalTimeGeometry")
81 if (restoredTimeGeometry.IsNotNull())
84 newGeometryData->SetTimeGeometry(restoredTimeGeometry);
85 result.push_back(newGeometryData.GetPointer());
89 MITK_ERROR <<
"Invalid <ProportionalTimeGeometry> tag encountered. Skipping.";
97 mitkThrow() <<
"Parsing error at line " << doc.ErrorRow() <<
", col " << doc.ErrorCol() <<
": " << doc.ErrorDesc();
102 mitkThrow() <<
"Did not read a single GeometryData object from input.";
115 return new GeometryDataReaderService(*
this);
GeometryDataReaderService()
static Geometry3D::Pointer FromXML(TiXmlElement *node)
Create a Geometry3D from XML. Interprets only the format created by ToXML().
DataCollection - Class to facilitate loading/accessing structured data.
virtual ~GeometryDataReaderService()
us::ServiceRegistration< IFileReader > RegisterService(us::ModuleContext *context=us::GetModuleContext())
Convenience class to temporarily change the current locale.
virtual std::vector< itk::SmartPointer< BaseData > > Read() override
Reads a path or stream and creates a list of BaseData objects.
Base class for creating mitk::BaseData objects from files or streams.
static ProportionalTimeGeometry::Pointer FromXML(TiXmlElement *node)
Create a ProportionalTimeGeometry from XML. Interprets only the format created by ToXML()...