File indexing completed on 2025-01-05 03:59:18
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org> 0004 // SPDX-FileCopyrightText: 2007-2008 Inge Wallin <ingwa@kde.org> 0005 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de> 0006 // 0007 0008 // 0009 // PlacemarkLayer is responsible for drawing the Placemarks on the map 0010 // 0011 0012 #ifndef MARBLE_PLACEMARKLAYER_H 0013 #define MARBLE_PLACEMARKLAYER_H 0014 0015 0016 #include <QObject> 0017 #include "LayerInterface.h" 0018 0019 #include <QVector> 0020 #include <QPainter> 0021 0022 #include "PlacemarkLayout.h" 0023 0024 class QAbstractItemModel; 0025 class QItemSelectionModel; 0026 class QString; 0027 0028 namespace Marble 0029 { 0030 0031 class GeoPainter; 0032 class GeoSceneLayer; 0033 class MarbleClock; 0034 class ViewportParams; 0035 class StyleBuilder; 0036 0037 0038 struct Fragment 0039 { 0040 QVarLengthArray<QPainter::PixmapFragment, 16> fragments; 0041 QPixmap pixmap; 0042 }; 0043 0044 class PlacemarkLayer : public QObject, public LayerInterface 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 PlacemarkLayer( QAbstractItemModel *placemarkModel, 0050 QItemSelectionModel *selectionModel, 0051 MarbleClock *clock, 0052 const StyleBuilder *styleBuilder, 0053 QObject *parent = nullptr ); 0054 ~PlacemarkLayer() override; 0055 0056 /** 0057 * @reimp 0058 */ 0059 QStringList renderPosition() const override; 0060 0061 /** 0062 * @reimp 0063 */ 0064 qreal zValue() const override; 0065 0066 /** 0067 * @reimp 0068 */ 0069 bool render( GeoPainter *painter, ViewportParams *viewport, 0070 const QString &renderPos = QLatin1String("NONE"), 0071 GeoSceneLayer *layer = nullptr ) override; 0072 0073 RenderState renderState() const override; 0074 0075 QString runtimeTrace() const override; 0076 0077 /** 0078 * Returns a list of model indexes that are at position @p pos. 0079 */ 0080 QVector<const GeoDataFeature *> whichPlacemarkAt( const QPoint &pos ); 0081 0082 bool hasPlacemarkAt(const QPoint &pos); 0083 0084 bool isDebugModeEnabled() const; 0085 void setDebugModeEnabled(bool enabled); 0086 0087 void setLevelTagDebugModeEnabled(bool enabled); 0088 bool levelTagDebugModeEnabled() const; 0089 void setDebugLevelTag(int level); 0090 0091 public Q_SLOTS: 0092 // earth 0093 void setShowPlaces( bool show ); 0094 void setShowCities( bool show ); 0095 void setShowTerrain( bool show ); 0096 void setShowOtherPlaces( bool show ); 0097 0098 // other planets 0099 void setShowLandingSites( bool show ); 0100 void setShowCraters( bool show ); 0101 void setShowMaria( bool show ); 0102 0103 void requestStyleReset(); 0104 void setTileLevel(int tileLevel); 0105 0106 Q_SIGNALS: 0107 void repaintNeeded(); 0108 0109 private: 0110 void renderDebug(GeoPainter *painter, ViewportParams *viewport, const QVector<VisiblePlacemark*> & placemarks) const; 0111 0112 PlacemarkLayout m_layout; 0113 bool m_debugModeEnabled; 0114 bool m_levelTagDebugModeEnabled; 0115 int m_tileLevel; 0116 int m_debugLevelTag; 0117 }; 0118 0119 } 0120 0121 #endif