some refactoring
hopefully improved rendering speed added support to add .obj obstacles
This commit is contained in:
@@ -38,6 +38,11 @@ public:
|
||||
/** repaint me */
|
||||
void paint(Painter& p) override {
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible(ap->pos.xy())) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const QPixmap& pixmapUnfocused = UIHelper::getPixmapColored("wifi", CFG::UNFOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapFocused = UIHelper::getPixmapColored("wifi", CFG::FOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapSel = UIHelper::getPixmapColored("wifi", CFG::SEL_COLOR, 16);
|
||||
|
||||
@@ -38,6 +38,11 @@ public:
|
||||
/** repaint me */
|
||||
void paint(Painter& p) override {
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible(fpl->posOnFloor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const QPixmap& pixmapUnfocused = UIHelper::getPixmapColored("fingerprint", CFG::UNFOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapFocused = UIHelper::getPixmapColored("fingerprint", CFG::FOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapSel = UIHelper::getPixmapColored("fingerprint", CFG::SEL_COLOR, 16);
|
||||
|
||||
@@ -23,6 +23,11 @@ ClickDist MV2DElementFloorObstacleDoor::getMinDistanceXY(const Point2 p) const {
|
||||
|
||||
void MV2DElementFloorObstacleDoor::paint(Painter& p) {
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible( (fo->from+fo->to)/2 )) {
|
||||
return;
|
||||
}
|
||||
|
||||
// selected endpoints?
|
||||
if (hasFocus()) {
|
||||
p.setPenBrush(Qt::NoPen, CFG::SEL_COLOR);
|
||||
|
||||
134
mapview/2D/MV2DElementFloorObstacleObject.cpp
Normal file
134
mapview/2D/MV2DElementFloorObstacleObject.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "MV2DElementFloorObstacleObject.h"
|
||||
|
||||
#include "MapViewElementHelper.h"
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include <Indoor/wifi/estimate/ray3/OBJPool.h>
|
||||
|
||||
#include "../../UIHelper.h"
|
||||
|
||||
|
||||
|
||||
MV2DElementFloorObstacleObject::MV2DElementFloorObstacleObject(Floorplan::FloorObstacleObject* fo) : fo(fo) {
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
BBox2 MV2DElementFloorObstacleObject::getBoundingBox() const {
|
||||
BBox2 bbox;
|
||||
bbox.add(Point2(fo->pos.x, fo->pos.y));
|
||||
bbox.grow(Point2(0.1, 0.1));
|
||||
return bbox;
|
||||
}
|
||||
|
||||
ClickDist MV2DElementFloorObstacleObject::getMinDistanceXY(const Point2 p) const {
|
||||
return ClickDist(p.getDistance(fo->pos.xy()), ClickDistType::DIRECT);
|
||||
}
|
||||
|
||||
//#include <unordered_map>
|
||||
//struct Cache {
|
||||
// struct Line {
|
||||
// Point2 p1;
|
||||
// Point2 p2;
|
||||
// Line(Point2 p1, Point2 p2) : p1(p1), p2(p2) {;}
|
||||
// };
|
||||
// struct Entry {
|
||||
// const Floorplan::FloorObstacleObject* obj = nullptr;
|
||||
// std::vector<Line> lines;
|
||||
// };
|
||||
// Entry e;
|
||||
// const Entry& get(const Floorplan::FloorObstacleObject* obj) {
|
||||
// if (e.obj == nullptr || e.obj->file != obj->file || e.obj->pos != obj->pos || e.obj->rot != obj->rot) {
|
||||
// e.obj = obj;
|
||||
// e.lines.clear();
|
||||
// const Ray3D::Obstacle3D obs = Ray3D::OBJPool::get().getObject(obj->file).rotated_deg(obj->rot).translated(obj->pos);
|
||||
// for (const Triangle3& tria : obs.triangles) {
|
||||
// if (tria.p1.xy() != tria.p2.xy()) {
|
||||
// e.lines.push_back( Line (tria.p1.xy(), tria.p2.xy()) );
|
||||
// }
|
||||
// }
|
||||
// return e;
|
||||
// }
|
||||
// }
|
||||
//} cache;
|
||||
|
||||
|
||||
void MV2DElementFloorObstacleObject::paint(Painter& p) {
|
||||
|
||||
static const QPixmap& pixmapUnfocused = UIHelper::getPixmapColored("objects", CFG::UNFOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapFocused = UIHelper::getPixmapColored("objects", CFG::FOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapSel = UIHelper::getPixmapColored("objects", CFG::SEL_COLOR, 16);
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible(fo->pos.xy())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p.getScaler().getScale() >= 40) {
|
||||
// TODO: quite costly... cache??
|
||||
p.setPenBrush(Qt::black, Qt::NoBrush);
|
||||
// const Cache::Entry& e = cache.get(fo);
|
||||
// for (const Cache::Line& l : e.lines) {
|
||||
// p.drawLine(l.p1, l.p2);
|
||||
// }
|
||||
const Ray3D::Obstacle3D obs = Ray3D::OBJPool::get().getObject(fo->file).rotated_deg(fo->rot).translated(fo->pos);
|
||||
for (const Triangle3& tria : obs.triangles) {
|
||||
if (tria.p1.xy() != tria.p2.xy()) {
|
||||
p.drawLine( tria.p1.xy(), tria.p2.xy() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p.getScaler().getScale() >= 20) {
|
||||
if (selectedUserIdx == 0) {
|
||||
p.drawPixmap(fo->pos.xy(), pixmapSel);
|
||||
} else if (hasFocus()) {
|
||||
p.drawPixmap(fo->pos.xy(), pixmapFocused);
|
||||
} else {
|
||||
p.drawPixmap(fo->pos.xy(), pixmapUnfocused);
|
||||
}
|
||||
}
|
||||
|
||||
//p.setPenBrush(Qt::black, Qt::NoBrush);
|
||||
//p.drawDot(fo->pos.xy());
|
||||
|
||||
}
|
||||
|
||||
std::vector<MoveableNode> MV2DElementFloorObstacleObject::getMoveableNodes() const {
|
||||
return { MoveableNode(0, fo->pos.xy()) };
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) {
|
||||
(void) v;
|
||||
if (userIdx == 0) {fo->pos.x = newPos.x; fo->pos.y = newPos.y;}
|
||||
}
|
||||
|
||||
|
||||
void MV2DElementFloorObstacleObject::mousePressed(MapView2D* v, const Point2 p) {
|
||||
(void) v;
|
||||
(void) p;
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::mouseMove(MapView2D* v, const Point2 p) {
|
||||
(void) v;
|
||||
(void) p;
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::mouseReleased(MapView2D* v, const Point2 p) {
|
||||
(void) v;
|
||||
(void) p;
|
||||
}
|
||||
|
||||
bool MV2DElementFloorObstacleObject::keyPressEvent(MapView2D* v, QKeyEvent *e) {
|
||||
(void) v;
|
||||
(void) e;
|
||||
return false;
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::onFocus() {
|
||||
;
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::onUnfocus() {
|
||||
;
|
||||
}
|
||||
|
||||
51
mapview/2D/MV2DElementFloorObstacleObject.h
Normal file
51
mapview/2D/MV2DElementFloorObstacleObject.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef MV2DELEMENTFLOOROBSTACLEOBJECT_H
|
||||
#define MV2DELEMENTFLOOROBSTACLEOBJECT_H
|
||||
|
||||
#include "MV2DElement.h"
|
||||
#include "HasMoveableNodes.h"
|
||||
|
||||
//#include "MapViewElementHelper.h"
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
//#include "../../UIHelper.h"
|
||||
|
||||
class MV2DElementFloorObstacleObject : public MV2DElement, public HasMoveableNodes {
|
||||
|
||||
private:
|
||||
|
||||
//bool sel = false;
|
||||
Floorplan::FloorObstacleObject* fo;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor with the AP to render/edit */
|
||||
MV2DElementFloorObstacleObject(Floorplan::FloorObstacleObject* fo);
|
||||
|
||||
BBox2 getBoundingBox() const override;
|
||||
|
||||
/** get the element's minimal distance (nearest whatsoever) to the given point */
|
||||
ClickDist getMinDistanceXY(const Point2 p) const override;
|
||||
|
||||
/** repaint me */
|
||||
void paint(Painter& p) override;
|
||||
|
||||
virtual std::vector<MoveableNode> getMoveableNodes() const override;
|
||||
|
||||
virtual void onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) override;
|
||||
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override;
|
||||
|
||||
virtual void mouseMove(MapView2D* v, const Point2 p) override;
|
||||
|
||||
virtual void mouseReleased(MapView2D* v, const Point2 p) override;
|
||||
|
||||
virtual bool keyPressEvent(MapView2D* v, QKeyEvent *e) override;
|
||||
|
||||
virtual void onFocus() override;
|
||||
|
||||
virtual void onUnfocus() override;
|
||||
|
||||
};
|
||||
|
||||
#endif // MV2DELEMENTFLOOROBSTACLELINE_H
|
||||
@@ -37,6 +37,11 @@ public:
|
||||
/** repaint me */
|
||||
void paint(Painter& p) override {
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible(gtp->pos.xy())) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const QPixmap& pixmapUnfocused = UIHelper::getPixmapColored("gtp", CFG::UNFOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapFocused = UIHelper::getPixmapColored("gtp", CFG::FOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapSel = UIHelper::getPixmapColored("gtp", CFG::SEL_COLOR, 16);
|
||||
|
||||
@@ -37,6 +37,11 @@ public:
|
||||
/** repaint me */
|
||||
void paint(Painter& p) override {
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible(poi->pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const QPixmap& pixmapUnfocused = UIHelper::getPixmapColored("poi", CFG::UNFOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapFocused = UIHelper::getPixmapColored("poi", CFG::FOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapSel = UIHelper::getPixmapColored("poi", CFG::SEL_COLOR, 16);
|
||||
|
||||
@@ -40,6 +40,11 @@ public:
|
||||
/** repaint me */
|
||||
void paint(Painter& p) override {
|
||||
|
||||
// invisible? -> leave
|
||||
if (!p.isVisible(reg->posOnMap_m.xy())) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const QPixmap& pixmapUnfocused = UIHelper::getPixmapColored("registration", CFG::UNFOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapFocused = UIHelper::getPixmapColored("registration", CFG::FOCUS_COLOR, 16);
|
||||
static const QPixmap& pixmapSel = UIHelper::getPixmapColored("registration", CFG::SEL_COLOR, 16);
|
||||
|
||||
@@ -95,6 +95,18 @@ public:
|
||||
std::vector<Floorplan::StairPart> parts = stair->getParts();
|
||||
std::vector<Floorplan::Quad3> quads = Floorplan::getQuads(parts, floor);
|
||||
|
||||
// skip drawing?
|
||||
BBox2 bbox;
|
||||
for (const Floorplan::Quad3& q : quads) {
|
||||
bbox.add(q.p1.xy());
|
||||
bbox.add(q.p2.xy());
|
||||
bbox.add(q.p3.xy());
|
||||
bbox.add(q.p4.xy());
|
||||
}
|
||||
if (!p.isVisible(bbox)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int) parts.size(); ++i) {
|
||||
|
||||
const Floorplan::StairPart& part = parts[i];
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <Indoor/geo/Point2.h>
|
||||
#include <Indoor/geo/Point3.h>
|
||||
#include <Indoor/geo/BBox2.h>
|
||||
|
||||
#include "Scaler.h"
|
||||
|
||||
@@ -30,6 +31,22 @@ public:
|
||||
|
||||
int height() {return h;}
|
||||
|
||||
/** is the given point visible on screen? */
|
||||
bool isVisible(const Point2 p) {
|
||||
const float x = s.xms(p.x);
|
||||
const float y = s.yms(p.y);
|
||||
return (x >= 0 && y >= 0 && x < w && y < h);
|
||||
}
|
||||
|
||||
/** is the given volume visible on screen? */
|
||||
bool isVisible(const BBox2 bb) {
|
||||
const BBox2 bbt(0,0,w,h);
|
||||
BBox2 bbs;
|
||||
bbs.add(s.xms(bb.getMin().x), s.yms(bb.getMin().y)); // y might be inverted! -> use the add() method to address this
|
||||
bbs.add(s.xms(bb.getMax().x), s.yms(bb.getMax().y)); // y might be inverted! -> use the add() method to address this
|
||||
return bbt.intersects(bbs);
|
||||
}
|
||||
|
||||
void drawLine(const Point2 p1, const Point2 p2) {
|
||||
p->drawLine(s.xms(p1.x), s.yms(p1.y), s.xms(p2.x), s.yms(p2.y));
|
||||
}
|
||||
|
||||
49
mapview/2D/tools/ToolNewObject.h
Normal file
49
mapview/2D/tools/ToolNewObject.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef TOOLNEWOBJECT_H
|
||||
#define TOOLNEWOBJECT_H
|
||||
|
||||
|
||||
#include "ToolNewElement.h"
|
||||
#include "../../model/MMFloorObstacles.h"
|
||||
#include "../../model/MMFloorObstacleObject.h"
|
||||
|
||||
class ToolNewObject : public ToolNewElement<Floorplan::FloorObstacleObject, MMFloorObstacleObject> {
|
||||
|
||||
public:
|
||||
|
||||
ToolNewObject(Tools& tools, MapLayer* layer) : ToolNewElement(tools, layer) {
|
||||
;
|
||||
}
|
||||
|
||||
void becomesActive() override {
|
||||
emit onHelpTextChange("left-click where to place a new object. right-click to end.");
|
||||
}
|
||||
|
||||
void becomesInactive() override {
|
||||
;
|
||||
}
|
||||
|
||||
const std::string getName() const override {
|
||||
return "new Object/Furniture/...";
|
||||
}
|
||||
|
||||
void moving(const Point2 mapPoint) override {
|
||||
(void) mapPoint;
|
||||
}
|
||||
|
||||
/** next point */
|
||||
void leftMouse(const Point2 mapPoint) override {
|
||||
foEL = new Floorplan::FloorObstacleObject("", Point3(mapPoint.x, mapPoint.y, 0.0), Point3(0,0,0));
|
||||
MMFloorObstacles* obs = (MMFloorObstacles*)layer;
|
||||
mmEL = obs->createObject(foEL);
|
||||
}
|
||||
|
||||
void rightMouse(const Point2 mapPoint) override {
|
||||
(void) mapPoint;
|
||||
finalizeCurrent();
|
||||
disableMe();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // TOOLNEWOBJECT_H
|
||||
42
mapview/3D/MV3DElementFloorObstacleObject.h
Normal file
42
mapview/3D/MV3DElementFloorObstacleObject.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef MV3DELEMENTFLOOROBSTACLEOBJECT_H
|
||||
#define MV3DELEMENTFLOOROBSTACLEOBJECT_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include <Indoor/math/Math.h>
|
||||
|
||||
#include "misc/Cube.h"
|
||||
#include "misc/Window.h"
|
||||
#include "misc/Handrail.h"
|
||||
|
||||
#include "MV3DElement.h"
|
||||
|
||||
class MV3DElementFloorObstacleObject : public MV3DElement {
|
||||
|
||||
Floorplan::Floor* f;
|
||||
Floorplan::FloorObstacleObject* fo;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MV3DElementFloorObstacleObject(Floorplan::Floor* f, Floorplan::FloorObstacleObject* fo) : f(f), fo(fo) {
|
||||
;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/** repaint me */
|
||||
void render(const RenderSettings& rs) override {
|
||||
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
bool isTransparent() const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // MV3DELEMENTFLOOROBSTACLEOBJECT_H
|
||||
@@ -65,6 +65,18 @@ MapView3D::MapView3D(QWidget *parent) : QOpenGLWidget(parent) {
|
||||
emit update();
|
||||
});
|
||||
|
||||
QPushButton* btnExp3D = new QPushButton(UIHelper::getIcon("save"), "", this);
|
||||
btnExp3D->setStyleSheet(style);
|
||||
btnExp3D->setGeometry(16, 16+8+32+8+32+8+32, 32, 32);
|
||||
connect(btnExp3D, &QPushButton::clicked, [this] () {
|
||||
floorplanRendererModel->getMesh().exportOBJsimple("/tmp/map.obj");
|
||||
floorplanRendererModel->getMesh().exportOBJcomplex("/tmp/map_complex", "map_complex");
|
||||
floorplanRendererModel->getMesh().exportPLY("/tmp/map.ply");
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
QPushButton* btnGrid = new QPushButton(UIHelper::getIcon("grid"), "", this);
|
||||
btnGrid->setCheckable(true);
|
||||
btnGrid->setChecked(false);
|
||||
|
||||
@@ -39,8 +39,10 @@ private:
|
||||
|
||||
Material(128,128,128,255), // concrete
|
||||
Material(200,200,255,96), // glass
|
||||
Material(170,120,60,255), // wood
|
||||
Material(200,200,200,255), // drywall
|
||||
|
||||
Material(200,200,200,255), // default
|
||||
Material(250,250,250,255), // default
|
||||
|
||||
};
|
||||
|
||||
@@ -56,8 +58,10 @@ private:
|
||||
|
||||
if (o.mat == Floorplan::Material::CONCRETE) {return 6;}
|
||||
if (o.mat == Floorplan::Material::GLASS) {return 7;}
|
||||
if (o.mat == Floorplan::Material::WOOD) {return 8;}
|
||||
if (o.mat == Floorplan::Material::DRYWALL) {return 9;}
|
||||
|
||||
return 8;
|
||||
return 10;
|
||||
|
||||
}
|
||||
|
||||
|
||||
79
mapview/model/MMFloorObstacleObject.h
Normal file
79
mapview/model/MMFloorObstacleObject.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#ifndef MMFLOOROBSTACLEOBJECT_H
|
||||
#define MMFLOOROBSTACLEOBJECT_H
|
||||
|
||||
|
||||
#include "MapModelElement.h"
|
||||
#include "../2D/MapViewElementHelper.h"
|
||||
|
||||
#include "IHasMaterial.h"
|
||||
#include "IHasDoorType.h"
|
||||
#include "IHasParams.h"
|
||||
|
||||
#include "../2D/MV2DElementFloorObstacleObject.h"
|
||||
#include "../3D/MV3DElementFloorObstacleObject.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
|
||||
class MMFloorObstacleObject : public MapModelElement, public IHasParams {
|
||||
|
||||
public:
|
||||
|
||||
Floorplan::Floor* mf;
|
||||
Floorplan::FloorObstacleObject* fo;
|
||||
MV2DElementFloorObstacleObject mv2d;
|
||||
MV3DElementFloorObstacleObject mv3d;
|
||||
|
||||
public:
|
||||
|
||||
MMFloorObstacleObject(MapLayer* parent, Floorplan::Floor* mf, Floorplan::FloorObstacleObject* fo) :
|
||||
MapModelElement(parent), mf(mf), fo(fo), mv2d(fo), mv3d(mf,fo) {
|
||||
|
||||
}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
parent->removeElement(this);
|
||||
mf->obstacles.erase(std::remove(mf->obstacles.begin(), mf->obstacles.end(), fo), mf->obstacles.end());
|
||||
}
|
||||
|
||||
/** get the number of parameters */
|
||||
int getNumParams() const override {
|
||||
return 3;
|
||||
}
|
||||
|
||||
/** get the description of the idx-th parameter */
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch (idx) {
|
||||
case 0: return Param("file", ParamType::STRING);
|
||||
case 1: return Param("pos", ParamType::POINT3);
|
||||
case 2: return Param("rot", ParamType::POINT3);
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
|
||||
/** get the idx-th param's value */
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return fo->file;
|
||||
case 1: return fo->pos;
|
||||
case 2: return fo->rot;
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
|
||||
/** set the idx-th param's value */
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||
switch (idx) {
|
||||
case 0: fo->file = val.toString(); break;
|
||||
case 1: fo->pos = val.toPoint3(); break;
|
||||
case 2: fo->rot = val.toPoint3(); break;
|
||||
default: throw Exception("out of bounds");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMFLOOROBSTACLEOBJECT_H
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "MMFloorObstacleCircle.h"
|
||||
#include "MMFloorObstacleLine.h"
|
||||
#include "MMFloorObstacleDoor.h"
|
||||
#include "MMFloorObstacleObject.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
@@ -28,6 +29,8 @@ public:
|
||||
addElement(new MMFloorObstacleCircle(this, floor, (Floorplan::FloorObstacleCircle*)o));
|
||||
} else if (dynamic_cast<Floorplan::FloorObstacleDoor*>(o)) {
|
||||
addElement(new MMFloorObstacleDoor(this, floor, (Floorplan::FloorObstacleDoor*)o));
|
||||
} else if (dynamic_cast<Floorplan::FloorObstacleObject*>(o)) {
|
||||
addElement(new MMFloorObstacleObject(this, floor, (Floorplan::FloorObstacleObject*)o));
|
||||
} else {
|
||||
throw new Exception("todo: not yet implemented obstacle type");
|
||||
}
|
||||
@@ -84,6 +87,19 @@ public:
|
||||
|
||||
}
|
||||
|
||||
//TODO: check
|
||||
MMFloorObstacleObject* createObject(Floorplan::FloorObstacleObject* obs) {
|
||||
|
||||
// add to underlying model
|
||||
floor->obstacles.push_back(obs);
|
||||
|
||||
// add to myself as element
|
||||
MMFloorObstacleObject* mm = new MMFloorObstacleObject(this, floor, obs);
|
||||
addElement(mm);
|
||||
return mm;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string getLayerName() const override {return "obstacles";}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user