81 lines
2.2 KiB
C++
81 lines
2.2 KiB
C++
#ifndef MAPELEMENTOBSTACLE_H
|
|
#define MAPELEMENTOBSTACLE_H
|
|
|
|
#include "MapModelElement.h"
|
|
#include "../2D/MapViewElementHelper.h"
|
|
|
|
#include "IHasMaterial.h"
|
|
#include "IHasObstacleType.h"
|
|
#include "IHasParams.h"
|
|
|
|
#include "../2D/MV2DElementFloorObstacleLine.h"
|
|
//#include "../3D/MV3DElementFloorObstacleWall.h"
|
|
|
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
|
|
|
|
|
class MMFloorObstacleLine : public MapModelElement, public IHasMaterial, public IHasObstacleType, public IHasParams {
|
|
|
|
public:
|
|
|
|
Floorplan::Floor* mf;
|
|
Floorplan::FloorObstacleLine* fo;
|
|
MV2DElementFloorObstacleLine mv2d;
|
|
//MV3DElementFloorObstacleWall mv3d;
|
|
|
|
public:
|
|
|
|
MMFloorObstacleLine(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleLine* fo) :
|
|
MapModelElement(parent), mf(mf), fo(fo), mv2d(mf, fo) {//, mv3d(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;}
|
|
//MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
|
|
|
void deleteMe() const override {
|
|
parent->removeElement(this);
|
|
mf->obstacles.erase(std::remove(mf->obstacles.begin(), mf->obstacles.end(), fo), mf->obstacles.end());
|
|
}
|
|
|
|
|
|
virtual int getNumParams() const override {
|
|
return 3;
|
|
}
|
|
|
|
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);
|
|
}
|
|
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);
|
|
}
|
|
throw 1;
|
|
}
|
|
|
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
|
switch(idx) {
|
|
case 0: fo->thickness_m = val.toFloat(); break;
|
|
case 1: fo->height_m = val.toFloat(); break;
|
|
case 2: break;
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
#endif // MAPELEMENTOBSTACLE_H
|