MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / saveAnnotation

Method saveAnnotation

annotation/XmlRepository.cpp:44–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void 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
74void XmlRepository::saveGroup(const std::shared_ptr<AnnotationGroup>& group, pugi::xml_node* node) const
75{

Callers

nothing calls this directly

Calls 5

getNameMethod · 0.80
getTypeAsStringMethod · 0.80
getColorMethod · 0.80
getCoordinatesMethod · 0.80
getGroupMethod · 0.45

Tested by

no test coverage detected