refactoring/cleanups
This commit is contained in:
31
mapview/model/EElementParams.h
Normal file
31
mapview/model/EElementParams.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef EELEMENTPARAMS_H
|
||||
#define EELEMENTPARAMS_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
static inline std::vector<std::string> getDoorTypeStrings() {
|
||||
return {
|
||||
"unknown", "swing", "double swing", "slide", "double slide", "revolving"
|
||||
};
|
||||
}
|
||||
|
||||
static inline std::vector<std::string> getMaterialStrings() {
|
||||
return {
|
||||
"Unknown", "Concrete", "Wood", "Drywall", "Glass", "Metal", "Glass (metallized)"
|
||||
};
|
||||
}
|
||||
|
||||
static inline std::vector<std::string> getObstacleTypeStrings() {
|
||||
return {
|
||||
"unknown", "wall", "window", "handrail", "pillar",
|
||||
};
|
||||
}
|
||||
|
||||
static inline std::vector<std::string> getOutlineMethodStrings() {
|
||||
return {
|
||||
"add", "remove"
|
||||
};
|
||||
}
|
||||
|
||||
#endif // EELEMENTPARAMS_H
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef IHASDOORTYPE_H
|
||||
#define IHASDOORTYPE_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class IHasDoorType {
|
||||
public:
|
||||
|
||||
virtual void setDoorType(const Floorplan::DoorType t) = 0;
|
||||
|
||||
virtual Floorplan::DoorType getDoorType() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // IHASDOORTYPE_H
|
||||
@@ -1,17 +0,0 @@
|
||||
#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
|
||||
@@ -1,15 +0,0 @@
|
||||
#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
|
||||
@@ -1,16 +0,0 @@
|
||||
#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
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasObstacleType.h"
|
||||
#include "EElementParams.h"
|
||||
|
||||
#include "IHasParams.h"
|
||||
|
||||
@@ -15,7 +14,7 @@
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
class MMFloorObstacleCircle : public MapModelElement, public IHasMaterial, public IHasParams {
|
||||
class MMFloorObstacleCircle : public MapModelElement, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,8 +29,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void setMaterial(const Floorplan::Material m) override {c->material = m;}
|
||||
Floorplan::Material getMaterial() const override {return c->material;}
|
||||
// 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;}
|
||||
@@ -45,7 +44,7 @@ public:
|
||||
|
||||
/** get the number of parameters */
|
||||
int getNumParams() const override {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
/** get the description of the idx-th parameter */
|
||||
@@ -53,6 +52,7 @@ public:
|
||||
switch (idx) {
|
||||
case 0: return Param("radius", ParamType::FLOAT);
|
||||
case 1: return Param("height", ParamType::FLOAT);
|
||||
case 2: return Param("material", ParamType::ENUM, getMaterialStrings());
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
switch(idx) {
|
||||
case 0: return c->radius;
|
||||
case 1: return c->height;
|
||||
case 2: return (int) c->material;
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
@@ -71,6 +72,7 @@ public:
|
||||
switch (idx) {
|
||||
case 0: c->radius = val.toFloat(); break;
|
||||
case 1: c->height = val.toFloat(); break;
|
||||
case 2: c->material = (Floorplan::Material) val.toInt(); break;
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasDoorType.h"
|
||||
#include "EElementParams.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../2D/MV2DElementFloorObstacleDoor.h"
|
||||
@@ -14,7 +13,8 @@
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
class MMFloorObstacleDoor : public MapModelElement, public IHasMaterial, public IHasDoorType, public IHasParams {
|
||||
|
||||
class MMFloorObstacleDoor : public MapModelElement, public IHasParams {
|
||||
|
||||
public:
|
||||
|
||||
@@ -30,11 +30,11 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void setMaterial(const Floorplan::Material m) override {fo->material = m;}
|
||||
Floorplan::Material getMaterial() const override {return fo->material;}
|
||||
// void setMaterial(const Floorplan::Material m) override {fo->material = m;}
|
||||
// Floorplan::Material getMaterial() const override {return fo->material;}
|
||||
|
||||
void setDoorType(const Floorplan::DoorType t) override {fo->type = t;}
|
||||
Floorplan::DoorType getDoorType() const override {return fo->type;}
|
||||
// void setDoorType(const Floorplan::DoorType t) override {fo->type = t;}
|
||||
// Floorplan::DoorType getDoorType() const override {return fo->type;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
//MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
/** get the number of parameters */
|
||||
int getNumParams() const override {
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
|
||||
/** get the description of the idx-th parameter */
|
||||
@@ -55,7 +55,8 @@ public:
|
||||
case 0: return Param("width", ParamType::FLOAT, true);
|
||||
case 1: return Param("height", ParamType::FLOAT);
|
||||
case 2: return Param("swap", ParamType::BOOL);
|
||||
case 3: return Param("type", ParamType::ENUM, {"unknown", "swing", "double swing", "slide", "double slide", "revolving"});
|
||||
case 3: return Param("type", ParamType::ENUM, getDoorTypeStrings());
|
||||
case 4: return Param("material", ParamType::ENUM, getMaterialStrings());
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
@@ -67,6 +68,7 @@ public:
|
||||
case 1: return fo->height;
|
||||
case 2: return fo->swap;
|
||||
case 3: return (int) fo->type;
|
||||
case 4: return (int) fo->material;
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
@@ -78,6 +80,7 @@ public:
|
||||
case 1: fo->height = val.toFloat(); break;
|
||||
case 2: fo->swap = val.toBool(); break;
|
||||
case 3: fo->type = (Floorplan::DoorType) val.toInt(); break;
|
||||
case 4: fo->material = (Floorplan::Material) val.toInt(); break;
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasObstacleType.h"
|
||||
#include "EElementParams.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../2D/MV2DElementFloorObstacleLine.h"
|
||||
@@ -13,7 +12,7 @@
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
class MMFloorObstacleLine : public MapModelElement, public IHasMaterial, public IHasObstacleType, public IHasParams {
|
||||
class MMFloorObstacleLine : public MapModelElement, public IHasParams {
|
||||
|
||||
public:
|
||||
|
||||
@@ -28,11 +27,11 @@ public:
|
||||
;
|
||||
}
|
||||
|
||||
void setMaterial(const Floorplan::Material m) override {fo->material = m;}
|
||||
Floorplan::Material getMaterial() const override {return fo->material;}
|
||||
// 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;}
|
||||
// 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;}
|
||||
|
||||
@@ -42,7 +41,7 @@ public:
|
||||
}
|
||||
|
||||
int getNumParams() const override {
|
||||
return 3;
|
||||
return 5;
|
||||
}
|
||||
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
@@ -50,6 +49,8 @@ public:
|
||||
case 0: return Param("thickness (m)", ParamType::FLOAT);
|
||||
case 1: return Param("height (m)", ParamType::FLOAT);
|
||||
case 2: return Param("length", ParamType::FLOAT, true);
|
||||
case 3: return Param("material", ParamType::ENUM, getMaterialStrings());
|
||||
case 4: return Param("type", ParamType::ENUM, getObstacleTypeStrings());
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
@@ -59,6 +60,8 @@ public:
|
||||
case 0: return fo->thickness_m;
|
||||
case 1: return fo->height_m;
|
||||
case 2: return fo->from.getDistance(fo->to);
|
||||
case 3: return (int) fo->material;
|
||||
case 4: return (int) fo->type;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
@@ -68,6 +71,8 @@ public:
|
||||
case 0: fo->thickness_m = val.toFloat(); return;
|
||||
case 1: fo->height_m = val.toFloat(); return;
|
||||
case 2: return;
|
||||
case 3: fo->material = (Floorplan::Material) val.toInt(); return;
|
||||
case 4: fo->type = (Floorplan::ObstacleType) val.toInt(); return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasDoorType.h"
|
||||
#include "EElementParams.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../2D/MV2DElementFloorObstacleObject.h"
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasObstacleType.h"
|
||||
#include "EElementParams.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../2D/MV2DElementFloorObstacleWall.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorObstacleWall : public MapModelElement, public IHasMaterial, public IHasObstacleType, public IHasParams {
|
||||
class MMFloorObstacleWall : public MapModelElement, public IHasParams {
|
||||
|
||||
public:
|
||||
|
||||
@@ -28,11 +27,11 @@ public:
|
||||
;
|
||||
}
|
||||
|
||||
void setMaterial(const Floorplan::Material m) override {wall->material = m;}
|
||||
Floorplan::Material getMaterial() const override {return wall->material;}
|
||||
// void setMaterial(const Floorplan::Material m) override {wall->material = m;}
|
||||
// Floorplan::Material getMaterial() const override {return wall->material;}
|
||||
|
||||
void setObstacleType(const Floorplan::ObstacleType t) override {wall->type = t;}
|
||||
Floorplan::ObstacleType getObatcleType() const override {return wall->type;}
|
||||
// void setObstacleType(const Floorplan::ObstacleType t) override {wall->type = t;}
|
||||
// Floorplan::ObstacleType getObatcleType() const override {return wall->type;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
|
||||
@@ -60,7 +59,7 @@ public:
|
||||
|
||||
int getNumParams() const override {
|
||||
switch(getType()) {
|
||||
case 0: return 3;
|
||||
case 0: return 5;
|
||||
case 1: return 4;
|
||||
case 2: return 4;
|
||||
}
|
||||
@@ -70,9 +69,11 @@ public:
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch(getType()) {
|
||||
case 0: switch(idx) {
|
||||
case 0: return Param("thickness (m)", ParamType::FLOAT);
|
||||
case 1: return Param("height (m)", ParamType::FLOAT);
|
||||
case 2: return Param("length", ParamType::FLOAT, true);
|
||||
case 0: return Param("material", ParamType::ENUM, getMaterialStrings());
|
||||
case 1: return Param("type", ParamType::ENUM, getObstacleTypeStrings());
|
||||
case 2: return Param("thickness (m)", ParamType::FLOAT);
|
||||
case 3: return Param("height (m)", ParamType::FLOAT);
|
||||
case 4: return Param("length", ParamType::FLOAT, true);
|
||||
} break;
|
||||
case 1: switch(idx) {
|
||||
case 0: return Param("width (m)", ParamType::FLOAT);
|
||||
@@ -93,9 +94,11 @@ public:
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(getType()) {
|
||||
case 0: switch(idx) {
|
||||
case 0: return wall->thickness_m;
|
||||
case 1: return wall->height_m;
|
||||
case 2: return wall->from.getDistance(wall->to);
|
||||
case 0: return (int) wall->material;
|
||||
case 1: return (int) wall->type;
|
||||
case 2: return wall->thickness_m;
|
||||
case 3: return wall->height_m;
|
||||
case 4: return wall->from.getDistance(wall->to);
|
||||
} break;
|
||||
case 1: switch(idx) {
|
||||
case 0: return getCurDoor()->width;
|
||||
@@ -116,9 +119,11 @@ public:
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||
switch(getType()) {
|
||||
case 0: switch(idx) {
|
||||
case 0: wall->thickness_m = val.toFloat(); return;
|
||||
case 1: wall->height_m = val.toFloat(); return;
|
||||
case 2: return;
|
||||
case 0: wall->material = (Floorplan::Material) val.toInt(); return;
|
||||
case 1: wall->type = (Floorplan::ObstacleType) val.toInt(); return;
|
||||
case 2: wall->thickness_m = val.toFloat(); return;
|
||||
case 3: wall->height_m = val.toFloat(); return;
|
||||
case 4: return;
|
||||
} break;
|
||||
case 1: switch(idx) {
|
||||
case 0: getCurDoor()->width = val.toFloat(); return;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
#include "EElementParams.h"
|
||||
|
||||
/**
|
||||
* describes one polygon within a floor's outline
|
||||
@@ -31,36 +32,39 @@ public:
|
||||
|
||||
Floorplan::FloorOutlinePolygon* getPolygon() {return fo;}
|
||||
|
||||
Floorplan::OutlineMethod getMethod() const {return fo->method;}
|
||||
void setMethod(const Floorplan::OutlineMethod m) {this->fo->method = m;}
|
||||
// Floorplan::OutlineMethod getMethod() const {return fo->method;}
|
||||
// void setMethod(const Floorplan::OutlineMethod m) {this->fo->method = m;}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
//MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
virtual int getNumParams() const override {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return Param("name", ParamType::STRING);
|
||||
case 1: return Param("outdoor", ParamType::BOOL);
|
||||
case 0: return Param("name", ParamType::STRING);
|
||||
case 1: return Param("method", ParamType::ENUM, getOutlineMethodStrings());
|
||||
case 2: return Param("outdoor", ParamType::BOOL);
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return fo->name;
|
||||
case 1: return fo->outdoor;
|
||||
case 0: return fo->name;
|
||||
case 1: return (int) fo->method;
|
||||
case 2: return fo->outdoor;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||
switch(idx) {
|
||||
case 0: fo->name = val.toString(); break;
|
||||
case 1: fo->outdoor = val.toBool(); break;
|
||||
case 0: fo->name = val.toString(); break;
|
||||
case 1: fo->method = (Floorplan::OutlineMethod) val.toInt(); break;
|
||||
case 2: fo->outdoor = val.toBool(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user