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

@@ -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");
}
}