MCPcopy Create free account
hub / github.com/MITK/MITK / Write

Method Write

Modules/Core/src/IO/mitkPointSetWriterService.cpp:57–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void 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
89mitk::PointSetWriterService *mitk::PointSetWriterService::Clone() const
90{

Callers

nothing calls this directly

Calls 2

GetInputMethod · 0.45
GetFileNameMethod · 0.45

Tested by

no test coverage detected