80 lines
1.9 KiB
C++
80 lines
1.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 MMFLOOROUTLINE_H
|
||
#define MMFLOOROUTLINE_H
|
||
|
||
#include "MapLayer.h"
|
||
#include "MMFloorOutlinePolygon.h"
|
||
#include "MMFloorOutlinePolygonCombined.h"
|
||
|
||
//#include "../3D/MV3DElementFloorOutline.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
/**
|
||
* layer containing all elements describing a floor's outline
|
||
*/
|
||
class MMFloorOutline : public MapLayer {
|
||
|
||
private:
|
||
|
||
/** the underlying model */
|
||
Floorplan::Floor* floor;
|
||
|
||
|
||
public:
|
||
|
||
/** ctor with the underlying model */
|
||
MMFloorOutline(MapLayer* parent, Floorplan::Floor* floor) :
|
||
MapLayer(parent, MapLayerType::FLOOR_GROUND), floor(floor) {
|
||
|
||
// each polygon that is part of the outline
|
||
for (Floorplan::FloorOutlinePolygon* poly : floor->outline) {
|
||
addElement(new MMFloorOutlinePolygon(this, floor, poly));
|
||
}
|
||
|
||
// for 3D, alle polygons [add/remove] are combined into one renderable polygons
|
||
addElement(new MMFloorOutlinePolygonCombined(this, floor));
|
||
|
||
}
|
||
|
||
bool isVisible() const override {
|
||
return floor->outline.enabled;
|
||
}
|
||
|
||
void setVisible(const bool visible) override {
|
||
this-> floor->outline.enabled = visible;
|
||
onVisibilityChanged(visible);
|
||
}
|
||
|
||
/** get the corresponding floor from the underlying model */
|
||
Floorplan::Floor* getFloor() {return floor;}
|
||
|
||
//TODO: check
|
||
MMFloorOutlinePolygon* create(Floorplan::FloorOutlinePolygon* poly) {
|
||
|
||
// add to underlying model
|
||
floor->outline.push_back(poly);
|
||
|
||
// add to myself as element
|
||
MMFloorOutlinePolygon* mm = new MMFloorOutlinePolygon(this, floor, poly);
|
||
addElement(mm);
|
||
return mm;
|
||
|
||
}
|
||
|
||
|
||
std::string getLayerName() const override {return "outline";}
|
||
|
||
};
|
||
|
||
#endif // MMFLOOROUTLINE_H
|