78 lines
1.5 KiB
C++
78 lines
1.5 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 MMFLOORS_H
|
||
#define MMFLOORS_H
|
||
|
||
#include "MapLayer.h"
|
||
#include "MMFloor.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
/**
|
||
* layer containing all of the map's floors
|
||
*/
|
||
class MMFloors : public MapLayer {
|
||
|
||
private:
|
||
|
||
bool visible = true;
|
||
Floorplan::IndoorMap* map;
|
||
|
||
public:
|
||
|
||
/** ctor with the underlying model */
|
||
MMFloors(MapLayer* parent, Floorplan::IndoorMap* map) : MapLayer(parent, MapLayerType::FLOORS), map(map) {
|
||
|
||
// add all floors
|
||
for (Floorplan::Floor* floor : map->floors) {
|
||
new MMFloor(this, map, floor);
|
||
}
|
||
|
||
}
|
||
|
||
bool isVisible() const override {
|
||
return visible;
|
||
}
|
||
|
||
void setVisible(const bool visible) override {
|
||
this->visible = visible;
|
||
onVisibilityChanged(visible);
|
||
}
|
||
|
||
std::string getLayerName() const override {return "floors";}
|
||
|
||
/** get the underlying model */
|
||
Floorplan::IndoorMap* getMap() {return map;}
|
||
|
||
MMFloor* createFloor() {
|
||
|
||
// add to underlying model
|
||
Floorplan::Floor* floor = new Floorplan::Floor();
|
||
map->floors.push_back(floor);
|
||
|
||
// defalut values
|
||
floor->atHeight = 0;
|
||
floor->height = 3;
|
||
floor->name = "floor";
|
||
|
||
// add to UI model
|
||
MMFloor* mmfloor = new MMFloor(this, map, floor);
|
||
//elements.push_back(mmfloor);
|
||
|
||
return mmfloor;
|
||
|
||
}
|
||
|
||
|
||
};
|
||
|
||
#endif // MMFLOORS_H
|