62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
#ifndef MMFLOORUNDERLAY_H
|
|
#define MMFLOORUNDERLAY_H
|
|
|
|
#include "MMFloorUnderlayImage.h"
|
|
|
|
#include "../2D/MV2DElementFloorUnderlay.h"
|
|
|
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
|
|
|
/**
|
|
* add an external file as underlay (to copy it onto the map)
|
|
*/
|
|
class MMFloorUnderlays : public MapLayer {
|
|
|
|
private:
|
|
|
|
Floorplan::Floor* floor;
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
MMFloorUnderlays(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_UNDERLAYS), floor(floor) {
|
|
|
|
// the underlays
|
|
for (Floorplan::UnderlayImage* img : floor->underlays) {
|
|
addElement(new MMFloorUnderlayImage(this, floor, img));
|
|
}
|
|
|
|
}
|
|
|
|
bool isVisible() const override {
|
|
return floor->underlays.enabled;
|
|
}
|
|
|
|
void setVisible(const bool visible) override {
|
|
this-> floor->underlays.enabled = visible;
|
|
onVisibilityChanged(visible);
|
|
}
|
|
|
|
//TODO: check
|
|
void createImage(const Point2 center) {
|
|
|
|
Floorplan::UnderlayImage* elem = new Floorplan::UnderlayImage();
|
|
|
|
// add to underlying model
|
|
floor->underlays.push_back(elem);
|
|
|
|
// add to myself as element
|
|
MMFloorUnderlayImage* img = new MMFloorUnderlayImage(this, floor, elem);
|
|
addElement(img);
|
|
img->setAnchor(center);
|
|
img->setScale(0.1, 0.1);
|
|
|
|
}
|
|
|
|
virtual std::string getLayerName() const override {return "underlay";}
|
|
|
|
};
|
|
|
|
|
|
#endif // MMFLOORUNDERLAY_H
|