69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
#ifndef MMFLOORELEVATOR_H
|
|
#define MMFLOORELEVATOR_H
|
|
|
|
#include "MapModelElement.h"
|
|
#include "IHasParams.h"
|
|
|
|
#include "../2D/MV2DElementElevator.h"
|
|
//#include "../3D/MV3DElementElevator.h" TODO
|
|
|
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
|
|
|
class MMFloorElevator : public MapModelElement, public IHasParams {
|
|
|
|
private:
|
|
|
|
Floorplan::Floor* floor;
|
|
Floorplan::Elevator* elevator;
|
|
MV2DElementElevator mv2d;
|
|
//MV3DElementElevator mv3d; TODO
|
|
|
|
public:
|
|
|
|
MMFloorElevator(MapLayer* parent, Floorplan::Floor* floor, Floorplan::Elevator* elevator) :
|
|
MapModelElement(parent), floor(floor), elevator(elevator), mv2d(elevator) {
|
|
|
|
}
|
|
|
|
virtual int getNumParams() const override {
|
|
return 3;
|
|
}
|
|
|
|
virtual Param getParamDesc(const int idx) const override {
|
|
switch(idx) {
|
|
case 0: return Param("width", ParamType::FLOAT);
|
|
case 1: return Param("depth", ParamType::FLOAT);
|
|
case 2: return Param("rotation", ParamType::FLOAT);
|
|
}
|
|
throw 1;
|
|
}
|
|
|
|
virtual ParamValue getParamValue(const int idx) const override {
|
|
switch(idx) {
|
|
case 0: return elevator->width;
|
|
case 1: return elevator->depth;
|
|
case 2: return (elevator->rotation * 180.0f / (float)M_PI);
|
|
}
|
|
throw 1;
|
|
}
|
|
|
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
|
switch(idx) {
|
|
case 0: elevator->width = val.toFloat(); break;
|
|
case 1: elevator->depth = val.toFloat(); break;
|
|
case 2: elevator->rotation = val.toFloat() / 180.0f * (float)M_PI; break;
|
|
}
|
|
}
|
|
|
|
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
|
MV3DElement* getMV3D() const override {return nullptr;} // TODO
|
|
|
|
void deleteMe() const override {
|
|
parent->removeElement(this);
|
|
floor->elevators.erase(std::remove(floor->elevators.begin(), floor->elevators.end(), elevator), floor->elevators.end());
|
|
}
|
|
|
|
};
|
|
|
|
#endif // MMFLOORELEVATOR_H
|