This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
IndoorMap/mapview/model/MMFloorObstacleLine.h
k-a-z-u 8017241c6e split line(old) and wall(new)
added new walling
started working on windows
2018-07-25 16:20:34 +02:00

76 lines
2.0 KiB
C++

#ifndef MAPELEMENTOBSTACLE_H
#define MAPELEMENTOBSTACLE_H
#include "MapModelElement.h"
#include "../2D/MapViewElementHelper.h"
#include "IHasMaterial.h"
#include "IHasObstacleType.h"
#include "IHasParams.h"
#include "../2D/MV2DElementFloorObstacleLine.h"
#include <Indoor/floorplan/v2/Floorplan.h>
class MMFloorObstacleLine : public MapModelElement, public IHasMaterial, public IHasObstacleType, public IHasParams {
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(mf, 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());
}
int getNumParams() const override {
return 3;
}
virtual Param getParamDesc(const int idx) const override {
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);
}
throw 1;
}
virtual ParamValue getParamValue(const int idx) const override {
switch(idx) {
case 0: return fo->thickness_m;
case 1: return fo->height_m;
case 2: return fo->from.getDistance(fo->to);
}
throw 1;
}
virtual void setParamValue(const int idx, const ParamValue& val) override {
switch(idx) {
case 0: fo->thickness_m = val.toFloat(); return;
case 1: fo->height_m = val.toFloat(); return;
case 2: return;
}
}
};
#endif // MAPELEMENTOBSTACLE_H