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

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_GEODATAPOLYSTYLE_H
0008 #define MARBLE_GEODATAPOLYSTYLE_H
0009 
0010 #include "GeoDataColorStyle.h"
0011 
0012 #include "geodata_export.h"
0013 
0014 namespace Marble
0015 {
0016 
0017 class GeoDataPolyStylePrivate;
0018 
0019 /**
0020  * @short specifies the style how polygons are drawn
0021  *
0022  * A GeoDataPolyStyle specifies how Polygons are drawn in the viewer. 
0023  * A custom color, color mode (both inherited from GeoDataColorStyle) 
0024  * and two boolean values whether to fill and whether to draw the outline.
0025  */
0026 class GEODATA_EXPORT GeoDataPolyStyle : public GeoDataColorStyle
0027 {
0028   public:
0029     /// Construct a new GeoDataPolyStyle
0030     GeoDataPolyStyle();
0031     GeoDataPolyStyle( const GeoDataPolyStyle& other );
0032     /**
0033      * @brief Construct a new GeoDataPolyStyle
0034      * @param  color  the color to use when showing the name @see GeoDataColorStyle
0035      */
0036     explicit GeoDataPolyStyle( const QColor &color );
0037 
0038     ~GeoDataPolyStyle() override;
0039     
0040     /**
0041     * @brief assignment operator
0042     */
0043     GeoDataPolyStyle& operator=( const GeoDataPolyStyle& other );
0044 
0045     bool operator==( const GeoDataPolyStyle &other ) const;
0046     bool operator!=( const GeoDataPolyStyle &other ) const;
0047 
0048     /// Provides type information for downcasting a GeoNode
0049     const char* nodeType() const override;
0050 
0051     /**
0052      * @brief Set whether to fill the polygon
0053      * @param  fill  
0054      */
0055     void setFill(bool fill);
0056     /**
0057      * @brief Return true if polygons get filled
0058      * @return whether to fill
0059      */
0060     bool fill() const;
0061 
0062     /**
0063      * @brief Set whether to draw the outline
0064      * @param  outline  
0065      */
0066     void setOutline(bool outline);
0067     /**
0068      * @brief Return true if outlines of polygons get drawn
0069      * @return whether outline is drawn
0070      */
0071     bool outline() const;
0072     
0073     /**
0074      * @brief Set brush style
0075      * @param style  
0076      */
0077     void setBrushStyle( const Qt::BrushStyle style );
0078     /**
0079      * @brief Return brush style
0080      * @return brush style.
0081      */
0082     Qt::BrushStyle brushStyle() const;
0083 
0084     /**
0085      * @brief Set the color index which will be used to assign color to brush
0086      * @param colorIndex The value of color index
0087      */
0088     void setColorIndex( quint8 colorIndex );
0089 
0090     /**
0091      * @brief Return the value of color index
0092      * @return Color index
0093      */
0094     quint8 colorIndex() const;
0095 
0096     void setTexturePath( const QString &path );
0097 
0098     QString texturePath() const;
0099 
0100     QImage textureImage() const;
0101 
0102     /**
0103      * @brief  Serialize the style to a stream.
0104      * @param  stream  the stream
0105      */
0106     void pack( QDataStream& stream ) const override;
0107     /**
0108      * @brief  Unserialize the style from a stream
0109      * @param  stream  the stream
0110      */
0111     void unpack( QDataStream& stream ) override;
0112 
0113   private:
0114     GeoDataPolyStylePrivate * const d;
0115 };
0116 
0117 }
0118 
0119 #endif