• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataPolyStyle.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2008 Patrick Spendrin <ps_ml@gmx.de>
9 //
10 
11 
12 #include "GeoDataPolyStyle.h"
13 
14 #include "GeoDataTypes.h"
15 
16 namespace Marble
17 {
18 
19 class GeoDataPolyStylePrivate
20 {
21  public:
22  GeoDataPolyStylePrivate()
23  : m_fill( true ), m_outline( true ), m_brushStyle( Qt::SolidPattern )
24  {
25  }
26 
27  const char* nodeType() const
28  {
29  return GeoDataTypes::GeoDataPolyStyleType;
30  }
31 
33  bool m_fill;
35  bool m_outline;
36  Qt::BrushStyle m_brushStyle;
38  quint8 m_colorIndex;
39 };
40 
41 GeoDataPolyStyle::GeoDataPolyStyle()
42  : d( new GeoDataPolyStylePrivate )
43 {
44 }
45 
46 GeoDataPolyStyle::GeoDataPolyStyle( const GeoDataPolyStyle& other )
47  : GeoDataColorStyle( other ), d( new GeoDataPolyStylePrivate( *other.d ) )
48 {
49 }
50 
51 GeoDataPolyStyle::GeoDataPolyStyle( const QColor &color )
52  : d( new GeoDataPolyStylePrivate )
53 {
54  setColor( color );
55 }
56 
57 GeoDataPolyStyle::~GeoDataPolyStyle()
58 {
59  delete d;
60 }
61 
62 GeoDataPolyStyle& GeoDataPolyStyle::operator=( const GeoDataPolyStyle& other )
63 {
64  GeoDataColorStyle::operator=( other );
65  *d = *other.d;
66  return *this;
67 }
68 
69 bool GeoDataPolyStyle::operator==( const GeoDataPolyStyle &other ) const
70 {
71  if ( GeoDataColorStyle::operator!=( other ) ) {
72  return false;
73  }
74 
75  return d->m_fill == other.d->m_fill &&
76  d->m_outline == other.d->m_outline &&
77  d->m_brushStyle == other.d->m_brushStyle;
78 }
79 
80 bool GeoDataPolyStyle::operator!=( const GeoDataPolyStyle &other ) const
81 {
82  return !this->operator==( other );
83 }
84 
85 const char* GeoDataPolyStyle::nodeType() const
86 {
87  return d->nodeType();
88 }
89 
90 void GeoDataPolyStyle::setFill( const bool &fill )
91 {
92  d->m_fill = fill;
93 }
94 
95 bool GeoDataPolyStyle::fill() const
96 {
97  return d->m_fill;
98 }
99 
100 void GeoDataPolyStyle::setOutline( const bool &outline )
101 {
102  d->m_outline = outline;
103 }
104 
105 bool GeoDataPolyStyle::outline() const
106 {
107  return d->m_outline;
108 }
109 
110 void GeoDataPolyStyle::setBrushStyle( const Qt::BrushStyle style )
111 {
112  d->m_brushStyle = style;
113 }
114 
115 Qt::BrushStyle GeoDataPolyStyle::brushStyle() const
116 {
117  return d->m_brushStyle;
118 }
119 
120 void GeoDataPolyStyle::setColorIndex( quint8 colorIndex )
121 {
122  d->m_colorIndex = colorIndex;
123 }
124 
125 quint8 GeoDataPolyStyle::colorIndex() const
126 {
127  return d->m_colorIndex;
128 }
129 
130 void GeoDataPolyStyle::pack( QDataStream& stream ) const
131 {
132  GeoDataColorStyle::pack( stream );
133 
134  stream << d->m_fill;
135  stream << d->m_outline;
136  stream << d->m_colorIndex;
137 }
138 
139 void GeoDataPolyStyle::unpack( QDataStream& stream )
140 {
141  GeoDataColorStyle::unpack( stream );
142 
143  stream >> d->m_fill;
144  stream >> d->m_outline;
145  stream >> d->m_colorIndex;
146 }
147 
148 }
Marble::GeoDataPolyStyle::operator==
bool operator==(const GeoDataPolyStyle &other) const
Definition: GeoDataPolyStyle.cpp:69
Marble::GeoDataPolyStyle::fill
bool fill() const
Return true if polygons get filled.
Definition: GeoDataPolyStyle.cpp:95
Marble::GeoDataTypes::GeoDataPolyStyleType
const char * GeoDataPolyStyleType
Definition: GeoDataTypes.cpp:70
QDataStream
Marble::GeoDataColorStyle::setColor
void setColor(const QColor &value)
Set a new color.
Definition: GeoDataColorStyle.cpp:84
Marble::GeoDataPolyStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataPolyStyle.cpp:139
Marble::GeoDataPolyStyle::GeoDataPolyStyle
GeoDataPolyStyle()
Construct a new GeoDataPolyStyle.
Definition: GeoDataPolyStyle.cpp:41
Marble::GeoDataPolyStyle::operator!=
bool operator!=(const GeoDataPolyStyle &other) const
Definition: GeoDataPolyStyle.cpp:80
Marble::GeoDataPolyStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataPolyStyle.cpp:130
Marble::GeoDataPolyStyle::~GeoDataPolyStyle
~GeoDataPolyStyle()
Definition: GeoDataPolyStyle.cpp:57
Marble::GeoDataPolyStyle::operator=
GeoDataPolyStyle & operator=(const GeoDataPolyStyle &other)
assignment operator
Definition: GeoDataPolyStyle.cpp:62
Marble::GeoDataColorStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataColorStyle.cpp:118
Marble::GeoDataPolyStyle::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataPolyStyle.cpp:85
Marble::GeoDataColorStyle
an abstract base class for various style classes
Definition: GeoDataColorStyle.h:64
Marble::GeoDataPolyStyle::setFill
void setFill(const bool &fill)
Set whether to fill the polygon.
Definition: GeoDataPolyStyle.cpp:90
QColor
Marble::GeoDataPolyStyle::outline
bool outline() const
Return true if outlines of polygons get drawn.
Definition: GeoDataPolyStyle.cpp:105
Marble::GeoDataPolyStyle::brushStyle
Qt::BrushStyle brushStyle() const
Return brush style.
Definition: GeoDataPolyStyle.cpp:115
Marble::GeoDataColorStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataColorStyle.cpp:127
Marble::GeoDataPolyStyle::colorIndex
quint8 colorIndex() const
Return the value of color index.
Definition: GeoDataPolyStyle.cpp:125
Marble::GeoDataPolyStyle::setBrushStyle
void setBrushStyle(const Qt::BrushStyle style)
Set brush style.
Definition: GeoDataPolyStyle.cpp:110
GeoDataTypes.h
Marble::GeoDataPolyStyle::setOutline
void setOutline(const bool &outline)
Set whether to draw the outline.
Definition: GeoDataPolyStyle.cpp:100
Marble::GeoDataColorStyle::operator=
GeoDataColorStyle & operator=(const GeoDataColorStyle &other)
assignment operator
Definition: GeoDataColorStyle.cpp:61
Marble::GeoDataPolyStyle
specifies the style how polygons are drawn
Definition: GeoDataPolyStyle.h:34
GeoDataPolyStyle.h
Marble::GeoDataPolyStyle::setColorIndex
void setColorIndex(quint8 colorIndex)
Set the color index which will be used to assign color to brush.
Definition: GeoDataPolyStyle.cpp:120
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal