93 lines
2.6 KiB
C++
93 lines
2.6 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
||
#define MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
||
|
||
|
||
#include "MapModelElement.h"
|
||
#include "../2D/MapViewElementHelper.h"
|
||
|
||
#include "EElementParams.h"
|
||
|
||
#include "IHasParams.h"
|
||
|
||
#include "../2D/MV2DElementFloorObstacleCircle.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
|
||
class MMFloorObstacleCircle : public MapModelElement, 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 3;
|
||
}
|
||
|
||
/** 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);
|
||
case 2: return Param("material", ParamType::ENUM, getMaterialStrings());
|
||
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;
|
||
case 2: return (int) c->material;
|
||
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;
|
||
case 2: c->material = (Floorplan::Material) val.toInt(); break;
|
||
default: throw Exception("out of bounds");
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
#endif // MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|