97 lines
2.6 KiB
C++
97 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 MAPVIEWELEMENTACCESSPOINT_H
|
||
#define MAPVIEWELEMENTACCESSPOINT_H
|
||
|
||
#include "MapModelElement.h"
|
||
#include "IHasParams.h"
|
||
#include "IHasEditableMeta.h"
|
||
|
||
#include "../2D/MV2DElementAccessPoint.h"
|
||
#include "../3D/MV3DElementAccessPoint.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
class MMFloorAccessPoint : public MapModelElement, public IHasParams, public IHasEditableMeta {
|
||
|
||
private:
|
||
|
||
Floorplan::Floor* floor;
|
||
Floorplan::AccessPoint* ap;
|
||
MV2DElementAccessPoint mv2d;
|
||
MV3DElementAccessPoint mv3d;
|
||
|
||
public:
|
||
|
||
MMFloorAccessPoint(MapLayer* parent, Floorplan::Floor* floor, Floorplan::AccessPoint* ap) :
|
||
MapModelElement(parent), floor(floor), ap(ap), mv2d(ap), mv3d(floor, ap) {
|
||
|
||
}
|
||
|
||
virtual int getNumParams() const override {
|
||
return 6;
|
||
}
|
||
|
||
virtual Param getParamDesc(const int idx) const override {
|
||
switch(idx) {
|
||
case 0: return Param("name", ParamType::STRING);
|
||
case 1: return Param("MAC", ParamType::STRING);
|
||
case 2: return Param("Position", ParamType::POINT3);
|
||
case 3: return Param("TXP", ParamType::FLOAT);
|
||
case 4: return Param("EXP", ParamType::FLOAT);
|
||
case 5: return Param("WAF", ParamType::FLOAT);
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual ParamValue getParamValue(const int idx) const override {
|
||
switch(idx) {
|
||
case 0: return ap->name;
|
||
case 1: return ap->mac;
|
||
case 2: return ap->pos;
|
||
case 3: return ap->model.txp;
|
||
case 4: return ap->model.exp;
|
||
case 5: return ap->model.waf;
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||
switch(idx) {
|
||
case 0: ap->name = val.toString(); break;
|
||
case 1: ap->mac = val.toString(); break;
|
||
case 2: ap->pos = val.toPoint3(); break;
|
||
case 3: ap->model.txp = val.toFloat(); break;
|
||
case 4: ap->model.exp = val.toFloat(); break;
|
||
case 5: ap->model.waf = val.toFloat(); break;
|
||
}
|
||
}
|
||
|
||
virtual Floorplan::Meta* getMeta() override {
|
||
return ap->getMeta();
|
||
}
|
||
|
||
virtual void setMeta(Floorplan::Meta* meta) override {
|
||
ap->setMeta(meta);
|
||
}
|
||
|
||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||
|
||
void deleteMe() const override {
|
||
parent->removeElement(this);
|
||
floor->accesspoints.erase(std::remove(floor->accesspoints.begin(), floor->accesspoints.end(), ap), floor->accesspoints.end());
|
||
}
|
||
|
||
};
|
||
|
||
#endif // MAPVIEWELEMENTACCESSPOINT_H
|