#ifndef MAPELEMENTFLOORGROUND_H #define MAPELEMENTFLOORGROUND_H #include "IHasParams.h" #include "MapModelElement.h" #include "../elements/MV2DElementFloorOutlinePolygon.h" #include "../3D/MV3DElementFloorOutlinePolygon.h" #include /** * describes one polygon within a floor's outline */ class MMFloorOutlinePolygon : public MapModelElement, public IHasParams { private: Floorplan::Floor* mf; Floorplan::FloorOutlinePolygon* fo; MV2DElementFloorOutlinePolygon mv2d; MV3DElementFloorOutlinePolygon mv3d; public: /** ctor */ MMFloorOutlinePolygon(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorOutlinePolygon* fo) : MapModelElement(parent), mf(mf), fo(fo), mv2d(*fo), mv3d(mf, fo) { ; } Floorplan::FloorOutlinePolygon* getPolygon() {return fo;} Floorplan::OutlineMethod getMethod() const {return fo->method;} void setMethod(const Floorplan::OutlineMethod m) {this->fo->method = m;} MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;} //MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;} virtual int getNumParams() const override { return 1; } virtual Param getParamDesc(const int idx) const override { switch(idx) { case 0: return Param("name", ParamType::STRING); } throw 1; } virtual ParamValue getParamValue(const int idx) const override { switch(idx) { case 0: return fo->name; } throw 1; } virtual void setParamValue(const int idx, const ParamValue& val) const override { switch(idx) { case 0: fo->name = val.toString(); break; } } void deleteMe() const override { // delete from the parent parent->removeElement(this); // delete from the underlying model mf->outline.erase(std::remove(mf->outline.begin(), mf->outline.end(), fo), mf->outline.end()); } }; #endif // MAPELEMENTFLOORGROUND_H