started adding earth-mapping
some new helper methods added support for floorplan metadata load/save
This commit is contained in:
@@ -105,7 +105,7 @@ namespace Floorplan {
|
||||
XMLElem* stairs = doc.NewElement("stairs");
|
||||
for (const Stair* _stair : mf->stairs) {
|
||||
XMLElem* elem = doc.NewElement("stair");
|
||||
addMetaElement(doc, elem, _stair->meta);
|
||||
addMetaElement(doc, elem, _stair->getMeta());
|
||||
if (dynamic_cast<const StairFreeform*>(_stair)) {
|
||||
const StairFreeform* stair = (StairFreeform*) _stair;
|
||||
elem->SetAttribute("type", 0); // TODO: other types?
|
||||
@@ -156,6 +156,7 @@ namespace Floorplan {
|
||||
accesspoint->SetAttribute("mdl_txp", ap->model.txp);
|
||||
accesspoint->SetAttribute("mdl_exp", ap->model.exp);
|
||||
accesspoint->SetAttribute("mdl_waf", ap->model.waf);
|
||||
addMetaElement(doc, accesspoint, ap->getMeta());
|
||||
accesspoints->InsertEndChild(accesspoint);
|
||||
}
|
||||
floor->InsertEndChild(accesspoints);
|
||||
@@ -219,8 +220,15 @@ namespace Floorplan {
|
||||
static void addMetaElement(XMLDoc& doc, XMLElem* other, const Meta* meta) {
|
||||
if (meta == nullptr) {return;} // nothing to add
|
||||
XMLElem* elem = doc.NewElement("meta");
|
||||
for (auto it : meta->params) {
|
||||
elem->Attribute(it.first.c_str(), it.second.c_str());
|
||||
// for (auto it : meta->params) {
|
||||
// elem->Attribute(it.first.c_str(), it.second.c_str());
|
||||
// }
|
||||
for (const Meta::KeyVal& kv : meta->params) {
|
||||
// <entry key="123">abc</entry>
|
||||
XMLElem* subElem = doc.NewElement("entry");
|
||||
subElem->SetAttribute("key", kv.key.c_str());
|
||||
subElem->SetText(kv.val.c_str());
|
||||
elem->InsertEndChild(subElem);
|
||||
}
|
||||
other->InsertEndChild(elem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user