many changes :P
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#ifndef IHASATTRIBUTES_H
|
||||
#define IHASATTRIBUTES_H
|
||||
|
||||
#include <string>
|
||||
//#include <string>
|
||||
|
||||
class IHasAttributes {
|
||||
//class IHasAttributes {
|
||||
|
||||
public:
|
||||
//public:
|
||||
|
||||
/** set the value for the given key */
|
||||
virtual void setAttribute(const std::string& key, const std::string& val) = 0;
|
||||
// /** set the value for the given key */
|
||||
// virtual void setAttribute(const std::string& key, const std::string& val) = 0;
|
||||
|
||||
/** get the value for the given key */
|
||||
virtual const std::string& getAttribute(const std::string& key) const = 0;
|
||||
// /** get the value for the given key */
|
||||
// virtual const std::string& getAttribute(const std::string& key) const = 0;
|
||||
|
||||
/** get all attributes as map */
|
||||
virtual const std::unordered_map<std::string, std::string> getAttributes() const = 0;
|
||||
// /** get all attributes as map */
|
||||
// virtual const std::unordered_map<std::string, std::string> getAttributes() const = 0;
|
||||
|
||||
};
|
||||
//};
|
||||
|
||||
#endif // IHASATTRIBUTES_H
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#ifndef IHASFILE_H
|
||||
#define IHASFILE_H
|
||||
|
||||
#include <string>
|
||||
//#include <string>
|
||||
|
||||
class IHasFile {
|
||||
//class IHasFile {
|
||||
|
||||
public:
|
||||
//public:
|
||||
|
||||
virtual void setFileName(const std::string& file) = 0;
|
||||
// virtual void setFileName(const std::string& file) = 0;
|
||||
|
||||
virtual const std::string& getFileName() const = 0;
|
||||
// virtual const std::string& getFileName() const = 0;
|
||||
|
||||
};
|
||||
//};
|
||||
|
||||
|
||||
#endif // IHASFILE_H
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef IHASMAC_H
|
||||
#define IHASMAC_H
|
||||
|
||||
#include <string>
|
||||
//#include <string>
|
||||
|
||||
class IHasMAC {
|
||||
public:
|
||||
//class IHasMAC {
|
||||
//public:
|
||||
|
||||
virtual void setMAC(const std::string& mac) = 0;
|
||||
// virtual void setMAC(const std::string& mac) = 0;
|
||||
|
||||
virtual const std::string& getMAC() const = 0;
|
||||
// virtual const std::string& getMAC() const = 0;
|
||||
|
||||
};
|
||||
//};
|
||||
|
||||
#endif // IHASMAC_H
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
#define IHASPARAMS_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include <QVariant>
|
||||
#include <Indoor/geo/Point2.h>
|
||||
#include <Indoor/geo/Point3.h>
|
||||
|
||||
enum class ParamType {
|
||||
INT,
|
||||
FLOAT,
|
||||
STRING,
|
||||
FILE,
|
||||
POINT2,
|
||||
POINT3,
|
||||
};
|
||||
|
||||
class ParamValue {
|
||||
@@ -17,6 +20,7 @@ private:
|
||||
union {
|
||||
int _int;
|
||||
float _float;
|
||||
float _arr[3];
|
||||
};
|
||||
std::string _str;
|
||||
|
||||
@@ -29,7 +33,11 @@ public:
|
||||
void setValue(const std::string& val) {_str = val;}
|
||||
void setValue(float val) {_float = val;}
|
||||
void setValue(int val) {_int = val;}
|
||||
void setValue(Point2 p) {_arr[0] = p.x; _arr[1] = p.y;}
|
||||
void setValue(Point3 p) {_arr[0] = p.x; _arr[1] = p.y; _arr[2] = p.z;}
|
||||
|
||||
Point2 toPoint2() const {return Point2(_arr[0], _arr[1]);}
|
||||
Point3 toPoint3() const {return Point3(_arr[0], _arr[1], _arr[2]);}
|
||||
std::string toString() const {return _str;}
|
||||
float toFloat() const {return _float;}
|
||||
int toInt() const {return _int;}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#ifndef IHASPOSITION3D_H
|
||||
#define IHASPOSITION3D_H
|
||||
|
||||
//#include <Indoor/geo/Point3.h>
|
||||
|
||||
#include <Indoor/geo/Point3.h>
|
||||
//class IHasPosition3D {
|
||||
|
||||
class IHasPosition3D {
|
||||
//public:
|
||||
|
||||
public:
|
||||
// /** set the element's 3D position */
|
||||
// virtual void setPosition3D(const Point3& p) = 0;
|
||||
|
||||
/** set the element's 3D position */
|
||||
virtual void setPosition3D(const Point3& p) = 0;
|
||||
// /** get the element's 3D position */
|
||||
// virtual Point3 getPosition3D() const = 0;
|
||||
|
||||
/** get the element's 3D position */
|
||||
virtual Point3 getPosition3D() const = 0;
|
||||
|
||||
};
|
||||
//};
|
||||
|
||||
#endif // IHASPOSITION3D_H
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
#include "MMFloorObstacles.h"
|
||||
#include "MMFloorAccessPoints.h"
|
||||
#include "MMFloorBeacons.h"
|
||||
#include "MMFloorUnderlay.h"
|
||||
#include "MMFloorUnderlays.h"
|
||||
#include "MMFloorPOIs.h"
|
||||
|
||||
#include "IHasParams.h"
|
||||
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
@@ -16,7 +19,7 @@
|
||||
* floor-layer containing one floor
|
||||
* and its outline, obstacles, access-points, ...
|
||||
*/
|
||||
class MMFloor : public MapLayer, public IHasName {
|
||||
class MMFloor : public MapLayer, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
@@ -28,11 +31,13 @@ public:
|
||||
/** ctor. existing floor */
|
||||
MMFloor(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR), floor(floor) {
|
||||
|
||||
new MMFloorOutline(this, floor);
|
||||
new MMFloorUnderlays(this, floor);
|
||||
elements.push_back(new MMFloorOutline(this, floor));
|
||||
new MMFloorObstacles(this, floor);
|
||||
new MMFloorAccessPoints(this, floor);
|
||||
new MMFloorBeacons(this, floor);
|
||||
new MMFloorUnderlay(this, floor);
|
||||
new MMFloorPOIs(this, floor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,9 +52,29 @@ public:
|
||||
|
||||
std::string getLayerName() const override {return floor->name;}
|
||||
|
||||
virtual int getNumParams() const override {
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual void setName(const std::string& name) {this->floor->name = name;}
|
||||
virtual const std::string& getName() const {return this->floor->name;}
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return Param("anem", ParamType::STRING);
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return floor->name;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
||||
switch(idx) {
|
||||
case 0: floor->name = val.toString(); break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -2,35 +2,61 @@
|
||||
#define MAPVIEWELEMENTACCESSPOINT_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "IHasMAC.h"
|
||||
#include "IHasName.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../elements/MV2DElementAccessPoint.h"
|
||||
#include "../3D/MV3DElementAccessPoint.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorAccessPoint : public MapModelElement, public IHasMAC, public IHasName {
|
||||
class MMFloorAccessPoint : public MapModelElement, public IHasParams {
|
||||
|
||||
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) {
|
||||
MapModelElement(parent), floor(floor), ap(ap), mv2d(ap), mv3d(floor, ap) {
|
||||
|
||||
}
|
||||
|
||||
virtual void setMAC(const std::string& mac) override {ap->mac = mac;}
|
||||
virtual const std::string& getMAC() const override {return ap->mac;}
|
||||
virtual int getNumParams() const override {
|
||||
return 3;
|
||||
}
|
||||
|
||||
virtual void setName(const std::string& name) override {ap->name = name;}
|
||||
virtual const std::string& getName() const override {return ap->name;}
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
||||
switch(idx) {
|
||||
case 0: ap->name = val.toString(); break;
|
||||
case 1: ap->mac = val.toString(); break;
|
||||
case 2: ap->pos = val.toPoint3(); break;
|
||||
}
|
||||
}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
// add all APs
|
||||
for (Floorplan::AccessPoint* ap : floor->accesspoints) {
|
||||
new MMFloorAccessPoint(this, floor, ap);
|
||||
elements.push_back(new MMFloorAccessPoint(this, floor, ap));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
#define MAPVIEWELEMENTIBEACON_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "IHasMAC.h"
|
||||
#include "IHasName.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../elements/MV2DElementBeacon.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorBeacon : public MapModelElement, public IHasMAC, public IHasName {
|
||||
class MMFloorBeacon : public MapModelElement, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
@@ -20,14 +19,38 @@ private:
|
||||
public:
|
||||
|
||||
MMFloorBeacon(MapLayer* parent, Floorplan::Floor* floor, Floorplan::Beacon* b) : MapModelElement(parent), floor(floor), b(b), mv2d(b) {
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
virtual void setMAC(const std::string& mac) override {b->mac = mac;}
|
||||
virtual const std::string& getMAC() const override {return b->mac;}
|
||||
virtual int getNumParams() const override {
|
||||
return 3;
|
||||
}
|
||||
|
||||
virtual void setName(const std::string& name) override {b->name = name;}
|
||||
virtual const std::string& getName() const override {return b->name;}
|
||||
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);
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return b->name;
|
||||
case 1: return b->mac;
|
||||
case 2: return b->pos;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
||||
switch(idx) {
|
||||
case 0: b->name = val.toString(); break;
|
||||
case 1: b->mac = val.toString(); break;
|
||||
case 2: b->pos = val.toPoint3(); break;
|
||||
}
|
||||
}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
// add all Beacons
|
||||
for (Floorplan::Beacon* b : floor->beacons) {
|
||||
new MMFloorBeacon(this, floor, b);
|
||||
elements.push_back(new MMFloorBeacon(this, floor, b));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "IHasObstacleType.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorObstacleLine.h"
|
||||
#include "../3D/MV3DElementFloorObstacleWall.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
@@ -19,11 +20,12 @@ public:
|
||||
Floorplan::Floor* mf;
|
||||
Floorplan::FloorObstacleLine* fo;
|
||||
MV2DElementFloorObstacleLine mv2d;
|
||||
MV3DElementFloorObstacleWall mv3d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorObstacleLine(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleLine* fo) :
|
||||
MapModelElement(parent), mf(mf), fo(fo), mv2d(fo) {
|
||||
MapModelElement(parent), mf(mf), fo(fo), mv2d(fo), mv3d(mf,fo) {
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +36,7 @@ public:
|
||||
Floorplan::ObstacleType getObatcleType() const override {return fo->type;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorOutlinePolygon.h"
|
||||
#include "../3D/MV3DElementFloorOutline.h"
|
||||
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
@@ -10,17 +11,20 @@
|
||||
/**
|
||||
* layer containing all elements describing a floor's outline
|
||||
*/
|
||||
class MMFloorOutline : public MapLayer {
|
||||
class MMFloorOutline : public MapLayer, public MapModelElement {
|
||||
|
||||
private:
|
||||
|
||||
/** the underlying model */
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
MV3DElementFloorOutline mv3d;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the underlying model */
|
||||
MMFloorOutline(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_GROUND), floor(floor) {
|
||||
MMFloorOutline(MapLayer* parent, Floorplan::Floor* floor) :
|
||||
MapLayer(parent, MapLayerType::FLOOR_GROUND), MapModelElement(parent), floor(floor), mv3d(floor, &floor->outline) {
|
||||
|
||||
// the outline
|
||||
for (Floorplan::FloorOutlinePolygon* poly : floor->outline) {
|
||||
@@ -29,6 +33,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
|
||||
/** get the corresponding floor from the underlying model */
|
||||
Floorplan::Floor* getFloor() {return floor;}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef MAPELEMENTFLOORGROUND_H
|
||||
#define MAPELEMENTFLOORGROUND_H
|
||||
|
||||
#include "IHasName.h"
|
||||
#include "IHasParams.h"
|
||||
#include "MapModelElement.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorOutlinePolygon.h"
|
||||
#include "../3D/MV3DElementFloorOutlinePolygon.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
@@ -12,18 +13,20 @@
|
||||
/**
|
||||
* describes one polygon within a floor's outline
|
||||
*/
|
||||
class MMFloorOutlinePolygon : public MapModelElement, public IHasName {
|
||||
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) {
|
||||
MMFloorOutlinePolygon(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorOutlinePolygon* fo) :
|
||||
MapModelElement(parent), mf(mf), fo(fo), mv2d(*fo), mv3d(mf, fo) {
|
||||
;
|
||||
}
|
||||
|
||||
@@ -32,10 +35,32 @@ public:
|
||||
Floorplan::OutlineMethod getMethod() const {return fo->method;}
|
||||
void setMethod(const Floorplan::OutlineMethod m) {this->fo->method = m;}
|
||||
|
||||
void setName(const std::string& name) override {fo->name = name;}
|
||||
const std::string& getName() const override {return fo->name;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
//MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
virtual int getNumParams() const override {
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return Param("anem", ParamType::STRING);
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return fo->name;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
||||
switch(idx) {
|
||||
case 0: fo->name = val.toString(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void deleteMe() const override {
|
||||
|
||||
|
||||
65
mapview/model/MMFloorPOI.h
Normal file
65
mapview/model/MMFloorPOI.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef MMFLOORPOI_H
|
||||
#define MMFLOORPOI_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../elements/MV2DElementPOI.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorPOI : public MapModelElement, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
Floorplan::POI* poi;
|
||||
MV2DElementPOI mv2d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorPOI(MapLayer* parent, Floorplan::Floor* floor, Floorplan::POI* poi) : MapModelElement(parent), floor(floor), poi(poi), mv2d(poi) {
|
||||
;
|
||||
}
|
||||
|
||||
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("type", ParamType::INT);
|
||||
case 2: return Param("position", ParamType::POINT2);
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return poi->name;
|
||||
case 1: return (int) poi->type;
|
||||
case 2: return poi->pos;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
||||
switch(idx) {
|
||||
case 0: poi->name = val.toString(); break;
|
||||
case 1: poi->type = (Floorplan::POIType) val.toInt(); break;
|
||||
case 2: poi->pos = val.toPoint2(); break;
|
||||
}
|
||||
}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
floor->pois.erase(std::remove(floor->pois.begin(), floor->pois.end(), poi), floor->pois.end());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // MMFLOORPOI_H
|
||||
46
mapview/model/MMFloorPOIs.h
Normal file
46
mapview/model/MMFloorPOIs.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef MMFLOORPOIS_H
|
||||
#define MMFLOORPOIS_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorPOI.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer that contains all of one floor's POIs
|
||||
*/
|
||||
class MMFloorPOIs : public MapLayer {
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the floor */
|
||||
MMFloorPOIs(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_POIS), floor(floor) {
|
||||
|
||||
// the POIs
|
||||
for (Floorplan::POI* poi : floor->pois) {
|
||||
elements.push_back(new MMFloorPOI(this, floor, poi));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** get the corresponding floor from the underlying model */
|
||||
Floorplan::Floor* getFloor() {return floor;}
|
||||
|
||||
//TODO: check
|
||||
void createPOI(Floorplan::POI* poi) {
|
||||
|
||||
// add to underlying model
|
||||
floor->pois.push_back(poi);
|
||||
|
||||
// add to myself as element
|
||||
elements.push_back(new MMFloorPOI(this, floor, poi));
|
||||
|
||||
}
|
||||
|
||||
std::string getLayerName() const override {return "POIs";}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOORPOIS_H
|
||||
@@ -2,7 +2,6 @@
|
||||
#define MMFLOORUNDERLAYIMAGE_H
|
||||
|
||||
|
||||
#include "IHasFile.h"
|
||||
#include "IHasParams.h"
|
||||
#include "MapModelElement.h"
|
||||
|
||||
@@ -12,7 +11,7 @@
|
||||
/**
|
||||
* add an external image file as underlay (to copy it onto the map)
|
||||
*/
|
||||
class MMFloorUnderlayImage : public MapModelElement, public MapLayer, public IHasFile, public IHasParams {
|
||||
class MMFloorUnderlayImage : public MapModelElement, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,19 +23,15 @@ private:
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MMFloorUnderlayImage(MapLayer* parent, Floorplan::Floor* floor, Floorplan::UnderlayImage* img) : MapModelElement(parent), MapLayer(parent, MapLayerType::FLOOR_UNDERLAY), floor(floor), img(img), mv2d(img) {
|
||||
setFileName(img->filename);
|
||||
MMFloorUnderlayImage(MapLayer* parent, Floorplan::Floor* floor, Floorplan::UnderlayImage* img) : MapModelElement(parent), floor(floor), img(img), mv2d(img) {
|
||||
;
|
||||
}
|
||||
|
||||
virtual void setFileName(const std::string& file) {img->filename = file;}
|
||||
virtual const std::string& getFileName() const {return img->filename;}
|
||||
|
||||
void setAnchor(const Point2 anchor) {img->anchor = anchor;}
|
||||
Point2 getAnchor() const {return img->anchor;}
|
||||
|
||||
void setScale(const float x, const float y) {img->scaleX = x; img->scaleY = y;}
|
||||
|
||||
virtual std::string getLayerName() const override {return "underlay";}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
@@ -44,13 +39,14 @@ public:
|
||||
;
|
||||
}
|
||||
|
||||
int getNumParams() const override {return 3;}
|
||||
int getNumParams() const override {return 4;}
|
||||
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch (idx) {
|
||||
case 0: return Param("file", ParamType::FILE);
|
||||
case 1: return Param("scale X", ParamType::FLOAT);
|
||||
case 2: return Param("scale Y", ParamType::FLOAT);
|
||||
case 3: return Param("Anchor", ParamType::POINT2);
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
@@ -60,15 +56,17 @@ public:
|
||||
case 0: return ParamValue(img->filename);
|
||||
case 1: return ParamValue(img->scaleX);
|
||||
case 2: return ParamValue(img->scaleY);
|
||||
case 3: return ParamValue(img->anchor);
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
||||
switch (idx) {
|
||||
case 0: img->filename = val.toString();
|
||||
case 1: img->scaleX = val.toFloat();
|
||||
case 2: img->scaleY = val.toFloat();
|
||||
case 0: img->filename = val.toString(); break;
|
||||
case 1: img->scaleX = val.toFloat(); break;
|
||||
case 2: img->scaleY = val.toFloat(); break;
|
||||
case 3: img->anchor = val.toPoint2(); break;
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/**
|
||||
* add an external file as underlay (to copy it onto the map)
|
||||
*/
|
||||
class MMFloorUnderlay : public MapLayer {
|
||||
class MMFloorUnderlays : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,7 +19,7 @@ private:
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MMFloorUnderlay(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_UNDERLAY), floor(floor) {
|
||||
MMFloorUnderlays(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_UNDERLAYS), floor(floor) {
|
||||
|
||||
// the underlays
|
||||
for (Floorplan::UnderlayImage* img : floor->underlays) {
|
||||
@@ -17,7 +17,8 @@ enum class MapLayerType {
|
||||
FLOOR_OBSTACLES,
|
||||
FLOOR_BEACONS,
|
||||
FLOOR_ACCESS_POINTS,
|
||||
FLOOR_UNDERLAY,
|
||||
FLOOR_UNDERLAYS,
|
||||
FLOOR_POIS,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ public:
|
||||
|
||||
}
|
||||
|
||||
/** get the constructed map */
|
||||
Floorplan::IndoorMap* getMap() const {
|
||||
return im;
|
||||
}
|
||||
|
||||
/** get the map's root-layer containing all other layers */
|
||||
MapLayer* getRootLayer() { return root; }
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "MapLayer.h"
|
||||
|
||||
class MV2DElement;
|
||||
class MV3DElement;
|
||||
|
||||
class MapModelElement {
|
||||
|
||||
@@ -21,10 +22,13 @@ public:
|
||||
virtual ~MapModelElement() {;}
|
||||
|
||||
/** get the 2D interaction class for this element */
|
||||
virtual MV2DElement* getMV2D() const = 0;
|
||||
virtual MV2DElement* getMV2D() const {return nullptr;}
|
||||
|
||||
/** get the 3D interaction class for this element */
|
||||
virtual MV3DElement* getMV3D() const {return nullptr;}
|
||||
|
||||
/** delete this element from the model */
|
||||
virtual void deleteMe() const = 0;
|
||||
virtual void deleteMe() const {;}
|
||||
|
||||
/** get the parent element */
|
||||
MapLayer* getParent() const {return parent;}
|
||||
|
||||
Reference in New Issue
Block a user