2020-12-02 23:58:11 +01:00
|
|
|
#ifndef MAPITEM_H
|
|
|
|
#define MAPITEM_H
|
|
|
|
|
|
|
|
#include "planeitem.h"
|
|
|
|
|
2020-12-10 22:02:09 +01:00
|
|
|
class MapAction;
|
|
|
|
|
2020-12-02 23:58:11 +01:00
|
|
|
class MapItem : public QObject, public PlaneItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-12-10 22:02:09 +01:00
|
|
|
MapItem(MapAction *action, Map *map, GraphicsItem *parent = 0);
|
2020-12-02 23:58:11 +01:00
|
|
|
|
|
|
|
QPainterPath shape() const {return _painterPath;}
|
|
|
|
QRectF boundingRect() const {return _painterPath.boundingRect();}
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget);
|
|
|
|
|
|
|
|
RectC bounds() const {return _bounds;}
|
|
|
|
void setMap(Map *map);
|
|
|
|
|
|
|
|
void setColor(const QColor &color);
|
|
|
|
void setOpacity(qreal opacity);
|
|
|
|
void setWidth(qreal width);
|
|
|
|
void setStyle(Qt::PenStyle style);
|
|
|
|
void setDigitalZoom(int zoom);
|
|
|
|
|
|
|
|
QString info() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void triggered();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updatePainterPath();
|
|
|
|
|
|
|
|
RectC _bounds;
|
|
|
|
QString _name;
|
|
|
|
QString _fileName;
|
|
|
|
|
|
|
|
Map *_map;
|
|
|
|
int _digitalZoom;
|
|
|
|
|
|
|
|
qreal _width;
|
|
|
|
QPen _pen;
|
|
|
|
QBrush _brush;
|
|
|
|
qreal _opacity;
|
|
|
|
|
|
|
|
QPainterPath _painterPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAPITEM_H
|