initial commit
This commit is contained in:
21
mapview/model/IHasAttributes.h
Normal file
21
mapview/model/IHasAttributes.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef IHASATTRIBUTES_H
|
||||
#define IHASATTRIBUTES_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class IHasAttributes {
|
||||
|
||||
public:
|
||||
|
||||
/** 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 all attributes as map */
|
||||
virtual const std::unordered_map<std::string, std::string> getAttributes() const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // IHASATTRIBUTES_H
|
||||
17
mapview/model/IHasFile.h
Normal file
17
mapview/model/IHasFile.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef IHASFILE_H
|
||||
#define IHASFILE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class IHasFile {
|
||||
|
||||
public:
|
||||
|
||||
virtual void setFileName(const std::string& file) = 0;
|
||||
|
||||
virtual const std::string& getFileName() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // IHASFILE_H
|
||||
15
mapview/model/IHasMAC.h
Normal file
15
mapview/model/IHasMAC.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IHASMAC_H
|
||||
#define IHASMAC_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class IHasMAC {
|
||||
public:
|
||||
|
||||
virtual void setMAC(const std::string& mac) = 0;
|
||||
|
||||
virtual const std::string& getMAC() const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // IHASMAC_H
|
||||
15
mapview/model/IHasMaterial.h
Normal file
15
mapview/model/IHasMaterial.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IHASMATERIAL_H
|
||||
#define IHASMATERIAL_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class IHasMaterial {
|
||||
public:
|
||||
|
||||
virtual void setMaterial(const Floorplan::Material m) = 0;
|
||||
|
||||
virtual Floorplan::Material getMaterial() const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // IHASMATERIAL_H
|
||||
15
mapview/model/IHasName.h
Normal file
15
mapview/model/IHasName.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IHASNAME_H
|
||||
#define IHASNAME_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class IHasName {
|
||||
public:
|
||||
|
||||
virtual void setName(const std::string& name) = 0;
|
||||
|
||||
virtual const std::string& getName() const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // IHASNAME_H
|
||||
16
mapview/model/IHasObstacleType.h
Normal file
16
mapview/model/IHasObstacleType.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef IHASOBSTACLETYPE_H
|
||||
#define IHASOBSTACLETYPE_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class IHasObstacleType {
|
||||
public:
|
||||
|
||||
virtual void setObstacleType(const Floorplan::ObstacleType t) = 0;
|
||||
|
||||
virtual Floorplan::ObstacleType getObatcleType() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // IHASOBSTACLETYPE_H
|
||||
84
mapview/model/IHasParams.h
Normal file
84
mapview/model/IHasParams.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#ifndef IHASPARAMS_H
|
||||
#define IHASPARAMS_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include <QVariant>
|
||||
|
||||
enum class ParamType {
|
||||
INT,
|
||||
FLOAT,
|
||||
STRING,
|
||||
FILE,
|
||||
};
|
||||
|
||||
class ParamValue {
|
||||
|
||||
private:
|
||||
union {
|
||||
int _int;
|
||||
float _float;
|
||||
};
|
||||
std::string _str;
|
||||
|
||||
public:
|
||||
|
||||
template <typename T> ParamValue(const T val) {
|
||||
setValue(val);
|
||||
}
|
||||
|
||||
void setValue(const std::string& val) {_str = val;}
|
||||
void setValue(float val) {_float = val;}
|
||||
void setValue(int val) {_int = val;}
|
||||
|
||||
std::string toString() const {return _str;}
|
||||
float toFloat() const {return _float;}
|
||||
int toInt() const {return _int;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//union ParamValue {
|
||||
|
||||
// int _int;
|
||||
// float _float;
|
||||
// std::string _string;
|
||||
|
||||
// template <typename T> ParamValue(const T val) {
|
||||
// setValue(val);
|
||||
// }
|
||||
|
||||
// int toInt() const {return _int;}
|
||||
// float toFloat() const {return _float;}
|
||||
// const std::string& toString() const {return _string;}
|
||||
|
||||
// void setValue(const float val) {_float = val;}
|
||||
// void setValue(const int val) {_int = val;}
|
||||
// void setValue(const std::string& val) {_string = val;}
|
||||
|
||||
//};
|
||||
|
||||
struct Param {
|
||||
std::string name;
|
||||
ParamType type;
|
||||
Param(const std::string& name, const ParamType type) : name(name), type(type) {;}
|
||||
};
|
||||
|
||||
/** free parameters */
|
||||
class IHasParams {
|
||||
public:
|
||||
|
||||
/** get the number of parameters */
|
||||
virtual int getNumParams() const = 0;
|
||||
|
||||
/** get the description of the idx-th parameter */
|
||||
virtual Param getParamDesc(const int idx) const = 0;
|
||||
|
||||
/** get the idx-th param's value */
|
||||
virtual ParamValue getParamValue(const int idx) const = 0;
|
||||
|
||||
/** set the idx-th param's value */
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // IHASPARAMS_H
|
||||
19
mapview/model/IHasPosition3D.h
Normal file
19
mapview/model/IHasPosition3D.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef IHASPOSITION3D_H
|
||||
#define IHASPOSITION3D_H
|
||||
|
||||
|
||||
#include <Indoor/geo/Point3.h>
|
||||
|
||||
class IHasPosition3D {
|
||||
|
||||
public:
|
||||
|
||||
/** set the element's 3D position */
|
||||
virtual void setPosition3D(const Point3& p) = 0;
|
||||
|
||||
/** get the element's 3D position */
|
||||
virtual Point3 getPosition3D() const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // IHASPOSITION3D_H
|
||||
56
mapview/model/MMFloor.h
Normal file
56
mapview/model/MMFloor.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef MMFLOOR_H
|
||||
#define MMFLOOR_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorOutline.h"
|
||||
#include "MMFloorObstacles.h"
|
||||
#include "MMFloorAccessPoints.h"
|
||||
#include "MMFloorBeacons.h"
|
||||
#include "MMFloorUnderlay.h"
|
||||
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
/**
|
||||
* floor-layer containing one floor
|
||||
* and its outline, obstacles, access-points, ...
|
||||
*/
|
||||
class MMFloor : public MapLayer, public IHasName {
|
||||
|
||||
private:
|
||||
|
||||
/** the underlying data-structure */
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor. existing floor */
|
||||
MMFloor(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR), floor(floor) {
|
||||
|
||||
new MMFloorOutline(this, floor);
|
||||
new MMFloorObstacles(this, floor);
|
||||
new MMFloorAccessPoints(this, floor);
|
||||
new MMFloorBeacons(this, floor);
|
||||
new MMFloorUnderlay(this, floor);
|
||||
|
||||
}
|
||||
|
||||
/** ctor. new floor. */
|
||||
MMFloor(MapLayer* parent) : MapLayer(parent), floor(nullptr) {
|
||||
throw "not yet implemented";
|
||||
}
|
||||
|
||||
/** get the underlying model */
|
||||
Floorplan::Floor& getFloor() {return *floor;}
|
||||
|
||||
|
||||
std::string getLayerName() const override {return floor->name;}
|
||||
|
||||
|
||||
virtual void setName(const std::string& name) {this->floor->name = name;}
|
||||
virtual const std::string& getName() const {return this->floor->name;}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOOR_H
|
||||
42
mapview/model/MMFloorAccessPoint.h
Normal file
42
mapview/model/MMFloorAccessPoint.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef MAPVIEWELEMENTACCESSPOINT_H
|
||||
#define MAPVIEWELEMENTACCESSPOINT_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "IHasMAC.h"
|
||||
#include "IHasName.h"
|
||||
|
||||
#include "../elements/MV2DElementAccessPoint.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorAccessPoint : public MapModelElement, public IHasMAC, public IHasName {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
Floorplan::AccessPoint* ap;
|
||||
MV2DElementAccessPoint mv2d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorAccessPoint(MapLayer* parent, Floorplan::Floor* floor, Floorplan::AccessPoint* ap) :
|
||||
MapModelElement(parent), floor(floor), ap(ap), mv2d(ap) {
|
||||
|
||||
}
|
||||
|
||||
virtual void setMAC(const std::string& mac) override {ap->mac = mac;}
|
||||
virtual const std::string& getMAC() const override {return ap->mac;}
|
||||
|
||||
virtual void setName(const std::string& name) override {ap->name = name;}
|
||||
virtual const std::string& getName() const override {return ap->name;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
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
|
||||
45
mapview/model/MMFloorAccessPoints.h
Normal file
45
mapview/model/MMFloorAccessPoints.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef MMFLOORACCESSPOINTS_H
|
||||
#define MMFLOORACCESSPOINTS_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorAccessPoint.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer containing all of the map's floors
|
||||
*/
|
||||
class MMFloorAccessPoints : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the underlying model */
|
||||
MMFloorAccessPoints(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_ACCESS_POINTS), floor(floor) {
|
||||
|
||||
// add all APs
|
||||
for (Floorplan::AccessPoint* ap : floor->accesspoints) {
|
||||
new MMFloorAccessPoint(this, floor, ap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string getLayerName() const override {return "APs";}
|
||||
|
||||
//TODO: check
|
||||
void createAP(Floorplan::AccessPoint* ap) {
|
||||
|
||||
// add to underlying model
|
||||
floor->accesspoints.push_back(ap);
|
||||
|
||||
// add to myself as element
|
||||
elements.push_back(new MMFloorAccessPoint(this, floor, ap));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOORACCESSPOINTS_H
|
||||
41
mapview/model/MMFloorBeacon.h
Normal file
41
mapview/model/MMFloorBeacon.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef MAPVIEWELEMENTIBEACON_H
|
||||
#define MAPVIEWELEMENTIBEACON_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "IHasMAC.h"
|
||||
#include "IHasName.h"
|
||||
|
||||
#include "../elements/MV2DElementBeacon.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorBeacon : public MapModelElement, public IHasMAC, public IHasName {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
Floorplan::Beacon* b;
|
||||
MV2DElementBeacon mv2d;
|
||||
|
||||
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 void setName(const std::string& name) override {b->name = name;}
|
||||
virtual const std::string& getName() const override {return b->name;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
floor->beacons.erase(std::remove(floor->beacons.begin(), floor->beacons.end(), b), floor->beacons.end());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MAPVIEWELEMENTIBEACON_H
|
||||
44
mapview/model/MMFloorBeacons.h
Normal file
44
mapview/model/MMFloorBeacons.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef MMFLOORBEACONS_H
|
||||
#define MMFLOORBEACONS_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorBeacon.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer containing all of the floor's beaconss
|
||||
*/
|
||||
class MMFloorBeacons : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the underlying model */
|
||||
MMFloorBeacons(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_BEACONS), floor(floor) {
|
||||
|
||||
// add all Beacons
|
||||
for (Floorplan::Beacon* b : floor->beacons) {
|
||||
new MMFloorBeacon(this, floor, b);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string getLayerName() const override {return "Beacons";}
|
||||
|
||||
//TODO: check
|
||||
void createBeacon(Floorplan::Beacon* b) {
|
||||
|
||||
// add to underlying model
|
||||
floor->beacons.push_back(b);
|
||||
|
||||
// add to myself as element
|
||||
elements.push_back(new MMFloorBeacon(this, floor, b));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOORBEACONS_H
|
||||
46
mapview/model/MMFloorObstacleCircle.h
Normal file
46
mapview/model/MMFloorObstacleCircle.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
||||
#define MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
||||
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "../elements/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasObstacleType.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorObstacleCircle.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
class MMFloorObstacleCircle : public MapModelElement, public IHasMaterial, public IHasObstacleType {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* mf;
|
||||
Floorplan::FloorObstacleCircle* c;
|
||||
MV2DElementFloorObstacleCircle mv2d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorObstacleCircle(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleCircle* c) :
|
||||
MapModelElement(parent), mf(mf), c(c), mv2d(c) {
|
||||
|
||||
}
|
||||
|
||||
void setMaterial(const Floorplan::Material m) override {c->material = m;}
|
||||
Floorplan::Material getMaterial() const override {return c->material;}
|
||||
|
||||
void setObstacleType(const Floorplan::ObstacleType t) override {c->type = t;}
|
||||
Floorplan::ObstacleType getObatcleType() const override {return c->type;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
mf->obstacles.erase(std::remove(mf->obstacles.begin(), mf->obstacles.end(), c), mf->obstacles.end());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MAPMODELELEMENTFLOOROBSTACLECIRCLE_H
|
||||
45
mapview/model/MMFloorObstacleLine.h
Normal file
45
mapview/model/MMFloorObstacleLine.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef MAPELEMENTOBSTACLE_H
|
||||
#define MAPELEMENTOBSTACLE_H
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "../elements/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasObstacleType.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorObstacleLine.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
class MMFloorObstacleLine : public MapModelElement, public IHasMaterial, public IHasObstacleType {
|
||||
|
||||
public:
|
||||
|
||||
Floorplan::Floor* mf;
|
||||
Floorplan::FloorObstacleLine* fo;
|
||||
MV2DElementFloorObstacleLine mv2d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorObstacleLine(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleLine* fo) :
|
||||
MapModelElement(parent), mf(mf), fo(fo), mv2d(fo) {
|
||||
|
||||
}
|
||||
|
||||
void setMaterial(const Floorplan::Material m) override {fo->material = m;}
|
||||
Floorplan::Material getMaterial() const override {return fo->material;}
|
||||
|
||||
void setObstacleType(const Floorplan::ObstacleType t) override {fo->type = t;}
|
||||
Floorplan::ObstacleType getObatcleType() const override {return fo->type;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
mf->obstacles.erase(std::remove(mf->obstacles.begin(), mf->obstacles.end(), fo), mf->obstacles.end());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MAPELEMENTOBSTACLE_H
|
||||
63
mapview/model/MMFloorObstacles.h
Normal file
63
mapview/model/MMFloorObstacles.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef MMFLOOROBSTACLES_H
|
||||
#define MMFLOOROBSTACLES_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorObstacleCircle.h"
|
||||
#include "MMFloorObstacleLine.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer that contains all of one floor's obstacles
|
||||
*/
|
||||
class MMFloorObstacles : public MapLayer {
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the floor */
|
||||
MMFloorObstacles(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_OBSTACLES), floor(floor) {
|
||||
|
||||
// the obstacles
|
||||
for (Floorplan::FloorObstacle* o : floor->obstacles) {
|
||||
if (dynamic_cast<Floorplan::FloorObstacleLine*>(o)) {
|
||||
elements.push_back(new MMFloorObstacleLine(this, floor, (Floorplan::FloorObstacleLine*)o));
|
||||
} else if (dynamic_cast<Floorplan::FloorObstacleCircle*>(o)) {
|
||||
elements.push_back(new MMFloorObstacleCircle(this, floor, (Floorplan::FloorObstacleCircle*)o));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** get the corresponding floor from the underlying model */
|
||||
Floorplan::Floor* getFloor() {return floor;}
|
||||
|
||||
//TODO: check
|
||||
void createLine(Floorplan::FloorObstacleLine* obs) {
|
||||
|
||||
// add to underlying model
|
||||
floor->obstacles.push_back(obs);
|
||||
|
||||
// add to myself as element
|
||||
elements.push_back(new MMFloorObstacleLine(this, floor, obs));
|
||||
|
||||
}
|
||||
|
||||
//TODO: check
|
||||
void createCircle(Floorplan::FloorObstacleCircle* obs) {
|
||||
|
||||
// add to underlying model
|
||||
floor->obstacles.push_back(obs);
|
||||
|
||||
// add to myself as element
|
||||
elements.push_back(new MMFloorObstacleCircle(this, floor, obs));
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string getLayerName() const override {return "obstacles";}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOOROBSTACLES_H
|
||||
52
mapview/model/MMFloorOutline.h
Normal file
52
mapview/model/MMFloorOutline.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef MMFLOOROUTLINE_H
|
||||
#define MMFLOOROUTLINE_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloorOutlinePolygon.h"
|
||||
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer containing all elements describing a floor's outline
|
||||
*/
|
||||
class MMFloorOutline : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
/** the underlying model */
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the underlying model */
|
||||
MMFloorOutline(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_GROUND), floor(floor) {
|
||||
|
||||
// the outline
|
||||
for (Floorplan::FloorOutlinePolygon* poly : floor->outline) {
|
||||
elements.push_back(new MMFloorOutlinePolygon(this, floor, poly));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** get the corresponding floor from the underlying model */
|
||||
Floorplan::Floor* getFloor() {return floor;}
|
||||
|
||||
//TODO: check
|
||||
void create(Floorplan::FloorOutlinePolygon* poly) {
|
||||
|
||||
// add to underlying model
|
||||
floor->outline.push_back(poly);
|
||||
|
||||
// add to myself as element
|
||||
elements.push_back(new MMFloorOutlinePolygon(this, floor, poly));
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string getLayerName() const override {return "outline";}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOOROUTLINE_H
|
||||
53
mapview/model/MMFloorOutlinePolygon.h
Normal file
53
mapview/model/MMFloorOutlinePolygon.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef MAPELEMENTFLOORGROUND_H
|
||||
#define MAPELEMENTFLOORGROUND_H
|
||||
|
||||
#include "IHasName.h"
|
||||
#include "MapModelElement.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorOutlinePolygon.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
/**
|
||||
* describes one polygon within a floor's outline
|
||||
*/
|
||||
class MMFloorOutlinePolygon : public MapModelElement, public IHasName {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* mf;
|
||||
Floorplan::FloorOutlinePolygon* fo;
|
||||
MV2DElementFloorOutlinePolygon mv2d;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MMFloorOutlinePolygon(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorOutlinePolygon* fo) : MapModelElement(parent), mf(mf), fo(fo), mv2d(*fo) {
|
||||
;
|
||||
}
|
||||
|
||||
Floorplan::FloorOutlinePolygon* getPolygon() {return fo;}
|
||||
|
||||
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;}
|
||||
|
||||
void deleteMe() const override {
|
||||
|
||||
// delete from the parent
|
||||
parent->removeElement(this);
|
||||
|
||||
// delete from the underlying model
|
||||
mf->outline.erase(std::remove(mf->outline.begin(), mf->outline.end(), fo), mf->outline.end());
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // MAPELEMENTFLOORGROUND_H
|
||||
52
mapview/model/MMFloorUnderlay.h
Normal file
52
mapview/model/MMFloorUnderlay.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef MMFLOORUNDERLAY_H
|
||||
#define MMFLOORUNDERLAY_H
|
||||
|
||||
#include "MMFloorUnderlayImage.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorUnderlay.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* add an external file as underlay (to copy it onto the map)
|
||||
*/
|
||||
class MMFloorUnderlay : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MMFloorUnderlay(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_UNDERLAY), floor(floor) {
|
||||
|
||||
// the underlays
|
||||
for (Floorplan::UnderlayImage* img : floor->underlays) {
|
||||
elements.push_back(new MMFloorUnderlayImage(this, floor, img));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO: check
|
||||
void createImage(const Point2 center) {
|
||||
|
||||
Floorplan::UnderlayImage* elem = new Floorplan::UnderlayImage();
|
||||
|
||||
// add to underlying model
|
||||
floor->underlays.push_back(elem);
|
||||
|
||||
// add to myself as element
|
||||
MMFloorUnderlayImage* img = new MMFloorUnderlayImage(this, floor, elem);
|
||||
elements.push_back(img);
|
||||
img->setAnchor(center);
|
||||
img->setScale(0.1, 0.1);
|
||||
|
||||
}
|
||||
|
||||
virtual std::string getLayerName() const override {return "underlay";}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // MMFLOORUNDERLAY_H
|
||||
78
mapview/model/MMFloorUnderlayImage.h
Normal file
78
mapview/model/MMFloorUnderlayImage.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#ifndef MMFLOORUNDERLAYIMAGE_H
|
||||
#define MMFLOORUNDERLAYIMAGE_H
|
||||
|
||||
|
||||
#include "IHasFile.h"
|
||||
#include "IHasParams.h"
|
||||
#include "MapModelElement.h"
|
||||
|
||||
#include "../elements/MV2DElementFloorUnderlay.h"
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* add an external image file as underlay (to copy it onto the map)
|
||||
*/
|
||||
class MMFloorUnderlayImage : public MapModelElement, public MapLayer, public IHasFile, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
Floorplan::UnderlayImage* img;
|
||||
MV2DElementFloorUnderlay mv2d;
|
||||
std::string fileName;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;}
|
||||
|
||||
void deleteMe() const override {
|
||||
;
|
||||
}
|
||||
|
||||
int getNumParams() const override {return 3;}
|
||||
|
||||
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);
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return ParamValue(img->filename);
|
||||
case 1: return ParamValue(img->scaleX);
|
||||
case 2: return ParamValue(img->scaleY);
|
||||
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();
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOORUNDERLAYIMAGE_H
|
||||
37
mapview/model/MMFloors.h
Normal file
37
mapview/model/MMFloors.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef MMFLOORS_H
|
||||
#define MMFLOORS_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloor.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer containing all of the map's floors
|
||||
*/
|
||||
class MMFloors : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::IndoorMap* map;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the underlying model */
|
||||
MMFloors(MapLayer* parent, Floorplan::IndoorMap* map) : MapLayer(parent, MapLayerType::FLOORS), map(map) {
|
||||
|
||||
// add all floors
|
||||
for (Floorplan::Floor* floor : map->floors) {
|
||||
new MMFloor(this, floor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string getLayerName() const override {return "floors";}
|
||||
|
||||
/** get the underlying model */
|
||||
Floorplan::IndoorMap* getMap() {return map;}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOORS_H
|
||||
38
mapview/model/MMRoot.h
Normal file
38
mapview/model/MMRoot.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef MMROOT_H
|
||||
#define MMROOT_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloors.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* floor-layer containing one floor
|
||||
* and its outline, obstacles, access-points, ...
|
||||
*/
|
||||
class MMRoot : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
/** the underlying data-structure */
|
||||
Floorplan::IndoorMap* map;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor. existing floor */
|
||||
MMRoot(MapLayer* parent, Floorplan::IndoorMap* map) : MapLayer(parent), map(map) {
|
||||
|
||||
// all floors
|
||||
new MMFloors(this, map);
|
||||
|
||||
}
|
||||
|
||||
/** get the underlying model */
|
||||
Floorplan::IndoorMap* getMap() {return map;}
|
||||
|
||||
|
||||
std::string getLayerName() const override {return "root";}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMROOT_H
|
||||
127
mapview/model/MapLayer.h
Normal file
127
mapview/model/MapLayer.h
Normal file
@@ -0,0 +1,127 @@
|
||||
#ifndef MAPLAYER_H
|
||||
#define MAPLAYER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
class MapModelElement;
|
||||
|
||||
|
||||
enum class MapLayerType {
|
||||
UNKNOWN,
|
||||
ROOT,
|
||||
FLOORS,
|
||||
FLOOR,
|
||||
FLOOR_GROUND,
|
||||
FLOOR_OBSTACLES,
|
||||
FLOOR_BEACONS,
|
||||
FLOOR_ACCESS_POINTS,
|
||||
FLOOR_UNDERLAY,
|
||||
};
|
||||
|
||||
|
||||
|
||||
class MapLayer {
|
||||
|
||||
protected:
|
||||
|
||||
/** this layer's parent */
|
||||
MapLayer* parent;
|
||||
|
||||
/** this layer's elements */
|
||||
std::vector<MapModelElement*> elements;
|
||||
|
||||
/** this layer's sublayers */
|
||||
std::vector<MapLayer*> sublayers;
|
||||
|
||||
/** this layer's type */
|
||||
MapLayerType type;
|
||||
|
||||
/** whether this layer is visible */
|
||||
bool visible;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MapLayer(MapLayer* parent) : parent(parent), type(MapLayerType::UNKNOWN), visible(true) {
|
||||
if (parent) {parent->addSublayer(this);} // attach myself as child of my parent
|
||||
}
|
||||
|
||||
/** ctor */
|
||||
MapLayer(MapLayer* parent, MapLayerType type) : parent(parent), type(type), visible(true) {
|
||||
if (parent) {parent->addSublayer(this);} // attach myself as child of my parent
|
||||
}
|
||||
|
||||
/** dtor */
|
||||
virtual ~MapLayer() {;}
|
||||
|
||||
/** get the layer's parent */
|
||||
MapLayer* getParent() const {return parent;}
|
||||
|
||||
/** get the layer's name */
|
||||
virtual std::string getLayerName() const = 0;
|
||||
|
||||
/** get the layer's type */
|
||||
MapLayerType getLayerType() const {return type;}
|
||||
|
||||
|
||||
/** get all elements within this layer */
|
||||
const std::vector<MapModelElement*>& getElements() const {return elements;}
|
||||
|
||||
/** get all elements within this layer */
|
||||
size_t getNumElements() const {return elements.size();}
|
||||
|
||||
/** remove the given element from the elements list */
|
||||
void removeElement(const MapModelElement* elem) { elements.erase(std::remove(elements.begin(), elements.end(), elem), elements.end()); }
|
||||
|
||||
|
||||
/** is this layer currently visible? */
|
||||
bool isVisible() const {return visible;}
|
||||
|
||||
/** make this layer visible */
|
||||
void setVisible(const bool visible) {this->visible = visible;}
|
||||
|
||||
|
||||
/** get all sub-layers within this layer */
|
||||
const std::vector<MapLayer*>& getSubLayers() const {return sublayers;}
|
||||
|
||||
|
||||
/** helper method to get all elements and those of all sub-layers */
|
||||
void getVisibleElementsRecursive(std::vector<MapModelElement*>& el) {
|
||||
if (isVisible()) {
|
||||
std::vector<MapModelElement*> local = getElements();
|
||||
el.insert(el.end(), local.begin(), local.end());
|
||||
for (MapLayer* sub : getSubLayers()) {
|
||||
sub->getVisibleElementsRecursive(el);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
/** add a new sublayer to this layer */
|
||||
void addSublayer(MapLayer* ml) {
|
||||
|
||||
// sanity check before adding
|
||||
if (std::find(sublayers.begin(), sublayers.end(), ml) != sublayers.end()) {throw "layer already present!";}
|
||||
sublayers.push_back(ml);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class MapLayerRoot : public MapLayer {
|
||||
|
||||
public:
|
||||
|
||||
MapLayerRoot(MapLayer* parent) : MapLayer(parent, MapLayerType::ROOT) {;}
|
||||
|
||||
std::string getLayerName() const override {return "root";}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // MAPLAYER_H
|
||||
72
mapview/model/MapLayers.h
Normal file
72
mapview/model/MapLayers.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef MAPLAYERFLOOR_H
|
||||
#define MAPLAYERFLOOR_H
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
#include "../model/MMFloorObstacleLine.h"
|
||||
#include "../model/MMFloorObstacleCircle.h"
|
||||
#include "../model/MMFloorOutlinePolygon.h"
|
||||
#include "../model/MMFloorBeacon.h"
|
||||
|
||||
|
||||
/*
|
||||
class MapLayerFloorOutlineAdd : public TypedMapLayer {
|
||||
private:
|
||||
Floorplan::Floor& floor;
|
||||
public:
|
||||
MapLayerFloorOutlineAdd(MapLayer* parent, Floorplan::Floor& floor) : TypedMapLayer(parent, MapLayerType::FLOOR_GROUND_ADD), floor(floor) {;}
|
||||
std::string getLayerName() const override {return "add";}
|
||||
Floorplan::Floor& getFloor() {return floor;}
|
||||
std::vector<MapModelElement*> getElements() const override {
|
||||
std::vector<MapModelElement*> vec;
|
||||
for (Floorplan::FloorOutlinePolygon& p : floor.outline.add) {vec.push_back(new MapViewElementFloorOutlinePolygon(floor, p, MapViewElementFloorOutlinePolygon::Type::ADD));}
|
||||
return vec;
|
||||
}
|
||||
void create(const Floorplan::FloorOutlinePolygon& poly) {
|
||||
floor.outline.add.push_back(poly);
|
||||
}
|
||||
virtual size_t getNumElements() const override {return floor.outline.add.size();}
|
||||
};
|
||||
|
||||
class MapLayerFloorOutlineRemove : public TypedMapLayer {
|
||||
private:
|
||||
Floorplan::Floor& floor;
|
||||
public:
|
||||
MapLayerFloorOutlineRemove(MapLayer* parent, Floorplan::Floor& floor) : TypedMapLayer(parent, MapLayerType::FLOOR_GROUND_REMOVE), floor(floor) {;}
|
||||
std::string getLayerName() const override {return "remove";}
|
||||
Floorplan::Floor& getFloor() {return floor;}
|
||||
std::vector<MapModelElement*> getElements() const override {
|
||||
std::vector<MapModelElement*> vec;
|
||||
for (Floorplan::FloorOutlinePolygon& p : floor.outline.remove) {vec.push_back(new MapViewElementFloorOutlinePolygon(floor, p, MapViewElementFloorOutlinePolygon::Type::REMOVE));}
|
||||
return vec;
|
||||
}
|
||||
void create(const Floorplan::FloorOutlinePolygon& poly) {
|
||||
floor.outline.remove.push_back(poly);
|
||||
}
|
||||
virtual size_t getNumElements() const override {return floor.outline.remove.size();}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class MapLayerFloorOutlinePolygon : public TypedMapLayer {
|
||||
private:
|
||||
Floorplan::Floor& floor;
|
||||
public:
|
||||
MapLayerFloorOutlinePolygon(MapLayer* parent, Floorplan::Floor& floor) : TypedMapLayer(parent, MapLayerType::FLOOR_GROUND), floor(floor) {
|
||||
new MapLayerFloorOutlineAdd(this, floor);
|
||||
new MapLayerFloorOutlineRemove(this, floor);
|
||||
}
|
||||
std::string getLayerName() const override {return "ground";}
|
||||
Floorplan::Floor& getFloor() {return floor;}
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // MAPLAYERFLOOR_H
|
||||
0
mapview/model/MapModel.cpp
Normal file
0
mapview/model/MapModel.cpp
Normal file
112
mapview/model/MapModel.h
Normal file
112
mapview/model/MapModel.h
Normal file
@@ -0,0 +1,112 @@
|
||||
#ifndef MAPMODEL_H
|
||||
#define MAPMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MapModelElement.h"
|
||||
|
||||
#include "MMRoot.h"
|
||||
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include <Indoor/floorplan/v2/FloorplanReader.h>
|
||||
#include <Indoor/floorplan/v2/FloorplanWriter.h>
|
||||
|
||||
class MapModel : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
///** wrapper-classes for all elements */
|
||||
//std::vector<MapModelElement*> selElements;
|
||||
|
||||
/** the map's root-layer containing all other layers */
|
||||
MapLayer* root = nullptr;
|
||||
|
||||
/** the currently selected layer (if any) */
|
||||
MapLayer* selLayer = nullptr;
|
||||
|
||||
/** the loaded floorplan */
|
||||
Floorplan::IndoorMap* im;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MapModel() {
|
||||
root = new MapLayerRoot(nullptr);
|
||||
}
|
||||
|
||||
virtual ~MapModel() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
selLayer = nullptr;
|
||||
//selElements.clear();
|
||||
if (root) {delete root; root = nullptr;}
|
||||
}
|
||||
|
||||
void load(const std::string& file) {
|
||||
|
||||
emit aboutToReset();
|
||||
|
||||
cleanup();
|
||||
|
||||
// load the indoor-map using the given XML-file
|
||||
im = Floorplan::Reader::readFromFile(file);
|
||||
root = new MMRoot(nullptr, im);
|
||||
|
||||
emit reset();
|
||||
|
||||
}
|
||||
|
||||
void save(const std::string& file) {
|
||||
|
||||
Floorplan::Writer::writeToFile(im, file);
|
||||
|
||||
}
|
||||
|
||||
/** get the map's root-layer containing all other layers */
|
||||
MapLayer* getRootLayer() { return root; }
|
||||
|
||||
/** get all elements within the currently selected layer */
|
||||
std::vector<MapModelElement*> getSelectedLayerElements() {
|
||||
//return selElements;
|
||||
//return (selLayer) ? (selLayer->getElementsRecursive()) : (std::vector<MapModelElement*>());
|
||||
std::vector<MapModelElement*> elements;
|
||||
root->getVisibleElementsRecursive(elements);
|
||||
return elements;
|
||||
}
|
||||
|
||||
/** get all currently visible elements */
|
||||
std::vector<MapModelElement*> getVisibleElements() {
|
||||
return getSelectedLayerElements();
|
||||
}
|
||||
|
||||
/** set the currently selected layer */
|
||||
void setSelectedLayer(MapLayer* ml) {
|
||||
//selElements.clear();
|
||||
//for (MapModelElement* el : ml->getElementsRecursive()) {selElements.push_back(el);}
|
||||
selLayer = ml;
|
||||
}
|
||||
|
||||
/** get the currently selected layer */
|
||||
MapLayer* getSelectedLayer() const {
|
||||
return selLayer;
|
||||
}
|
||||
|
||||
void reselect() {
|
||||
setSelectedLayer(selLayer);
|
||||
emit reset();
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
void aboutToReset();
|
||||
void reset();
|
||||
|
||||
};
|
||||
|
||||
#endif // MAPMODEL_H
|
||||
34
mapview/model/MapModelElement.h
Normal file
34
mapview/model/MapModelElement.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef MAPMODELELEMENT_H
|
||||
#define MAPMODELELEMENT_H
|
||||
|
||||
|
||||
#include "MapLayer.h"
|
||||
|
||||
class MV2DElement;
|
||||
|
||||
class MapModelElement {
|
||||
|
||||
protected:
|
||||
|
||||
MapLayer* parent;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MapModelElement(MapLayer* parent) : parent(parent) {;}
|
||||
|
||||
/** dtor */
|
||||
virtual ~MapModelElement() {;}
|
||||
|
||||
/** get the 2D interaction class for this element */
|
||||
virtual MV2DElement* getMV2D() const = 0;
|
||||
|
||||
/** delete this element from the model */
|
||||
virtual void deleteMe() const = 0;
|
||||
|
||||
/** get the parent element */
|
||||
MapLayer* getParent() const {return parent;}
|
||||
|
||||
};
|
||||
|
||||
#endif // MAPMODELELEMENT_H
|
||||
Reference in New Issue
Block a user