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_BUILDINGGRAPHICSITEM_H 0007 #define MARBLE_BUILDINGGRAPHICSITEM_H 0008 0009 #include "AbstractGeoPolygonGraphicsItem.h" 0010 #include "GeoDataCoordinates.h" 0011 0012 class QPointF; 0013 0014 namespace Marble 0015 { 0016 0017 class DIGIKAM_EXPORT BuildingGraphicsItem : public AbstractGeoPolygonGraphicsItem 0018 { 0019 public: 0020 BuildingGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataBuilding *building); 0021 ~BuildingGraphicsItem() override; 0022 0023 public: 0024 void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override; 0025 0026 private: 0027 void paintFrame(GeoPainter* painter, const ViewportParams *viewport); 0028 0029 void paintRoof(GeoPainter* painter, const ViewportParams *viewport); 0030 bool configurePainterForFrame(GeoPainter *painter) const; 0031 void initializeBuildingPainting(const GeoPainter* painter, const ViewportParams *viewport, 0032 bool &drawAccurate3D, bool &isCameraAboveBuilding) const; 0033 void updatePolygons(const ViewportParams &viewport, 0034 QVector<QPolygonF*>& outlinePolygons, 0035 QVector<QPolygonF*>& innerPolygons, 0036 bool &hasInnerBoundaries) const; 0037 0038 QPointF buildingOffset(const QPointF &point, const ViewportParams *viewport, bool* isCameraAboveBuilding = nullptr) const; 0039 0040 static QPointF centroid(const QPolygonF &polygon, double &area); 0041 static void screenPolygons(const ViewportParams &viewport, const GeoDataPolygon *polygon, 0042 QVector<QPolygonF*> &polygons, 0043 QVector<QPolygonF*> &outlines 0044 ); 0045 0046 bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override; 0047 0048 private: 0049 QVector<QPolygonF*> m_cachedOuterPolygons; 0050 QVector<QPolygonF*> m_cachedInnerPolygons; 0051 QVector<QPolygonF*> m_cachedOuterRoofPolygons; 0052 QVector<QPolygonF*> m_cachedInnerRoofPolygons; 0053 bool m_hasInnerBoundaries; 0054 0055 }; 0056 0057 } 0058 0059 #endif