| 138 | } |
| 139 | |
| 140 | void mitk::ContourModelWriter::WriteXML(const mitk::ContourModel *contourModel, std::ostream &out) |
| 141 | { |
| 142 | /*++++ <contourModel> ++++*/ |
| 143 | WriteStartElement(XML_CONTOURMODEL, out); |
| 144 | |
| 145 | /*++++ <head> ++++*/ |
| 146 | WriteStartElement(XML_HEAD, out); |
| 147 | |
| 148 | /*++++ <geometryInfo> ++++*/ |
| 149 | WriteStartElement(XML_GEOMETRY_INFO, out); |
| 150 | |
| 151 | WriteGeometryInformation(contourModel->GetTimeGeometry(), out); |
| 152 | |
| 153 | /*++++ </geometryInfo> ++++*/ |
| 154 | WriteEndElement(XML_GEOMETRY_INFO, out); |
| 155 | |
| 156 | /*++++ </head> ++++*/ |
| 157 | WriteEndElement(XML_HEAD, out); |
| 158 | |
| 159 | /*++++ <data> ++++*/ |
| 160 | WriteStartElement(XML_DATA, out); |
| 161 | |
| 162 | unsigned int timecount = contourModel->GetTimeSteps(); |
| 163 | |
| 164 | for (unsigned int i = 0; i < timecount; i++) |
| 165 | { |
| 166 | /*++++ <timestep> ++++*/ |
| 167 | std::vector<std::string> at; |
| 168 | at.push_back("n"); |
| 169 | std::vector<std::string> val; |
| 170 | val.push_back(ConvertToString(i)); |
| 171 | |
| 172 | at.push_back("isClosed"); |
| 173 | val.push_back(ConvertToString(contourModel->IsClosed())); |
| 174 | |
| 175 | WriteStartElementWithAttribut(XML_TIME_STEP, at, val, out); |
| 176 | |
| 177 | /*++++ <controlPoints> ++++*/ |
| 178 | WriteStartElement(XML_CONTROL_POINTS, out); |
| 179 | |
| 180 | auto it = contourModel->IteratorBegin(); |
| 181 | auto end = contourModel->IteratorEnd(); |
| 182 | |
| 183 | while (it != end) |
| 184 | { |
| 185 | mitk::ContourModel::VertexType *v = *it; |
| 186 | |
| 187 | /*++++ <point> ++++*/ |
| 188 | std::vector<std::string> attr; |
| 189 | attr.push_back("IsControlPoint"); |
| 190 | std::vector<std::string> value; |
| 191 | value.push_back(ConvertToString(v->IsControlPoint)); |
| 192 | WriteStartElementWithAttribut(XML_POINT, attr, value, out); |
| 193 | |
| 194 | /*++++ <x> ++++*/ |
| 195 | WriteStartElement(XML_X, out); |
| 196 | WriteCharacterData(ConvertToString(v->Coordinates[0]).c_str(), out); |
| 197 | /*++++ </x> ++++*/ |
nothing calls this directly
no test coverage detected