File indexing completed on 2024-04-14 03:47:45

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Bastian Holst <bastianholst@gmx.de>
0004 // SPDX-FileCopyrightText: 2011 Konstantin Oblaukhov <oblaukhov.konstantin@gmail.com>
0005 //
0006 
0007 #ifndef MARBLE_GEOGRAPHICSSCENE_H
0008 #define MARBLE_GEOGRAPHICSSCENE_H
0009 
0010 #include "marble_export.h"
0011 #include "MarbleGlobal.h"
0012 
0013 #include <QObject>
0014 #include <QList>
0015 
0016 namespace Marble
0017 {
0018 
0019 class GeoGraphicsItem;
0020 class GeoDataFeature;
0021 class GeoDataLatLonBox;
0022 class GeoGraphicsScenePrivate;
0023 class GeoDataPlacemark;
0024 
0025 /**
0026  * @short This is the home of all GeoGraphicsItems to be shown on the map.
0027  */
0028 class MARBLE_EXPORT GeoGraphicsScene : public QObject
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     /**
0034      * Creates a new instance of GeoGraphicsScene
0035      * @param parent the QObject parent of the Scene
0036      */
0037     explicit GeoGraphicsScene( QObject *parent = nullptr );
0038     ~GeoGraphicsScene() override;
0039 
0040     /**
0041      * @brief Add an item to the GeoGraphicsScene
0042      * Adds the item @p item to the GeoGraphicsScene
0043      */
0044     void addItem( GeoGraphicsItem *item );
0045 
0046     /**
0047      * @brief Remove all concerned items from the GeoGraphicsScene
0048      * Removes all items which are associated with @p object from the GeoGraphicsScene
0049      */
0050     void removeItem( const GeoDataFeature *feature );
0051 
0052     /**
0053      * @brief Remove all items from the GeoGraphicsScene
0054      */
0055     void clear();
0056 
0057     /**
0058      * @brief Get the list of items in the specified Box
0059      *
0060      * @param box The box around the items.
0061      * @param maxZoomLevel The max zoom level of tiling
0062      * @return The list of items in the specified box in no specific order.
0063      */
0064     QList<GeoGraphicsItem *> items( const GeoDataLatLonBox &box, int maxZoomLevel ) const;
0065 
0066     /**
0067      * @brief Get the list of items which belong to a placemark
0068      * that has been clicked.
0069      * @return Returns a list of selected Items
0070      */
0071     QList<GeoGraphicsItem*> selectedItems() const;
0072 
0073     void resetStyle();
0074 
0075 public Q_SLOTS:
0076     void applyHighlight( const QVector<GeoDataPlacemark*>& );
0077 
0078 Q_SIGNALS:
0079     void repaintNeeded();
0080 
0081 private:
0082     GeoGraphicsScenePrivate * const d;
0083 };
0084 }
0085 #endif // MARBLE_GEOGRAPHICSSCENE_H