refactoring/cleanups

This commit is contained in:
2018-07-30 20:56:17 +02:00
parent 9a07790ec6
commit a9fcb77675
23 changed files with 276 additions and 247 deletions

View File

@@ -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;