Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/geodata/graphicsitem/BuildingGraphicsItem.h
- This file was moved from src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h.
Show All 13 Lines | |||||
14 | #include "AbstractGeoPolygonGraphicsItem.h" | 14 | #include "AbstractGeoPolygonGraphicsItem.h" | ||
15 | #include "GeoDataCoordinates.h" | 15 | #include "GeoDataCoordinates.h" | ||
16 | 16 | | |||
17 | class QPointF; | 17 | class QPointF; | ||
18 | 18 | | |||
19 | namespace Marble | 19 | namespace Marble | ||
20 | { | 20 | { | ||
21 | 21 | | |||
22 | class MARBLE_EXPORT BuildingGeoPolygonGraphicsItem : public AbstractGeoPolygonGraphicsItem | 22 | class MARBLE_EXPORT BuildingGraphicsItem : public AbstractGeoPolygonGraphicsItem | ||
23 | { | 23 | { | ||
24 | public: | 24 | public: | ||
25 | explicit BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataPolygon *polygon); | 25 | BuildingGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataBuilding *building); | ||
rahn: see above. | |||||
26 | explicit BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark, const GeoDataLinearRing *ring); | 26 | ~BuildingGraphicsItem() override; | ||
27 | ~BuildingGeoPolygonGraphicsItem() override; | | |||
28 | 27 | | |||
29 | public: | 28 | public: | ||
30 | void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override; | 29 | void paint(GeoPainter* painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override; | ||
31 | 30 | | |||
32 | private: | 31 | private: | ||
33 | struct NamedEntry { | | |||
34 | GeoDataCoordinates point; | | |||
35 | QString label; | | |||
36 | }; | | |||
37 | | ||||
38 | void paintFrame(GeoPainter* painter, const ViewportParams *viewport); | 32 | void paintFrame(GeoPainter* painter, const ViewportParams *viewport); | ||
39 | 33 | | |||
40 | void paintRoof(GeoPainter* painter, const ViewportParams *viewport); | 34 | void paintRoof(GeoPainter* painter, const ViewportParams *viewport); | ||
41 | bool configurePainterForFrame(GeoPainter *painter) const; | 35 | bool configurePainterForFrame(GeoPainter *painter) const; | ||
42 | void initializeBuildingPainting(const GeoPainter* painter, const ViewportParams *viewport, | 36 | void initializeBuildingPainting(const GeoPainter* painter, const ViewportParams *viewport, | ||
43 | bool &drawAccurate3D, bool &isCameraAboveBuilding) const; | 37 | bool &drawAccurate3D, bool &isCameraAboveBuilding) const; | ||
44 | void updatePolygons( const ViewportParams *viewport, | 38 | void updatePolygons( const ViewportParams *viewport, | ||
45 | QVector<QPolygonF*>& outlinePolygons, | 39 | QVector<QPolygonF*>& outlinePolygons, | ||
46 | QVector<QPolygonF*>& innerPolygons, | 40 | QVector<QPolygonF*>& innerPolygons, | ||
47 | bool &hasInnerBoundaries); | 41 | bool &hasInnerBoundaries); | ||
48 | 42 | | |||
49 | QPointF buildingOffset(const QPointF &point, const ViewportParams *viewport, bool* isCameraAboveBuilding = nullptr) const; | 43 | QPointF buildingOffset(const QPointF &point, const ViewportParams *viewport, bool* isCameraAboveBuilding = nullptr) const; | ||
50 | 44 | | |||
51 | static QPointF centroid(const QPolygonF &polygon, double &area); | 45 | static QPointF centroid(const QPolygonF &polygon, double &area); | ||
52 | void screenPolygons(const ViewportParams *viewport, const GeoDataPolygon* polygon, | 46 | void screenPolygons(const ViewportParams *viewport, const GeoDataPolygon* polygon, | ||
53 | QVector<QPolygonF*> &polygons, | 47 | QVector<QPolygonF*> &polygons, | ||
54 | QVector<QPolygonF*> &outlines | 48 | QVector<QPolygonF*> &outlines | ||
55 | ); | 49 | ); | ||
56 | 50 | | |||
57 | bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override; | 51 | bool contains(const QPoint &screenPosition, const ViewportParams *viewport) const override; | ||
58 | 52 | | |||
59 | static double extractBuildingHeight(const GeoDataPlacemark &placemark); | | |||
60 | static QString extractBuildingLabel(const GeoDataPlacemark &placemark); | | |||
61 | static QVector<NamedEntry> extractNamedEntries(const GeoDataPlacemark &placemark); | | |||
62 | | ||||
63 | private: | 53 | private: | ||
64 | const double m_buildingHeight; | | |||
65 | const QString m_buildingText; | | |||
66 | const QVector<NamedEntry> m_entries; | | |||
67 | QVector<QPolygonF*> m_cachedOuterPolygons; | 54 | QVector<QPolygonF*> m_cachedOuterPolygons; | ||
68 | QVector<QPolygonF*> m_cachedInnerPolygons; | 55 | QVector<QPolygonF*> m_cachedInnerPolygons; | ||
69 | QVector<QPolygonF*> m_cachedOuterRoofPolygons; | 56 | QVector<QPolygonF*> m_cachedOuterRoofPolygons; | ||
70 | QVector<QPolygonF*> m_cachedInnerRoofPolygons; | 57 | QVector<QPolygonF*> m_cachedInnerRoofPolygons; | ||
71 | bool m_hasInnerBoundaries; | 58 | bool m_hasInnerBoundaries; | ||
72 | 59 | | |||
73 | }; | 60 | }; | ||
74 | 61 | | |||
75 | } | 62 | } | ||
76 | 63 | | |||
77 | #endif | 64 | #endif |
see above.