File indexing completed on 2025-01-05 03:59:02
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2011 Konstantin Oblaukhov <oblaukhov.konstantin@gmail.com> 0004 // 0005 0006 #ifndef MARBLE_ABSTRACTGEOPOLYGONGRAPHICSITEM_H 0007 #define MARBLE_ABSTRACTGEOPOLYGONGRAPHICSITEM_H 0008 0009 #include "GeoGraphicsItem.h" 0010 #include "digikam_export.h" 0011 0012 #include <QImage> 0013 #include <QColor> 0014 0015 namespace Marble 0016 { 0017 0018 class GeoDataLinearRing; 0019 class GeoDataPlacemark; 0020 class GeoDataPolygon; 0021 class GeoDataBuilding; 0022 0023 class DIGIKAM_EXPORT AbstractGeoPolygonGraphicsItem : public GeoGraphicsItem 0024 { 0025 protected: 0026 AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon); 0027 AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring); 0028 AbstractGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataBuilding *building); 0029 ~AbstractGeoPolygonGraphicsItem() override; 0030 0031 public: 0032 const GeoDataLatLonAltBox& latLonAltBox() const override; 0033 void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override; 0034 bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override; 0035 0036 void setLinearRing(GeoDataLinearRing* ring); 0037 void setPolygon(GeoDataPolygon* polygon); 0038 0039 static const void *s_previousStyle; 0040 0041 protected: 0042 bool configurePainter(GeoPainter* painter, const ViewportParams &viewport) const; 0043 inline 0044 const GeoDataPolygon *polygon() const { return m_polygon; } 0045 inline 0046 const GeoDataLinearRing *ring() const { return m_ring; } 0047 inline 0048 const GeoDataBuilding *building() const { return m_building; } 0049 0050 static int extractElevation(const GeoDataPlacemark &placemark); 0051 0052 private: 0053 QPixmap texture(const QString &path, const QColor &color) const; 0054 0055 const GeoDataPolygon * m_polygon; 0056 const GeoDataLinearRing * m_ring; 0057 const GeoDataBuilding *const m_building; 0058 }; 0059 0060 } 0061 0062 #endif