File indexing completed on 2024-05-05 03:49:47

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0004 //
0005 
0006 #ifndef MARBLE_BILLBOARDGRAPHICSITEM_H
0007 #define MARBLE_BILLBOARDGRAPHICSITEM_H
0008 
0009 #include "MarbleGraphicsItem.h"
0010 #include "marble_export.h"
0011 
0012 #include <Qt>
0013 
0014 class QPointF;
0015 
0016 namespace Marble
0017 {
0018 class GeoDataCoordinates;
0019 class BillboardGraphicsItemPrivate;
0020 
0021 /**
0022  * @brief Base class for all 2D labels (a.k.a. billboards) in 3D space.
0023  *
0024  * A BillboardGraphicsItem represents a point of interest on a planet with a geo location.
0025  * As a result, it may appear more than once on the map, depending on the projection and
0026  * the zoom level.
0027  */
0028 class MARBLE_EXPORT BillboardGraphicsItem : public MarbleGraphicsItem
0029 {
0030  public:
0031     BillboardGraphicsItem();
0032 
0033     GeoDataCoordinates coordinate() const;
0034     void setCoordinate( const GeoDataCoordinates &coordinates );
0035 
0036     Qt::Alignment alignment() const;
0037     void setAlignment( Qt::Alignment alignment );
0038 
0039     /**
0040      * @brief Returns the absolute screen positions of the item.
0041      *
0042      * All elements indicate the position of the topleft corner in screen coordinates and are
0043      * based on the viewport of the last paintEvent(). Note that the result list may contain
0044      * an unbound number of elements, including zero, depending on the item's visibility,
0045      * the projection and zoom level.
0046      * @since 0.26.0
0047      */
0048     QVector<QPointF> positions() const;
0049 
0050     /**
0051      * @brief Returns the absolute screen bounding boxes of the item.
0052      * @since 0.26.0
0053      */
0054     QVector<QRectF> boundingRects() const;
0055 
0056     /**
0057      * Returns the rect of one representation of the object that is at the given position.
0058      */
0059     QRectF containsRect( const QPointF &point ) const;
0060 
0061  private:
0062     Q_DECLARE_PRIVATE(BillboardGraphicsItem)
0063 };
0064 
0065 } // Marble namespace
0066 
0067 #endif