80 lines
2.1 KiB
C++
80 lines
2.1 KiB
C++
#ifndef MMFLOOROBSTACLEOBJECT_H
|
|
#define MMFLOOROBSTACLEOBJECT_H
|
|
|
|
|
|
#include "MapModelElement.h"
|
|
#include "../2D/MapViewElementHelper.h"
|
|
|
|
#include "IHasMaterial.h"
|
|
#include "IHasDoorType.h"
|
|
#include "IHasParams.h"
|
|
|
|
#include "../2D/MV2DElementFloorObstacleObject.h"
|
|
#include "../3D/MV3DElementFloorObstacleObject.h"
|
|
|
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
|
|
|
|
|
class MMFloorObstacleObject : public MapModelElement, public IHasParams {
|
|
|
|
public:
|
|
|
|
Floorplan::Floor* mf;
|
|
Floorplan::FloorObstacleObject* fo;
|
|
MV2DElementFloorObstacleObject mv2d;
|
|
MV3DElementFloorObstacleObject mv3d;
|
|
|
|
public:
|
|
|
|
MMFloorObstacleObject(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleObject* fo) :
|
|
MapModelElement(parent), mf(mf), fo(fo), mv2d(fo), mv3d(mf,fo) {
|
|
|
|
}
|
|
|
|
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());
|
|
}
|
|
|
|
/** get the number of parameters */
|
|
int getNumParams() const override {
|
|
return 3;
|
|
}
|
|
|
|
/** get the description of the idx-th parameter */
|
|
virtual Param getParamDesc(const int idx) const override {
|
|
switch (idx) {
|
|
case 0: return Param("file", ParamType::STRING);
|
|
case 1: return Param("pos", ParamType::POINT3);
|
|
case 2: return Param("rot", ParamType::POINT3);
|
|
default: throw Exception("out of bounds");
|
|
}
|
|
}
|
|
|
|
/** get the idx-th param's value */
|
|
virtual ParamValue getParamValue(const int idx) const override {
|
|
switch(idx) {
|
|
case 0: return fo->file;
|
|
case 1: return fo->pos;
|
|
case 2: return fo->rot;
|
|
default: throw Exception("out of bounds");
|
|
}
|
|
}
|
|
|
|
/** set the idx-th param's value */
|
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
|
switch (idx) {
|
|
case 0: fo->file = val.toString(); break;
|
|
case 1: fo->pos = val.toPoint3(); break;
|
|
case 2: fo->rot = val.toPoint3(); break;
|
|
default: throw Exception("out of bounds");
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
#endif // MMFLOOROBSTACLEOBJECT_H
|