many changes :P

This commit is contained in:
kazu
2016-06-06 22:08:53 +02:00
parent db6b479d86
commit 6243165084
56 changed files with 4399 additions and 245 deletions

View 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