added earth-registration load/save

This commit is contained in:
2017-03-21 21:11:58 +01:00
parent b8b35d2a50
commit b03804d378
4 changed files with 57 additions and 2 deletions

View File

@@ -49,11 +49,34 @@ namespace Floorplan {
root->SetAttribute("width", map->width);
root->SetAttribute("depth", map->depth);
// add earth registration to the map
addEarthReg(doc, root, map);
// add all floors to the map
addFloors(doc, root, map);
}
/** add earth registration to the map */
static void addEarthReg(XMLDoc& doc, XMLElem* root, const IndoorMap* map) {
XMLElem* earthReg = doc.NewElement("earthReg"); {
XMLElem* correspondences = doc.NewElement("correspondences");
for (const Floorplan::EarthPosMapPos* reg : map->earthReg.correspondences) {
XMLElem* point = doc.NewElement("point");
point->SetAttribute("lat", reg->posOnEarth.lat);
point->SetAttribute("lon", reg->posOnEarth.lon);
point->SetAttribute("alt", reg->posOnEarth.height);
point->SetAttribute("mx", reg->posOnMap_m.x);
point->SetAttribute("my", reg->posOnMap_m.y);
point->SetAttribute("mz", reg->posOnMap_m.z);
correspondences->InsertEndChild(point);
}
earthReg->InsertEndChild(correspondences);
} root->InsertEndChild(earthReg);
}
/** add all floors to the map */
static void addFloors(XMLDoc& doc, XMLElem* root, const IndoorMap* map) {
XMLElem* floors = doc.NewElement("floors");