Marble

GeoLineStringGraphicsItem.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2009 Andrew Manson <g.real.ate@gmail.com>
4//
5
6#ifndef MARBLE_GEOLINESTRINGGRAPHICSITEM_H
7#define MARBLE_GEOLINESTRINGGRAPHICSITEM_H
8
9#include "GeoDataCoordinates.h"
10#include "GeoDataLineString.h"
11#include "GeoGraphicsItem.h"
12#include "MarbleGlobal.h"
13#include "marble_export.h"
14
15#include <QRegion>
16
17namespace Marble
18{
19
20class GeoDataPlacemark;
21
22class MARBLE_EXPORT GeoLineStringGraphicsItem : public GeoGraphicsItem
23{
24 Q_DECLARE_TR_FUNCTIONS(GeoLineStringGraphicsItem)
25
26public:
27 explicit GeoLineStringGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLineString *lineString);
28 ~GeoLineStringGraphicsItem() override;
29
30 void setLineString(const GeoDataLineString *lineString);
31 const GeoDataLineString *lineString() const;
32 static GeoDataLineString merge(const QList<const GeoDataLineString *> &lineStrings);
33 void setMergedLineString(const GeoDataLineString &sharedLineString);
34
35 const GeoDataLatLonAltBox &latLonAltBox() const override;
36
37 void paint(GeoPainter *painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override;
38 bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override;
39
40 static const GeoDataStyle *s_previousStyle;
41 static bool s_paintInline;
42 static bool s_paintOutline;
43
44protected:
45 void handleRelationUpdate(const QList<const GeoDataRelation *> &relations) override;
46
47private:
48 void paintOutline(GeoPainter *painter, const ViewportParams *viewport) const;
49 void paintInline(GeoPainter *painter, const ViewportParams *viewport);
50 void paintLabel(GeoPainter *painter, const ViewportParams *viewport) const;
51
52 bool configurePainterForLine(GeoPainter *painter, const ViewportParams *viewport, const bool isOutline = false) const;
53 bool configurePainterForLabel(GeoPainter *painter, const ViewportParams *viewport, LabelPositionFlags &labelPositionFlags) const;
54
55 static bool canMerge(const GeoDataCoordinates &a, const GeoDataCoordinates &b);
56
57 const GeoDataLineString *m_lineString;
58 const GeoDataLineString *m_renderLineString;
59 GeoDataLineString m_mergedLineString;
60 QList<QPolygonF *> m_cachedPolygons;
61 bool m_renderLabel;
62 qreal m_penWidth;
63 mutable QRegion m_cachedRegion;
64 QString m_name;
65};
66
67}
68
69#endif
QStringView merge(QStringView lhs, QStringView rhs)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.