85 lines
2.1 KiB
C++
85 lines
2.1 KiB
C++
#ifndef MAPELEMENTFLOORGROUND_H
|
|
#define MAPELEMENTFLOORGROUND_H
|
|
|
|
#include "IHasParams.h"
|
|
#include "MapModelElement.h"
|
|
|
|
#include "../2D/MV2DElementFloorOutlinePolygon.h"
|
|
|
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
|
|
|
#include "EElementParams.h"
|
|
|
|
/**
|
|
* describes one polygon within a floor's outline
|
|
*/
|
|
class MMFloorOutlinePolygon : public MapModelElement, public IHasParams {
|
|
|
|
private:
|
|
|
|
Floorplan::Floor* mf;
|
|
Floorplan::FloorOutlinePolygon* fo;
|
|
MV2DElementFloorOutlinePolygon mv2d;
|
|
// MV3DElementFloorOutlinePolygon mv3d;
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
MMFloorOutlinePolygon(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorOutlinePolygon* fo) :
|
|
MapModelElement(parent), mf(mf), fo(fo), mv2d(*fo) {
|
|
;
|
|
}
|
|
|
|
Floorplan::FloorOutlinePolygon* getPolygon() {return fo;}
|
|
|
|
// Floorplan::OutlineMethod getMethod() const {return fo->method;}
|
|
// void setMethod(const Floorplan::OutlineMethod m) {this->fo->method = m;}
|
|
|
|
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
|
//MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
|
|
|
virtual int getNumParams() const override {
|
|
return 3;
|
|
}
|
|
|
|
virtual Param getParamDesc(const int idx) const override {
|
|
switch(idx) {
|
|
case 0: return Param("name", ParamType::STRING);
|
|
case 1: return Param("method", ParamType::ENUM, getOutlineMethodStrings());
|
|
case 2: return Param("outdoor", ParamType::BOOL);
|
|
}
|
|
throw 1;
|
|
}
|
|
|
|
virtual ParamValue getParamValue(const int idx) const override {
|
|
switch(idx) {
|
|
case 0: return fo->name;
|
|
case 1: return (int) fo->method;
|
|
case 2: return fo->outdoor;
|
|
}
|
|
throw 1;
|
|
}
|
|
|
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
|
switch(idx) {
|
|
case 0: fo->name = val.toString(); break;
|
|
case 1: fo->method = (Floorplan::OutlineMethod) val.toInt(); break;
|
|
case 2: fo->outdoor = val.toBool(); break;
|
|
}
|
|
}
|
|
|
|
void deleteMe() const override {
|
|
|
|
// delete from the parent
|
|
parent->removeElement(this);
|
|
|
|
// delete from the underlying model
|
|
mf->outline.erase(std::remove(mf->outline.begin(), mf->outline.end(), fo), mf->outline.end());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
#endif // MAPELEMENTFLOORGROUND_H
|