| 298 | } |
| 299 | |
| 300 | mitk::DataNode::Pointer mitk::SceneReaderV1::LoadBaseDataFromDataTag(const tinyxml2::XMLElement *dataElement, |
| 301 | const PropertyList *properties, |
| 302 | const std::string &workingDirectory, |
| 303 | bool &error) |
| 304 | { |
| 305 | DataNode::Pointer node; |
| 306 | |
| 307 | if (dataElement) |
| 308 | { |
| 309 | const char *filename = dataElement->Attribute("file"); |
| 310 | if (filename && strlen(filename) != 0) |
| 311 | { |
| 312 | try |
| 313 | { |
| 314 | auto baseData = IOUtil::Load(workingDirectory + Poco::Path::separator() + filename, properties); |
| 315 | |
| 316 | node = DataNode::New(); |
| 317 | node->SetData(baseData); |
| 318 | } |
| 319 | catch (std::exception &e) |
| 320 | { |
| 321 | MITK_ERROR << "Error during attempt to read '" << filename << "'. Exception says: " << e.what(); |
| 322 | error = true; |
| 323 | } |
| 324 | |
| 325 | if (node.IsNull()) |
| 326 | { |
| 327 | MITK_ERROR << "Error during attempt to read '" << filename << "'. Factory returned nullptr object."; |
| 328 | error = true; |
| 329 | } |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | MITK_ERROR << "File attribute of data tag is empty!"; |
| 334 | error = true; |
| 335 | } |
| 336 | |
| 337 | const char* dataUID = dataElement->Attribute("UID"); |
| 338 | if (!error && dataUID != nullptr) |
| 339 | { |
| 340 | UIDManipulator manip(node->GetData()); |
| 341 | manip.SetUID(dataUID); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | // in case there was no <data> element we create a new empty node (for appending a propertylist later) |
| 346 | if (node.IsNull()) |
| 347 | { |
| 348 | node = DataNode::New(); |
| 349 | } |
| 350 | |
| 351 | return node; |
| 352 | } |
| 353 | |
| 354 | void mitk::SceneReaderV1::ClearNodePropertyListWithExceptions(DataNode &node, PropertyList &propertyList) |
| 355 | { |