Merge branch 'master' into workingToni
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Floorplan {
|
||||
|
||||
using XMLAttr = tinyxml2::XMLAttribute;
|
||||
using XMLElem = tinyxml2::XMLElement;
|
||||
using XMLNode = tinyxml2::XMLNode;
|
||||
|
||||
/**
|
||||
* read an IndoorMaps from XML-data
|
||||
@@ -31,7 +32,13 @@ namespace Floorplan {
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
tinyxml2::XMLDocument doc;
|
||||
const tinyxml2::XMLError res = doc.LoadFile(file.c_str());
|
||||
if (res != tinyxml2::XMLError::XML_SUCCESS) {throw Exception("error while loading XML " + file);}
|
||||
if (res != tinyxml2::XMLError::XML_SUCCESS) {
|
||||
throw Exception(
|
||||
std::string() + "error while loading XML " + file + "\n" +
|
||||
((doc.GetErrorStr1()) ? (doc.GetErrorStr1()) : ("")) + "\n" +
|
||||
((doc.GetErrorStr2()) ? (doc.GetErrorStr2()) : (""))
|
||||
);
|
||||
}
|
||||
return parse(doc);
|
||||
}
|
||||
|
||||
@@ -41,7 +48,13 @@ namespace Floorplan {
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
tinyxml2::XMLDocument doc;
|
||||
const tinyxml2::XMLError res = doc.Parse(str.c_str(), str.length());
|
||||
if (res != tinyxml2::XMLError::XML_SUCCESS) {throw Exception("error while parsing XML");}
|
||||
if (res != tinyxml2::XMLError::XML_SUCCESS) {
|
||||
throw Exception(
|
||||
std::string() + "error while parsing XML\n" +
|
||||
((doc.GetErrorStr1()) ? (doc.GetErrorStr1()) : ("")) + "\n" +
|
||||
((doc.GetErrorStr2()) ? (doc.GetErrorStr2()) : (""))
|
||||
);
|
||||
}
|
||||
return parse(doc);
|
||||
}
|
||||
|
||||
@@ -158,9 +171,7 @@ namespace Floorplan {
|
||||
|
||||
// stair meta information?
|
||||
const XMLElem* meta = el->FirstChildElement("meta");
|
||||
if (meta) {
|
||||
stair->meta = parseMetaElement(meta);
|
||||
}
|
||||
if (meta) {stair->setMeta(parseMetaElement(meta));}
|
||||
|
||||
return stair;
|
||||
|
||||
@@ -246,10 +257,16 @@ namespace Floorplan {
|
||||
/** parse one <meta> element */
|
||||
static Meta* parseMetaElement(const XMLElem* n) {
|
||||
Meta* elem = new Meta();
|
||||
const XMLAttr* attr = n->FirstAttribute();
|
||||
while (attr) {
|
||||
elem->params[attr->Name()] = attr->Value();
|
||||
attr = attr->Next();
|
||||
// const XMLAttr* attr = n->FirstAttribute();
|
||||
// while (attr) {
|
||||
// elem->setVal(attr->Name(), attr->Value());
|
||||
// attr = attr->Next();
|
||||
// }
|
||||
const XMLElem* sub = n->FirstChildElement();
|
||||
while(sub) {
|
||||
// <entry key="123">abc</entry>
|
||||
elem->add(sub->Attribute("key"), sub->FirstChild()->Value());
|
||||
sub = sub->NextSiblingElement();
|
||||
}
|
||||
return elem;
|
||||
}
|
||||
@@ -263,6 +280,8 @@ namespace Floorplan {
|
||||
ap->model.txp = n->FloatAttribute("mdl_txp");
|
||||
ap->model.exp = n->FloatAttribute("mdl_exp");
|
||||
ap->model.waf = n->FloatAttribute("mdl_waf");
|
||||
const XMLElem* meta = n->FirstChildElement("meta");
|
||||
if (meta) {ap->setMeta(parseMetaElement(meta));}
|
||||
return ap;
|
||||
}
|
||||
|
||||
@@ -281,9 +300,9 @@ namespace Floorplan {
|
||||
Beacon* b = new Beacon();
|
||||
b->mac = n->Attribute("mac");
|
||||
b->name = n->Attribute("name");
|
||||
b->major = n->Attribute("major");
|
||||
b->minor = n->Attribute("minor");
|
||||
b->uuid = n->Attribute("uuid");
|
||||
b->major = n->Attribute("major") ? n->Attribute("major") : "";
|
||||
b->minor = n->Attribute("minor") ? n->Attribute("minor") : "";
|
||||
b->uuid = n->Attribute("uuid") ? n->Attribute("uuid") : "";
|
||||
b->model.txp = n->FloatAttribute("mdl_txp");
|
||||
b->model.exp = n->FloatAttribute("mdl_exp");
|
||||
b->model.waf = n->FloatAttribute("mdl_waf");
|
||||
|
||||
Reference in New Issue
Block a user