120 lines
2.9 KiB
C++
120 lines
2.9 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef MMFLOOR_H
|
||
#define MMFLOOR_H
|
||
|
||
#include "MapLayer.h"
|
||
#include "MMFloorOutline.h"
|
||
#include "MMFloorObstacles.h"
|
||
#include "MMFloorAccessPoints.h"
|
||
#include "MMFloorBeacons.h"
|
||
#include "MMFloorFingerprints.h"
|
||
#include "MMFloorUnderlays.h"
|
||
#include "MMFloorPOIs.h"
|
||
#include "MMFloorStairs.h"
|
||
#include "MMFloorElevators.h"
|
||
#include "MMFloorGroundTruthPoints.h"
|
||
|
||
#include "IHasParams.h"
|
||
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
|
||
/**
|
||
* floor-layer containing one floor
|
||
* and its outline, obstacles, access-points, ...
|
||
*/
|
||
class MMFloor : public MapLayer, public IHasParams {
|
||
|
||
private:
|
||
|
||
Floorplan::IndoorMap* map;
|
||
|
||
/** the underlying data-structure */
|
||
Floorplan::Floor* floor;
|
||
|
||
public:
|
||
|
||
/** ctor. existing floor */
|
||
MMFloor(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR), map(map), floor(floor) {
|
||
|
||
new MMFloorUnderlays(this, floor);
|
||
new MMFloorOutline(this, floor);
|
||
new MMFloorObstacles(this, floor);
|
||
new MMFloorAccessPoints(this, floor);
|
||
new MMFloorBeacons(this, floor);
|
||
new MMFloorFingerprints(this, floor);
|
||
new MMFloorPOIs(this, floor);
|
||
new MMFloorStairs(this, map, floor);
|
||
new MMFloorElevators(this, map, floor);
|
||
new MMFloorGroundTruthPoints(this, floor);
|
||
|
||
}
|
||
|
||
bool isVisible() const override {
|
||
return floor->enabled;
|
||
}
|
||
|
||
void setVisible(const bool visible) override {
|
||
floor->enabled = visible;
|
||
onVisibilityChanged(visible);
|
||
}
|
||
|
||
/** ctor. new floor. */
|
||
MMFloor(MapLayer* parent) : MapLayer(parent), floor(nullptr) {
|
||
throw "not yet implemented";
|
||
}
|
||
|
||
/** get the underlying model */
|
||
Floorplan::Floor& getFloor() {return *floor;}
|
||
|
||
std::string getLayerName() const override {return floor->name;}
|
||
|
||
virtual int getNumParams() const override {
|
||
return 3;
|
||
}
|
||
|
||
virtual Param getParamDesc(const int idx) const override {
|
||
switch(idx) {
|
||
case 0: return Param("name", ParamType::STRING);
|
||
case 1: return Param("height", ParamType::FLOAT);
|
||
case 2: return Param("at height", ParamType::FLOAT);
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual ParamValue getParamValue(const int idx) const override {
|
||
switch(idx) {
|
||
case 0: return floor->name;
|
||
case 1: return floor->height;
|
||
case 2: return floor->atHeight;
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||
switch(idx) {
|
||
case 0: floor->name = val.toString(); break;
|
||
case 1: floor->height = val.toFloat(); break;
|
||
case 2: floor->atHeight = val.toFloat(); break;
|
||
}
|
||
}
|
||
|
||
void deleteMe() {
|
||
parent->removeSublayer(this);
|
||
map->floors.erase(std::remove(map->floors.begin(), map->floors.end(), floor), map->floors.end());
|
||
}
|
||
|
||
};
|
||
|
||
#endif // MMFLOOR_H
|