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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
0004 //
0005 
0006 
0007 #ifndef MARBLE_GEODATASTYLEMAP_H
0008 #define MARBLE_GEODATASTYLEMAP_H
0009 
0010 
0011 #include <QString>
0012 #include <QMap>
0013 
0014 #include "GeoDataStyleSelector.h"
0015 
0016 #include "geodata_export.h"
0017 
0018 namespace Marble
0019 {
0020 
0021 class GeoDataStyleMapPrivate;
0022 /**
0023  * @short a class to map different styles to one style
0024  *
0025  * A GeoDataStyleMap connects styles for highlighted and normal
0026  * context. Besides GeoDataStyleSelector it derives from
0027  * QMap<QString, QString>.
0028  *
0029  * @see GeoDataStyle
0030  * @see GeoDataStyleSelector
0031  */
0032 class GEODATA_EXPORT GeoDataStyleMap : public GeoDataStyleSelector,
0033                                        public QMap<QString, QString>
0034 {
0035   public:
0036     /// Provides type information for downcasting a GeoNode
0037     const char* nodeType() const override;
0038 
0039     /**
0040     * @brief return the last key
0041     */
0042     QString lastKey() const;
0043     /**
0044     * @brief Set the last key
0045     * this property is needed to set an entry in the kml parser
0046     * after the parser has set the last key, it will read the value
0047     * and add both to this map
0048     * @param key the last key
0049     */
0050     void setLastKey( const QString& key );
0051     
0052     /**
0053     * @brief assignment operator
0054     * @param other the styleMap which gets duplicated.
0055     */
0056     GeoDataStyleMap& operator=( const GeoDataStyleMap& other );
0057 
0058     bool operator==( const GeoDataStyleMap &other ) const;
0059     bool operator!=( const GeoDataStyleMap &other ) const;
0060 
0061     /**
0062      * @brief Serialize the stylemap to a stream
0063      * @param  stream  the stream
0064      */
0065     void pack( QDataStream& stream ) const override;
0066     /**
0067      * @brief  Unserialize the stylemap from a stream
0068      * @param  stream  the stream
0069      */
0070     void unpack( QDataStream& stream ) override;
0071 
0072     GeoDataStyleMap();
0073     GeoDataStyleMap( const GeoDataStyleMap& other );
0074     ~GeoDataStyleMap() override;
0075 
0076   private:
0077     GeoDataStyleMapPrivate * const d;
0078 };
0079 
0080 }
0081 
0082 #endif