| 55 | } |
| 56 | |
| 57 | void mitk::PointSetWriterService::Write() |
| 58 | { |
| 59 | mitk::LocaleSwitch localeC("C"); |
| 60 | |
| 61 | tinyxml2::XMLDocument doc; |
| 62 | doc.InsertEndChild(doc.NewDeclaration()); |
| 63 | |
| 64 | auto *rootNode = doc.NewElement(XML_POINT_SET_FILE.c_str()); |
| 65 | doc.InsertEndChild(rootNode); |
| 66 | |
| 67 | auto *versionNode = doc.NewElement(XML_FILE_VERSION.c_str()); |
| 68 | auto *versionText = doc.NewText(VERSION_STRING.c_str()); |
| 69 | versionNode->InsertEndChild(versionText); |
| 70 | rootNode->InsertEndChild(versionNode); |
| 71 | |
| 72 | auto *pointSetNode = ToXML(doc, static_cast<const PointSet *>(this->GetInput())); |
| 73 | if (!pointSetNode) |
| 74 | { |
| 75 | mitkThrow() << "Serialization error during PointSet writing."; |
| 76 | } |
| 77 | rootNode->InsertEndChild(pointSetNode); |
| 78 | |
| 79 | // out << doc; // streaming of TinyXML write no new-lines, |
| 80 | // rendering XML files unreadable (for humans) |
| 81 | |
| 82 | LocalFile f(this); |
| 83 | if (tinyxml2::XML_SUCCESS != doc.SaveFile(f.GetFileName().c_str())) |
| 84 | { |
| 85 | mitkThrow() << "Some error during point set writing."; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | mitk::PointSetWriterService *mitk::PointSetWriterService::Clone() const |
| 90 | { |
nothing calls this directly
no test coverage detected