82 lines
2.3 KiB
C++
82 lines
2.3 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 MMFLOORELEVATOR_H
|
||
#define MMFLOORELEVATOR_H
|
||
|
||
#include "MapModelElement.h"
|
||
#include "IHasParams.h"
|
||
|
||
#include "../2D/MV2DElementElevator.h"
|
||
#include "../3D/MV3DElementElevator.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
class MMFloorElevator : public MapModelElement, public IHasParams {
|
||
|
||
private:
|
||
|
||
Floorplan::Floor* floor;
|
||
Floorplan::Elevator* elevator;
|
||
MV2DElementElevator mv2d;
|
||
MV3DElementElevator mv3d;
|
||
|
||
public:
|
||
|
||
MMFloorElevator(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::Floor* floor, Floorplan::Elevator* elevator) :
|
||
MapModelElement(parent), floor(floor), elevator(elevator), mv2d(map, floor, elevator), mv3d(floor, elevator) {
|
||
|
||
}
|
||
|
||
virtual int getNumParams() const override {
|
||
return 4;
|
||
}
|
||
|
||
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("height", ParamType::FLOAT);
|
||
case 3: 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->height_m;
|
||
case 3: 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->height_m = val.toFloat(); break;
|
||
case 3: elevator->rotation = val.toFloat() / 180.0f * (float)M_PI; break;
|
||
}
|
||
}
|
||
|
||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||
|
||
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
|