File indexing completed on 2024-04-21 03:49:38

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2006-2008 Torsten Rahn <tackat@kde.org>
0004 // SPDX-FileCopyrightText: 2011 Bernahrd Beschow <bbeschow@cs.tu-berlin.de>
0005 //
0006 
0007 #ifndef MARBLE_LAYERMANAGER_H
0008 #define MARBLE_LAYERMANAGER_H
0009 
0010 // Qt
0011 #include <QList>
0012 #include <QObject>
0013 #include <QRegion>
0014 
0015 class QPoint;
0016 class QString;
0017 
0018 namespace Marble
0019 {
0020 
0021 class AbstractDataPlugin;
0022 class AbstractDataPluginItem;
0023 class GeoPainter;
0024 class ViewportParams;
0025 class RenderPlugin;
0026 class RenderState;
0027 class LayerInterface;
0028 
0029 /**
0030  * @short Handles rendering of all active layers in the correct order
0031  *
0032  */
0033 
0034 class LayerManager : public QObject
0035 {
0036     Q_OBJECT
0037 
0038  public:
0039     explicit LayerManager(QObject *parent = nullptr);
0040     ~LayerManager() override;
0041 
0042     void renderLayers( GeoPainter *painter, ViewportParams *viewport );
0043 
0044     bool showBackground() const;
0045 
0046     bool showRuntimeTrace() const;
0047 
0048     void addRenderPlugin(RenderPlugin *renderPlugin);
0049 
0050     /**
0051      * @brief Returns a list of all DataPlugins on the layer
0052      * @return the list of DataPlugins
0053      */
0054     QList<AbstractDataPlugin *> dataPlugins()  const;
0055     
0056     /**
0057      * @brief Returns all items of dataPlugins on the position curpos 
0058      */
0059     QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos ) const;
0060 
0061     /**
0062      * @brief Add a layer to be included in rendering.
0063      */
0064     void addLayer(LayerInterface *layer);
0065 
0066     /**
0067      * @brief Remove a layer from being included in rendering.
0068      */
0069     void removeLayer(LayerInterface *layer);
0070 
0071     QList<LayerInterface *> internalLayers() const;
0072 
0073     RenderState renderState() const;
0074 
0075  Q_SIGNALS:
0076     /**
0077      * @brief Signal that a render item has been initialized
0078      */
0079     void renderPluginInitialized( RenderPlugin *renderPlugin );
0080 
0081     /**
0082      * This signal is emitted when the settings of a plugin changed.
0083      */
0084     void pluginSettingsChanged();
0085 
0086     /**
0087      * This signal is emitted when the repaint of the view was requested by a plugin.
0088      * If available with the @p dirtyRegion which is the region the view will change in.
0089      * If dirtyRegion.isEmpty() returns true, the whole viewport has to be repainted.
0090      */
0091     void repaintNeeded( const QRegion & dirtyRegion = QRegion() );
0092 
0093     void visibilityChanged( const QString &nameId, bool visible );
0094 
0095  public Q_SLOTS:
0096     void setShowBackground( bool show );
0097 
0098     void setShowRuntimeTrace( bool show );
0099 
0100  private:
0101     Q_PRIVATE_SLOT( d, void updateVisibility( bool, const QString & ) )
0102 
0103  private:
0104     Q_DISABLE_COPY( LayerManager )
0105 
0106     class Private;
0107     friend class Private;
0108     Private  * const d;
0109 };
0110 
0111 }
0112 
0113 #endif