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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012-2016 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0004 //
0005 
0006 #ifndef MARBLE_FLOATITEMSLAYER_H
0007 #define MARBLE_FLOATITEMSLAYER_H
0008 
0009 #include <QObject>
0010 #include "LayerInterface.h"
0011 
0012 #include <QList>
0013 #include <QRegion>
0014 
0015 namespace Marble
0016 {
0017 
0018 class AbstractFloatItem;
0019 class RenderPlugin;
0020 
0021 /**
0022  * @brief Layer for handling the rendering of screen-positioned, 2D float items.
0023  */
0024 class FloatItemsLayer : public QObject, public LayerInterface
0025 {
0026     Q_OBJECT
0027 
0028  public:
0029     explicit FloatItemsLayer(QObject *parent = nullptr);
0030 
0031     QStringList renderPosition() const override;
0032 
0033     bool render(GeoPainter *painter, ViewportParams *viewport,
0034        const QString &renderPos = "NONE", GeoSceneLayer *layer = nullptr) override;
0035 
0036     void addFloatItem(AbstractFloatItem *floatItem);
0037 
0038     /**
0039      * @brief Returns a list of all FloatItems of the layer
0040      * @return the list of the floatItems
0041      */
0042     QList<AbstractFloatItem *> floatItems() const;
0043 
0044     QString runtimeTrace() const override;
0045 
0046  Q_SIGNALS:
0047     /**
0048      * @brief Signal that a render item has been initialized
0049      */
0050     void renderPluginInitialized(RenderPlugin *renderPlugin);
0051 
0052     /**
0053      * This signal is emitted when the repaint of the view was requested by a plugin.
0054      * If available with the @p dirtyRegion which is the region the view will change in.
0055      * If dirtyRegion.isEmpty() returns true, the whole viewport has to be repainted.
0056      */
0057     void repaintNeeded(const QRegion &dirtyRegion = QRegion());
0058 
0059     void visibilityChanged(const QString &nameId, bool visible);
0060 
0061     void pluginSettingsChanged();
0062 
0063  private Q_SLOTS:
0064     void updateVisibility(bool visible, const QString &nameId);
0065 
0066  private:
0067     QList<AbstractFloatItem *> m_floatItems;
0068 };
0069 
0070 }
0071 
0072 #endif