76 lines
1.8 KiB
C++
76 lines
1.8 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 MMFLOORPOI_H
|
||
#define MMFLOORPOI_H
|
||
|
||
#include "MapModelElement.h"
|
||
#include "IHasParams.h"
|
||
|
||
#include "../2D/MV2DElementPOI.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
class MMFloorPOI : public MapModelElement, public IHasParams {
|
||
|
||
private:
|
||
|
||
Floorplan::Floor* floor;
|
||
Floorplan::POI* poi;
|
||
MV2DElementPOI mv2d;
|
||
|
||
public:
|
||
|
||
MMFloorPOI(MapLayer* parent, Floorplan::Floor* floor, Floorplan::POI* poi) : MapModelElement(parent), floor(floor), poi(poi), mv2d(poi) {
|
||
;
|
||
}
|
||
|
||
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("type", ParamType::INT);
|
||
case 2: return Param("position", ParamType::POINT2);
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual ParamValue getParamValue(const int idx) const override {
|
||
switch(idx) {
|
||
case 0: return poi->name;
|
||
case 1: return (int) poi->type;
|
||
case 2: return poi->pos;
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||
switch(idx) {
|
||
case 0: poi->name = val.toString(); break;
|
||
case 1: poi->type = (Floorplan::POIType) val.toInt(); break;
|
||
case 2: poi->pos = val.toPoint2(); break;
|
||
}
|
||
}
|
||
|
||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||
|
||
void deleteMe() const override {
|
||
parent->removeElement(this);
|
||
floor->pois.erase(std::remove(floor->pois.begin(), floor->pois.end(), poi), floor->pois.end());
|
||
}
|
||
|
||
};
|
||
|
||
|
||
#endif // MMFLOORPOI_H
|