#ifndef MAPELEMENTOBSTACLE_H #define MAPELEMENTOBSTACLE_H #include "MapModelElement.h" #include "../2D/MapViewElementHelper.h" #include "EElementParams.h" #include "IHasParams.h" #include "../2D/MV2DElementFloorObstacleLine.h" #include class MMFloorObstacleLine : public MapModelElement, public IHasParams { public: Floorplan::Floor* mf; Floorplan::FloorObstacleLine* fo; MV2DElementFloorObstacleLine mv2d; public: MMFloorObstacleLine(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleLine* fo) : MapModelElement(parent), mf(mf), fo(fo), mv2d(mf, fo) { ; } // void setMaterial(const Floorplan::Material m) override {fo->material = m;} // Floorplan::Material getMaterial() const override {return fo->material;} // void setObstacleType(const Floorplan::ObstacleType t) override {fo->type = t;} // Floorplan::ObstacleType getObatcleType() const override {return fo->type;} MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;} void deleteMe() const override { parent->removeElement(this); mf->obstacles.erase(std::remove(mf->obstacles.begin(), mf->obstacles.end(), fo), mf->obstacles.end()); } int getNumParams() const override { return 5; } virtual Param getParamDesc(const int idx) const override { switch(idx) { case 0: return Param("thickness (m)", ParamType::FLOAT); case 1: return Param("height (m)", ParamType::FLOAT); case 2: return Param("length", ParamType::FLOAT, true); case 3: return Param("material", ParamType::ENUM, getMaterialStrings()); case 4: return Param("type", ParamType::ENUM, getObstacleTypeStrings()); } throw 1; } virtual ParamValue getParamValue(const int idx) const override { switch(idx) { case 0: return fo->thickness_m; case 1: return fo->height_m; case 2: return fo->from.getDistance(fo->to); case 3: return (int) fo->material; case 4: return (int) fo->type; } throw 1; } virtual void setParamValue(const int idx, const ParamValue& val) override { switch(idx) { case 0: fo->thickness_m = val.toFloat(); return; case 1: fo->height_m = val.toFloat(); return; case 2: return; case 3: fo->material = (Floorplan::Material) val.toInt(); return; case 4: fo->type = (Floorplan::ObstacleType) val.toInt(); return; } } }; #endif // MAPELEMENTOBSTACLE_H