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/MMFloorUnderlays.h
2018-10-25 12:19:36 +02:00

72 lines
1.6 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* © Copyright 2014 Urheberrechtshinweis
* Alle Rechte vorbehalten / All Rights Reserved
*
* Programmcode ist urheberrechtlich geschuetzt.
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
* Keine Verwendung ohne explizite Genehmigung.
* (vgl. § 106 ff UrhG / § 97 UrhG)
*/
#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