Marble

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