81 lines
2.1 KiB
C++
81 lines
2.1 KiB
C++
#ifndef MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
|
#define MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
|
|
|
|
|
#include "MapModelElement.h"
|
|
#include "../2D/MapViewElementHelper.h"
|
|
|
|
#include "IHasMaterial.h"
|
|
#include "IHasObstacleType.h"
|
|
|
|
#include "IHasParams.h"
|
|
|
|
#include "../2D/MV2DElementFloorObstacleCircle.h"
|
|
|
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
|
|
|
|
|
class MMFloorObstacleCircle : public MapModelElement, public IHasMaterial, public IHasParams {
|
|
|
|
private:
|
|
|
|
Floorplan::Floor* mf;
|
|
Floorplan::FloorObstacleCircle* c;
|
|
MV2DElementFloorObstacleCircle mv2d;
|
|
|
|
public:
|
|
|
|
MMFloorObstacleCircle(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleCircle* c) :
|
|
MapModelElement(parent), mf(mf), c(c), mv2d(c) {
|
|
|
|
}
|
|
|
|
void setMaterial(const Floorplan::Material m) override {c->material = m;}
|
|
Floorplan::Material getMaterial() const override {return c->material;}
|
|
|
|
// void setObstacleType(const Floorplan::ObstacleType t) override {c->type = t;}
|
|
// Floorplan::ObstacleType getObatcleType() const override {return c->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(), c), mf->obstacles.end());
|
|
}
|
|
|
|
/** get the number of parameters */
|
|
int getNumParams() const override {
|
|
return 2;
|
|
}
|
|
|
|
/** get the description of the idx-th parameter */
|
|
virtual Param getParamDesc(const int idx) const override {
|
|
switch (idx) {
|
|
case 0: return Param("radius", ParamType::FLOAT);
|
|
case 1: return Param("height", ParamType::FLOAT);
|
|
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 c->radius;
|
|
case 1: return c->height;
|
|
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: c->radius = val.toFloat(); break;
|
|
case 1: c->height = val.toFloat(); break;
|
|
default: throw Exception("out of bounds");
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
#endif // MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|