File indexing completed on 2024-05-12 03:50:11

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2007 Torsten Rahn <rahn@kde.org>
0004 // SPDX-FileCopyrightText: 2008 Inge Wallin <inge@lysator.liu.se>
0005 //
0006 
0007 
0008 #ifndef MARBLE_GEODATAHOTSPOT_H
0009 #define MARBLE_GEODATAHOTSPOT_H
0010 
0011 #include <QPointF>
0012 
0013 #include "GeoDataObject.h"
0014 
0015 #include "geodata_export.h"
0016 
0017 namespace Marble
0018 {
0019 
0020 class GeoDataHotSpotPrivate;
0021 
0022 /**
0023  */
0024 class GEODATA_EXPORT GeoDataHotSpot : public GeoDataObject
0025 {
0026   public:
0027     enum Units{Fraction, Pixels, InsetPixels};
0028 
0029     GeoDataHotSpot( const QPointF& hotSpot = QPointF( 0.5, 0.5 ),
0030                     Units xunits = Fraction, Units yunits = Fraction );
0031     GeoDataHotSpot( const GeoDataHotSpot& other );
0032     ~GeoDataHotSpot() override;
0033 
0034     GeoDataHotSpot& operator=( const GeoDataHotSpot& other );
0035     bool operator==( const GeoDataHotSpot& other ) const;
0036     bool operator!=( const GeoDataHotSpot& other ) const;
0037 
0038     /// Provides type information for downcasting a GeoData
0039     const char* nodeType() const override;
0040 
0041     /**
0042     * @brief this function returns the hotspot and the units the hotspot is measured in
0043     * @param xunits after running hotspot, you'll receive the unit in which x is measured
0044     * @param yunits the same for y
0045     * @return the point of the hotspot
0046     */
0047     const QPointF& hotSpot( Units& xunits, Units& yunits ) const;
0048 
0049     void setHotSpot( const QPointF& hotSpot = QPointF( 0.5, 0.5 ),
0050                      Units xunits = Fraction, Units yunits = Fraction );
0051 
0052     /// Serialize the contents of the feature to @p stream.
0053     void pack( QDataStream& stream ) const override;
0054     /// Unserialize the contents of the feature from @p stream.
0055     void unpack( QDataStream& stream ) override;
0056 
0057   private:
0058     GeoDataHotSpotPrivate *const d;
0059 };
0060 
0061 }
0062 
0063 #endif