Merge branch 'master' into workingToni
This commit is contained in:
@@ -179,6 +179,7 @@ namespace Floorplan {
|
|||||||
struct FloorObstacle;
|
struct FloorObstacle;
|
||||||
struct AccessPoint;
|
struct AccessPoint;
|
||||||
struct Beacon;
|
struct Beacon;
|
||||||
|
struct FingerprintLocation;
|
||||||
struct FloorRegion;
|
struct FloorRegion;
|
||||||
struct UnderlayImage;
|
struct UnderlayImage;
|
||||||
struct POI;
|
struct POI;
|
||||||
@@ -190,6 +191,7 @@ namespace Floorplan {
|
|||||||
using FloorObstacles = std::vector<FloorObstacle*>;
|
using FloorObstacles = std::vector<FloorObstacle*>;
|
||||||
using FloorAccessPoints = std::vector<AccessPoint*>;
|
using FloorAccessPoints = std::vector<AccessPoint*>;
|
||||||
using FloorBeacons = std::vector<Beacon*>;
|
using FloorBeacons = std::vector<Beacon*>;
|
||||||
|
using FloorFingerprintLocations = std::vector<FingerprintLocation*>;
|
||||||
using FloorRegions = std::vector<FloorRegion*>;
|
using FloorRegions = std::vector<FloorRegion*>;
|
||||||
using FloorUnderlays = std::vector<UnderlayImage*>;
|
using FloorUnderlays = std::vector<UnderlayImage*>;
|
||||||
using FloorPOIs = std::vector<POI*>;
|
using FloorPOIs = std::vector<POI*>;
|
||||||
@@ -208,6 +210,7 @@ namespace Floorplan {
|
|||||||
FloorRegions regions; // all regions within the floor (rooms, ...)
|
FloorRegions regions; // all regions within the floor (rooms, ...)
|
||||||
FloorAccessPoints accesspoints;
|
FloorAccessPoints accesspoints;
|
||||||
FloorBeacons beacons;
|
FloorBeacons beacons;
|
||||||
|
FloorFingerprintLocations fpLocations; // potential fingerprint locations
|
||||||
FloorUnderlays underlays; // underlay images (used for map-building)
|
FloorUnderlays underlays; // underlay images (used for map-building)
|
||||||
FloorPOIs pois; // POIs within the floor
|
FloorPOIs pois; // POIs within the floor
|
||||||
FloorStairs stairs; // all stairs within one floor
|
FloorStairs stairs; // all stairs within one floor
|
||||||
@@ -225,7 +228,15 @@ namespace Floorplan {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** location for fingerprint measurements */
|
||||||
|
struct FingerprintLocation : public HasMeta {
|
||||||
|
std::string name;
|
||||||
|
Point2 posOnFloor;
|
||||||
|
float heightAboveFloor = 0;
|
||||||
|
FingerprintLocation() {;}
|
||||||
|
FingerprintLocation(const std::string& name, const Point2 posOnFloor, const float heightAboveFloor) : name(name), posOnFloor(posOnFloor), heightAboveFloor(heightAboveFloor) {;}
|
||||||
|
Point3 getPosition(const Floor& floor) const {return Point3(posOnFloor.x, posOnFloor.y, floor.atHeight + heightAboveFloor);}
|
||||||
|
};
|
||||||
|
|
||||||
/** a POI located somewhere on a floor */
|
/** a POI located somewhere on a floor */
|
||||||
struct POI {
|
struct POI {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ namespace Floorplan {
|
|||||||
if (std::string("obstacles") == n->Name()) {floor->obstacles = parseFloorObstacles(n);}
|
if (std::string("obstacles") == n->Name()) {floor->obstacles = parseFloorObstacles(n);}
|
||||||
if (std::string("accesspoints") == n->Name()) {floor->accesspoints = parseFloorAccessPoints(n);}
|
if (std::string("accesspoints") == n->Name()) {floor->accesspoints = parseFloorAccessPoints(n);}
|
||||||
if (std::string("beacons") == n->Name()) {floor->beacons = parseFloorBeacons(n);}
|
if (std::string("beacons") == n->Name()) {floor->beacons = parseFloorBeacons(n);}
|
||||||
|
if (std::string("fingerprints") == n->Name()) {floor->fpLocations = parseFingerprintLocations(n);}
|
||||||
if (std::string("regions") == n->Name()) {floor->regions = parseFloorRegions(n);}
|
if (std::string("regions") == n->Name()) {floor->regions = parseFloorRegions(n);}
|
||||||
if (std::string("underlays") == n->Name()) {floor->underlays = parseFloorUnderlays(n);}
|
if (std::string("underlays") == n->Name()) {floor->underlays = parseFloorUnderlays(n);}
|
||||||
if (std::string("pois") == n->Name()) {floor->pois = parseFloorPOIs(n);}
|
if (std::string("pois") == n->Name()) {floor->pois = parseFloorPOIs(n);}
|
||||||
@@ -310,6 +311,28 @@ namespace Floorplan {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** parse <fingerprints> <location>s */
|
||||||
|
static std::vector<FingerprintLocation*> parseFingerprintLocations(const XMLElem* el) {
|
||||||
|
assertNode("fingerprints", el);
|
||||||
|
std::vector<FingerprintLocation*> vec;
|
||||||
|
FOREACH_NODE(n, el) {
|
||||||
|
if (std::string("location") == n->Name()) { vec.push_back(parseFingerprintLocation(n)); }
|
||||||
|
}
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** parse one fingerprint <location> */
|
||||||
|
static FingerprintLocation* parseFingerprintLocation(const XMLElem* n) {
|
||||||
|
assertNode("location", n);
|
||||||
|
FingerprintLocation* fpl = new FingerprintLocation();
|
||||||
|
fpl->name = n->Attribute("name");
|
||||||
|
fpl->posOnFloor.x = n->FloatAttribute("x");
|
||||||
|
fpl->posOnFloor.y = n->FloatAttribute("y");
|
||||||
|
fpl->heightAboveFloor = n->FloatAttribute("dz");
|
||||||
|
const XMLElem* meta = n->FirstChildElement("meta");
|
||||||
|
if (meta) {fpl->setMeta(parseMetaElement(meta));}
|
||||||
|
return fpl;
|
||||||
|
}
|
||||||
|
|
||||||
static std::vector<FloorRegion*> parseFloorRegions(const XMLElem* el) {
|
static std::vector<FloorRegion*> parseFloorRegions(const XMLElem* el) {
|
||||||
std::vector<FloorRegion*> vec;
|
std::vector<FloorRegion*> vec;
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ namespace Floorplan {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** add all sorts of POI to the floor */
|
/** add all sorts of POI to the floor */
|
||||||
static void addFloorPOI(XMLDoc& doc, XMLElem* floor, const Floor* mf) {
|
static void addFloorPOI(XMLDoc& doc, XMLElem* floor, const Floor* mf) {
|
||||||
|
|
||||||
@@ -190,6 +191,18 @@ namespace Floorplan {
|
|||||||
floor->InsertEndChild(beacons);
|
floor->InsertEndChild(beacons);
|
||||||
|
|
||||||
|
|
||||||
|
XMLElem* fingerprints = doc.NewElement("fingerprints");
|
||||||
|
for (const FingerprintLocation* fpl : mf->fpLocations) {
|
||||||
|
XMLElem* efpl = doc.NewElement("location");
|
||||||
|
efpl->SetAttribute("name", fpl->name.c_str());
|
||||||
|
efpl->SetAttribute("x", fpl->posOnFloor.x);
|
||||||
|
efpl->SetAttribute("y", fpl->posOnFloor.y);
|
||||||
|
efpl->SetAttribute("dz", fpl->heightAboveFloor);
|
||||||
|
addMetaElement(doc, efpl, fpl->getMeta());
|
||||||
|
fingerprints->InsertEndChild(efpl);
|
||||||
|
}
|
||||||
|
floor->InsertEndChild(fingerprints);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addFloorOutline(XMLDoc& doc, XMLElem* floor, const Floor* mf) {
|
static void addFloorOutline(XMLDoc& doc, XMLElem* floor, const Floor* mf) {
|
||||||
|
|||||||
Reference in New Issue
Block a user