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

Method save

annotation/XmlRepository.cpp:16–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16bool XmlRepository::save() const
17{
18 if (!_list) {
19 return false;
20 }
21 pugi::xml_document xml;
22 pugi::xml_node root = xml.append_child("ASAP_Annotations");
23 if (root.empty()) {
24 return false;
25 }
26 pugi::xml_node nodeAnnotations = root.append_child("Annotations");
27 pugi::xml_node nodeGroups = root.append_child("AnnotationGroups");
28
29 std::vector<std::shared_ptr<Annotation> > annotations = _list->getAnnotations();
30 for (std::vector<std::shared_ptr<Annotation> >::const_iterator it = annotations.begin(); it != annotations.end(); ++it)
31 {
32 saveAnnotation(*it, &nodeAnnotations);
33 }
34
35 std::vector<std::shared_ptr<AnnotationGroup> > groups = _list->getGroups();
36 for (std::vector<std::shared_ptr<AnnotationGroup>>::const_iterator it = groups.begin(); it != groups.end(); ++it)
37 {
38 saveGroup(*it, &nodeGroups);
39 }
40
41 return xml.save_file(_source.c_str());
42}
43
44void XmlRepository::saveAnnotation(const std::shared_ptr<Annotation>& annotation, pugi::xml_node* node) const
45{

Callers 5

processMethod · 0.45
paintEventMethod · 0.45
paintMethod · 0.45
paintMethod · 0.45
addThumbnailToCacheMethod · 0.45

Calls 3

emptyMethod · 0.80
getAnnotationsMethod · 0.80
getGroupsMethod · 0.80

Tested by

no test coverage detected