1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-07 12:05:14 +01:00
GPXSee/src/GUI/areaitem.h

60 lines
1.3 KiB
C
Raw Normal View History

2019-01-31 01:46:53 +01:00
#ifndef AREAITEM_H
#define AREAITEM_H
#include "data/area.h"
2020-12-02 23:58:11 +01:00
#include "planeitem.h"
2019-01-31 01:46:53 +01:00
2020-12-02 23:58:11 +01:00
class AreaItem : public PlaneItem
2019-01-31 01:46:53 +01:00
{
public:
2019-11-10 17:59:58 +01:00
AreaItem(const Area &area, Map *map, GraphicsItem *parent = 0);
2019-01-31 01:46:53 +01:00
QPainterPath shape() const {return _painterPath;}
QRectF boundingRect() const {return _painterPath.boundingRect();}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
const Area &area() const {return _area;}
2020-12-02 23:58:11 +01:00
RectC bounds() const {return _area.boundingRect();}
2019-01-31 01:46:53 +01:00
void setMap(Map *map);
void setColor(const QColor &color);
void setOpacity(qreal opacity);
void setWidth(qreal width);
2022-09-25 02:15:24 +02:00
void setPenStyle(Qt::PenStyle style);
2019-01-31 01:46:53 +01:00
void setDigitalZoom(int zoom);
2022-09-25 02:15:24 +02:00
void updateStyle();
2019-01-31 01:46:53 +01:00
ToolTip info() const;
2019-11-10 17:59:58 +01:00
2019-10-14 20:07:05 +02:00
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
2019-10-14 20:07:05 +02:00
private:
QPainterPath painterPath(Map *map, const Polygon &polygon);
void updatePainterPath(Map *map);
2022-09-25 02:15:24 +02:00
void updateColor();
void updateWidth();
void updatePenStyle();
qreal width() const;
const QColor &strokeColor() const;
QColor fillColor() const;
Qt::PenStyle penStyle() const;
2019-01-31 01:46:53 +01:00
Area _area;
2022-09-25 02:15:24 +02:00
2019-01-31 01:46:53 +01:00
qreal _width;
2022-09-25 02:15:24 +02:00
QColor _color;
2019-01-31 01:46:53 +01:00
qreal _opacity;
2022-09-25 02:15:24 +02:00
Qt::PenStyle _penStyle;
int _digitalZoom;
2019-01-31 01:46:53 +01:00
2022-09-25 02:15:24 +02:00
QPen _pen;
QBrush _brush;
2019-01-31 01:46:53 +01:00
QPainterPath _painterPath;
};
#endif // AREAITEM_H