Marble

BuildingGraphicsItem.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Konstantin Oblaukhov <oblaukhov.konstantin@gmail.com>
4//
5
6#ifndef MARBLE_BUILDINGGRAPHICSITEM_H
7#define MARBLE_BUILDINGGRAPHICSITEM_H
8
9#include "AbstractGeoPolygonGraphicsItem.h"
10#include "GeoDataCoordinates.h"
11
12class QPointF;
13
14namespace Marble
15{
16
17class MARBLE_EXPORT BuildingGraphicsItem : public AbstractGeoPolygonGraphicsItem
18{
19public:
20 BuildingGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataBuilding *building);
21 ~BuildingGraphicsItem() override;
22
23public:
24 void paint(GeoPainter *painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override;
25
26private:
27 void paintFrame(GeoPainter *painter, const ViewportParams *viewport);
28
29 void paintRoof(GeoPainter *painter, const ViewportParams *viewport);
30 bool configurePainterForFrame(GeoPainter *painter) const;
31 void initializeBuildingPainting(const GeoPainter *painter, const ViewportParams *viewport, bool &drawAccurate3D, bool &isCameraAboveBuilding) const;
32 void updatePolygons(const ViewportParams &viewport, QList<QPolygonF *> &outlinePolygons, QList<QPolygonF *> &innerPolygons, bool &hasInnerBoundaries) const;
33
34 QPointF buildingOffset(const QPointF &point, const ViewportParams *viewport, bool *isCameraAboveBuilding = nullptr) const;
35
36 static QPointF centroid(const QPolygonF &polygon, double &area);
37 static void screenPolygons(const ViewportParams &viewport, const GeoDataPolygon *polygon, QList<QPolygonF *> &polygons, QList<QPolygonF *> &outlines);
38
39 bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override;
40
41private:
42 QList<QPolygonF *> m_cachedOuterPolygons;
43 QList<QPolygonF *> m_cachedInnerPolygons;
44 QList<QPolygonF *> m_cachedOuterRoofPolygons;
45 QList<QPolygonF *> m_cachedInnerRoofPolygons;
46 bool m_hasInnerBoundaries;
47};
48
49}
50
51#endif
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.