| 42 | } |
| 43 | |
| 44 | void XmlRepository::saveAnnotation(const std::shared_ptr<Annotation>& annotation, pugi::xml_node* node) const |
| 45 | { |
| 46 | pugi::xml_node nodeAnnotation = node->append_child("Annotation"); |
| 47 | pugi::xml_attribute attributeName = nodeAnnotation.append_attribute("Name"); |
| 48 | attributeName.set_value(annotation->getName().c_str()); |
| 49 | pugi::xml_attribute attributeType = nodeAnnotation.append_attribute("Type"); |
| 50 | attributeType.set_value(annotation->getTypeAsString().c_str()); |
| 51 | pugi::xml_attribute attributeGroup = nodeAnnotation.append_attribute("PartOfGroup"); |
| 52 | if (annotation->getGroup()) { |
| 53 | attributeGroup.set_value(annotation->getGroup()->getName().c_str()); |
| 54 | } |
| 55 | else { |
| 56 | attributeGroup.set_value("None"); |
| 57 | } |
| 58 | pugi::xml_attribute attributeColor = nodeAnnotation.append_attribute("Color"); |
| 59 | attributeColor.set_value(annotation->getColor().c_str()); |
| 60 | |
| 61 | pugi::xml_node nodeCoordinates = nodeAnnotation.append_child("Coordinates"); |
| 62 | std::vector<Point> coordinates = annotation->getCoordinates(); |
| 63 | for (std::vector<Point>::const_iterator it = coordinates.begin(); it != coordinates.end(); ++it) { |
| 64 | pugi::xml_node nodeCoordinate = nodeCoordinates.append_child("Coordinate"); |
| 65 | pugi::xml_attribute attributeOrder = nodeCoordinate.append_attribute("Order"); |
| 66 | attributeOrder.set_value(static_cast<int>(it - coordinates.begin())); |
| 67 | pugi::xml_attribute attributeX = nodeCoordinate.append_attribute("X"); |
| 68 | attributeX.set_value(it->getX()); |
| 69 | pugi::xml_attribute attributeY = nodeCoordinate.append_attribute("Y"); |
| 70 | attributeY.set_value(it->getY()); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void XmlRepository::saveGroup(const std::shared_ptr<AnnotationGroup>& group, pugi::xml_node* node) const |
| 75 | { |
nothing calls this directly
no test coverage detected