split line(old) and wall(new)
added new walling started working on windows
This commit is contained in:
116
mapview/model/MMFloorObstacleWall.h
Normal file
116
mapview/model/MMFloorObstacleWall.h
Normal file
@@ -0,0 +1,116 @@
|
||||
#ifndef MMFLOOROBSTACLEWALL_H
|
||||
#define MMFLOOROBSTACLEWALL_H
|
||||
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasObstacleType.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../2D/MV2DElementFloorObstacleWall.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
class MMFloorObstacleWall : public MapModelElement, public IHasMaterial, public IHasObstacleType, public IHasParams {
|
||||
|
||||
public:
|
||||
|
||||
Floorplan::Floor* mf;
|
||||
Floorplan::FloorObstacleWall* wall;
|
||||
MV2DElementFloorObstacleWall mv2d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorObstacleWall(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleWall* wall) :
|
||||
MapModelElement(parent), mf(mf), wall(wall), mv2d(mf, wall) {
|
||||
;
|
||||
}
|
||||
|
||||
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;}
|
||||
|
||||
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(), wall), mf->obstacles.end());
|
||||
}
|
||||
|
||||
int getType() const {
|
||||
const int idx = mv2d.getSelectedNode();
|
||||
if (idx < 1000) {return 0;} // line
|
||||
if (idx < 2000) {return 1;} // door
|
||||
return 2; // window
|
||||
}
|
||||
|
||||
Floorplan::FloorObstacleWallDoor* getCurDoor() const {
|
||||
const int idx = mv2d.getSelectedNode()-1000;
|
||||
return wall->doors[idx];
|
||||
}
|
||||
|
||||
int getNumParams() const override {
|
||||
switch(getType()) {
|
||||
case 0: return 3;
|
||||
case 1: return 4;
|
||||
case 2: return 0;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
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 1: switch(idx) {
|
||||
case 0: return Param("width (m)", ParamType::FLOAT);
|
||||
case 1: return Param("height (m)", ParamType::FLOAT);
|
||||
case 2: return Param("left/right", ParamType::BOOL);
|
||||
case 3: return Param("in/out", ParamType::BOOL);
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
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 1: switch(idx) {
|
||||
case 0: return getCurDoor()->width;
|
||||
case 1: return getCurDoor()->height;
|
||||
case 2: return getCurDoor()->leftRight;
|
||||
case 3: return getCurDoor()->inOut;
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
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 1: switch(idx) {
|
||||
case 0: getCurDoor()->width = val.toFloat(); return;
|
||||
case 1: getCurDoor()->height = val.toFloat(); return;
|
||||
case 2: getCurDoor()->leftRight = val.toBool(); return;
|
||||
case 3: getCurDoor()->inOut = val.toBool(); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MMFLOOROBSTACLEWALL_H
|
||||
Reference in New Issue
Block a user