Merge branch 'master' of https://git.frank-ebner.de/FHWS/Indoor
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "Floorplan.h"
|
||||
|
||||
#include "../../misc/Debug.h"
|
||||
#include "../../Assertions.h"
|
||||
#include "../../lib/tinyxml/tinyxml2.h"
|
||||
|
||||
@@ -18,10 +19,15 @@ namespace Floorplan {
|
||||
*/
|
||||
class Reader {
|
||||
|
||||
private:
|
||||
|
||||
static constexpr const char* name = "FPReader";
|
||||
|
||||
public:
|
||||
|
||||
/** read an IndoorMap from the given XML-file */
|
||||
static IndoorMap* readFromFile(const std::string& file) {
|
||||
Log::add(name, "reading floorplan from file: " + file);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
tinyxml2::XMLDocument doc;
|
||||
const tinyxml2::XMLError res = doc.LoadFile(file.c_str());
|
||||
@@ -31,6 +37,7 @@ namespace Floorplan {
|
||||
|
||||
/** read an IndoorMap from the given XMl-string */
|
||||
static IndoorMap* readFromString(const std::string& str) {
|
||||
Log::add(name, "reading floorplan from string");
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
tinyxml2::XMLDocument doc;
|
||||
const tinyxml2::XMLError res = doc.Parse(str.c_str(), str.length());
|
||||
@@ -54,7 +61,7 @@ namespace Floorplan {
|
||||
|
||||
/** parse the <map> node */
|
||||
static IndoorMap* parseMap(const XMLElem* el) {
|
||||
std::cout << el->Name() << std::endl;
|
||||
Log::add(name, "parsing the map");
|
||||
IndoorMap* map = new IndoorMap();
|
||||
map->width = el->FloatAttribute("width");
|
||||
map->depth = el->FloatAttribute("depth");
|
||||
@@ -76,6 +83,7 @@ namespace Floorplan {
|
||||
/** parse one <floor> node */
|
||||
static Floor* parseFloor(const XMLElem* el) {
|
||||
Floor* floor = new Floor();
|
||||
Log::add(name, std::string("parsing floor ") + el->Attribute("name"));
|
||||
floor->atHeight = el->FloatAttribute("atHeight");
|
||||
floor->height = el->FloatAttribute("height");
|
||||
floor->name = el->Attribute("name");
|
||||
|
||||
Reference in New Issue
Block a user