Marble

PlacemarkLayer.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <[email protected]>
4 // SPDX-FileCopyrightText: 2007-2008 Inge Wallin <[email protected]>
5 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <[email protected]>
6 //
7 
8 //
9 // PlacemarkLayer is responsible for drawing the Placemarks on the map
10 //
11 
12 #ifndef MARBLE_PLACEMARKLAYER_H
13 #define MARBLE_PLACEMARKLAYER_H
14 
15 
16 #include <QObject>
17 #include "LayerInterface.h"
18 
19 #include <QVector>
20 #include <QPainter>
21 
22 #include "PlacemarkLayout.h"
23 
24 class QAbstractItemModel;
26 class QString;
27 
28 namespace Marble
29 {
30 
31 class GeoPainter;
32 class GeoSceneLayer;
33 class MarbleClock;
34 class ViewportParams;
35 class StyleBuilder;
36 
37 
38 struct Fragment
39 {
41  QPixmap pixmap;
42 };
43 
44 class PlacemarkLayer : public QObject, public LayerInterface
45 {
46  Q_OBJECT
47 
48  public:
49  PlacemarkLayer( QAbstractItemModel *placemarkModel,
50  QItemSelectionModel *selectionModel,
51  MarbleClock *clock,
52  const StyleBuilder *styleBuilder,
53  QObject *parent = nullptr );
54  ~PlacemarkLayer() override;
55 
56  /**
57  * @reimp
58  */
59  QStringList renderPosition() const override;
60 
61  /**
62  * @reimp
63  */
64  qreal zValue() const override;
65 
66  /**
67  * @reimp
68  */
69  bool render( GeoPainter *painter, ViewportParams *viewport,
70  const QString &renderPos = QLatin1String("NONE"),
71  GeoSceneLayer *layer = nullptr ) override;
72 
73  RenderState renderState() const override;
74 
75  QString runtimeTrace() const override;
76 
77  /**
78  * Returns a list of model indexes that are at position @p pos.
79  */
80  QVector<const GeoDataFeature *> whichPlacemarkAt( const QPoint &pos );
81 
82  bool hasPlacemarkAt(const QPoint &pos);
83 
84  bool isDebugModeEnabled() const;
85  void setDebugModeEnabled(bool enabled);
86 
87  void setLevelTagDebugModeEnabled(bool enabled);
88  bool levelTagDebugModeEnabled() const;
89  void setDebugLevelTag(int level);
90 
91  public Q_SLOTS:
92  // earth
93  void setShowPlaces( bool show );
94  void setShowCities( bool show );
95  void setShowTerrain( bool show );
96  void setShowOtherPlaces( bool show );
97 
98  // other planets
99  void setShowLandingSites( bool show );
100  void setShowCraters( bool show );
101  void setShowMaria( bool show );
102 
103  void requestStyleReset();
104  void setTileLevel(int tileLevel);
105 
106  Q_SIGNALS:
107  void repaintNeeded();
108 
109  private:
110  void renderDebug(GeoPainter *painter, ViewportParams *viewport, const QVector<VisiblePlacemark*> & placemarks) const;
111 
112  PlacemarkLayout m_layout;
113  bool m_debugModeEnabled;
114  bool m_levelTagDebugModeEnabled;
115  int m_tileLevel;
116  int m_debugLevelTag;
117 };
118 
119 }
120 
121 #endif
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
Binds a QML item to a specific geodetic location in screen coordinates.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.