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

@@ -81,12 +81,36 @@ namespace Floorplan {
IndoorMap* map = new IndoorMap();
map->width = el->FloatAttribute("width");
map->depth = el->FloatAttribute("depth");
FOREACH_NODE(n, el) {
if (std::string("floors") == n->Name()) {map->floors = parseFloors(n);}
if (std::string("floors") == n->Name()) {map->floors = parseFloors(n);}
if (std::string("earthReg") == n->Name()) {map->earthReg = parseEarthReg(n);}
}
return map;
}
/** parse the <earthReg> node */
static EarthRegistration parseEarthReg(const XMLElem* el) {
EarthRegistration reg;
FOREACH_NODE(n, el) {
if (std::string("correspondences") == n->Name()) {
FOREACH_NODE(n2, n) {
if (std::string("point") == n2->Name()) {
Floorplan::EarthPosMapPos* pos = new Floorplan::EarthPosMapPos();
pos->posOnMap_m.x = n2->FloatAttribute("mx");
pos->posOnMap_m.y = n2->FloatAttribute("my");
pos->posOnMap_m.z = n2->FloatAttribute("mz");
pos->posOnEarth.lat = n2->FloatAttribute("lat");
pos->posOnEarth.lon = n2->FloatAttribute("lon");
pos->posOnEarth.height = n2->FloatAttribute("alt");
reg.correspondences.push_back(pos);
}
}
}
}
return reg;
}
/** parse the <floors> node */
static std::vector<Floor*> parseFloors(const XMLElem* el) {
std::vector<Floor*> floors;