Marble

AbstractGeoPolygonGraphicsItem.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2011 Konstantin Oblaukhov <[email protected]>
4 //
5 
6 #ifndef MARBLE_ABSTRACTGEOPOLYGONGRAPHICSITEM_H
7 #define MARBLE_ABSTRACTGEOPOLYGONGRAPHICSITEM_H
8 
9 #include "GeoGraphicsItem.h"
10 #include "marble_export.h"
11 
12 #include <QImage>
13 #include <QColor>
14 
15 namespace Marble
16 {
17 
18 class GeoDataLinearRing;
19 class GeoDataPlacemark;
20 class GeoDataPolygon;
21 class GeoDataBuilding;
22 
23 class MARBLE_EXPORT AbstractGeoPolygonGraphicsItem : public GeoGraphicsItem
24 {
25 protected:
26  AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon);
27  AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring);
28  AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataBuilding *building);
29  ~AbstractGeoPolygonGraphicsItem() override;
30 
31 public:
32  const GeoDataLatLonAltBox& latLonAltBox() const override;
33  void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override;
34  bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override;
35 
36  void setLinearRing(GeoDataLinearRing* ring);
37  void setPolygon(GeoDataPolygon* polygon);
38 
39  static const void *s_previousStyle;
40 
41 protected:
42  bool configurePainter(GeoPainter* painter, const ViewportParams &viewport) const;
43  inline
44  const GeoDataPolygon *polygon() const { return m_polygon; }
45  inline
46  const GeoDataLinearRing *ring() const { return m_ring; }
47  inline
48  const GeoDataBuilding *building() const { return m_building; }
49 
50  static int extractElevation(const GeoDataPlacemark &placemark);
51 
52 private:
53  QPixmap texture(const QString &path, const QColor &color) const;
54 
55  const GeoDataPolygon * m_polygon;
56  const GeoDataLinearRing * m_ring;
57  const GeoDataBuilding *const m_building;
58 };
59 
60 }
61 
62 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.