many changes :P
This commit is contained in:
65
mapview/model/MMFloorPOI.h
Normal file
65
mapview/model/MMFloorPOI.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef MMFLOORPOI_H
|
||||
#define MMFLOORPOI_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../elements/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) const 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
|
||||
Reference in New Issue
Block a user