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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Torsten Rahn <tackat@kde.org>
0004 //
0005 
0006 
0007 #ifndef MARBLE_GEODATALOD_H
0008 #define MARBLE_GEODATALOD_H
0009 
0010 #include "GeoDataObject.h"
0011 
0012 
0013 namespace Marble
0014 {
0015 
0016 class GeoDataLodPrivate;
0017 
0018 /*!
0019     \class GeoDataLod
0020     \brief The level of detail which indicates visibility and importance.
0021 
0022     GeoDataLod is a tool class that implements the Lod tag/class
0023     of the Open Geospatial Consortium standard KML 2.2.
0024 
0025     "Lod" is an abbreviation for "Level of Detail" and refers to 
0026     the extent of the region of a feature.
0027     In geodesic coordinates the size of the region can be described 
0028     in terms of a LatLon(Alt)Box. 
0029     Projected to screen coordinates the size of a region would naturally
0030     be measured in pixels.
0031     The size of such a region varies depending on the distance of the 
0032     observer towards the feature. 
0033     
0034     The "Level of Detail" describes how many pixels a region needs to
0035     cover in order to be considered "active" and visible. 
0036     It also describes how "quickly" the feature fades in and out. 
0037 */
0038 
0039 class GEODATA_EXPORT GeoDataLod : public GeoDataObject
0040 {
0041 
0042   public:
0043 /*!
0044     \brief Creates a new Level of Detail object.
0045 */
0046     GeoDataLod();
0047 
0048 /*!
0049     \brief Creates a new Level of Detail object as a copy of @p other.
0050 */
0051     GeoDataLod( const GeoDataLod& other );
0052     
0053 /*!
0054     \brief Destroys a Level of Detail object.
0055 */
0056     ~GeoDataLod() override;
0057 
0058 
0059 /*!
0060     \brief Provides type information for downcasting a GeoNode
0061 */
0062 
0063     bool operator==( const GeoDataLod &other ) const;
0064     bool operator!=( const GeoDataLod &other ) const;
0065 
0066     const char* nodeType() const override;
0067 
0068 
0069 /*!
0070     \brief Returns the minimum size that is needed for the region to be active
0071     Returns the minimum number of pixels the region has to be projected on for
0072     the feature to be considered active. 
0073     A value of 0 would mean no minimum number of pixels which is also the
0074     standard value.
0075 */
0076     qreal minLodPixels() const;
0077 
0078 
0079 /*!
0080     \brief Sets the minimum size that is needed for the region to be active
0081     Sets the minimum number of \a pixels the region has to be projected on for
0082     the feature to be considered active.
0083 */
0084     void setMinLodPixels( qreal pixels );
0085 
0086 
0087 /*!
0088     \brief Returns the maximum size that is needed for the region to be active
0089     Returns the maximum number of pixels the region has to be projected on for
0090     the feature to be considered active. 
0091     A value of -1 would mean no minimum number of pixels which is also the
0092     standard value.
0093 */
0094     qreal maxLodPixels() const;
0095 
0096 
0097 /*!
0098     \brief Sets the maximum size that is needed for the region to be active
0099     Sets the maximum number of \a pixels the region has to be projected on for
0100     the feature to be considered active.
0101 */
0102     void setMaxLodPixels( qreal pixels );
0103 
0104 
0105 /*!
0106     \brief Returns how "quickly" the region fades when the region is far away.
0107     Returns the distance (counted from minLodPixels) over which the feature
0108     fades in or out. 
0109 */
0110     qreal minFadeExtent() const;
0111 
0112 
0113 /*!
0114     \brief Sets how "quickly" the region fades when the region is far away.
0115     Sets the distance (counted from minLodPixels) over which the feature fades
0116     in or out. 
0117 */
0118     void setMinFadeExtent( qreal pixels );
0119 
0120 
0121 /*!
0122     \brief Returns how "quickly" the region fades when the region is near.
0123     Returns the distance (counted from maxLodPixels) over which the feature
0124     fades in or out. 
0125 */
0126     qreal maxFadeExtent() const;
0127 
0128 
0129 /*!
0130     \brief Sets how "quickly" the region fades when the region is near.
0131     Sets the distance (counted from maxLodPixels) over which the feature fades
0132     in or out. 
0133 */
0134     void setMaxFadeExtent( qreal pixels );
0135 
0136 
0137     // Serialization
0138 /*!
0139     \brief Serialize the Lod to a stream.
0140     \param stream the stream.
0141 */
0142     void pack( QDataStream& stream ) const override;
0143 
0144 
0145 /*!
0146     \brief Unserialize the Lod from a stream.
0147     \param stream the stream.
0148 */
0149     void unpack( QDataStream& stream ) override;
0150 
0151     GeoDataLod &operator=( const GeoDataLod& other );
0152 
0153  protected:
0154     GeoDataLodPrivate  * const d;
0155 };
0156 
0157 }
0158 
0159 #endif