89 lines
2.4 KiB
C++
89 lines
2.4 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 MMFLOORFINGERPRINTLOCATIONS_H
|
||
#define MMFLOORFINGERPRINTLOCATIONS_H
|
||
|
||
|
||
#include "MapModelElement.h"
|
||
#include "IHasParams.h"
|
||
#include "IHasEditableMeta.h"
|
||
|
||
#include "../2D/MV2DElementFingerprintLocation.h"
|
||
#include "../3D/MV3DElementFingerprintLocation.h"
|
||
|
||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||
|
||
class MMFloorFingerprintLocation : public MapModelElement, public IHasParams, public IHasEditableMeta {
|
||
|
||
private:
|
||
|
||
Floorplan::Floor* floor;
|
||
Floorplan::FingerprintLocation* fpl;
|
||
MV2DElementFingerprintLocation mv2d;
|
||
MV3DElementFingerprintLocation mv3d;
|
||
|
||
public:
|
||
|
||
MMFloorFingerprintLocation(MapLayer* parent, Floorplan::Floor* floor, Floorplan::FingerprintLocation* fpl) :
|
||
MapModelElement(parent), floor(floor), fpl(fpl), mv2d(fpl), mv3d(floor, fpl) {
|
||
|
||
}
|
||
|
||
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("Position", ParamType::POINT2);
|
||
case 2: return Param("at height", ParamType::FLOAT);
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual ParamValue getParamValue(const int idx) const override {
|
||
switch(idx) {
|
||
case 0: return fpl->name;
|
||
case 1: return fpl->posOnFloor;
|
||
case 2: return fpl->heightAboveFloor;
|
||
}
|
||
throw 1;
|
||
}
|
||
|
||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||
switch(idx) {
|
||
case 0: fpl->name = val.toString(); break;
|
||
case 1: fpl->posOnFloor = val.toPoint2(); break;
|
||
case 2: fpl->heightAboveFloor = val.toFloat(); break;
|
||
}
|
||
}
|
||
|
||
virtual Floorplan::Meta* getMeta() override {
|
||
return fpl->getMeta();
|
||
}
|
||
|
||
virtual void setMeta(Floorplan::Meta* meta) override {
|
||
fpl->setMeta(meta);
|
||
}
|
||
|
||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||
|
||
void deleteMe() const override {
|
||
parent->removeElement(this);
|
||
floor->fpLocations.erase(std::remove(floor->fpLocations.begin(), floor->fpLocations.end(), fpl), floor->fpLocations.end());
|
||
}
|
||
|
||
};
|
||
|
||
#endif // MMFLOORFINGERPRINTLOCATIONS_H
|