• 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
GeoDataLineStyle.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 "GeoDataLineStyle.h"
13 
14 #include "GeoDataTypes.h"
15 
16 namespace Marble
17 {
18 
19 class GeoDataLineStylePrivate
20 {
21  public:
22  GeoDataLineStylePrivate()
23  : m_width( 1.0 ), m_physicalWidth( 0.0 ), m_capStyle( Qt::FlatCap ),
24  m_penStyle( Qt::SolidLine ), m_background( false )
25  {
26  }
27 
28  const char* nodeType() const
29  {
30  return GeoDataTypes::GeoDataLineStyleType;
31  }
32 
34  float m_width;
36  float m_physicalWidth;
37  Qt::PenCapStyle m_capStyle;
38  Qt::PenStyle m_penStyle;
39  bool m_background;
40  QVector< qreal > m_pattern;
41 };
42 
43 GeoDataLineStyle::GeoDataLineStyle()
44  : d (new GeoDataLineStylePrivate )
45 {
46 }
47 
48 GeoDataLineStyle::GeoDataLineStyle( const GeoDataLineStyle& other )
49  : GeoDataColorStyle( other ), d (new GeoDataLineStylePrivate( *other.d ) )
50 {
51 }
52 
53 GeoDataLineStyle::GeoDataLineStyle( const QColor &color )
54  : d ( new GeoDataLineStylePrivate )
55 {
56  setColor( color );
57 }
58 
59 GeoDataLineStyle::~GeoDataLineStyle()
60 {
61  delete d;
62 }
63 
64 GeoDataLineStyle& GeoDataLineStyle::operator=( const GeoDataLineStyle& other )
65 {
66  GeoDataColorStyle::operator=( other );
67  *d = *other.d;
68  return *this;
69 }
70 
71 bool GeoDataLineStyle::operator==( const GeoDataLineStyle &other ) const
72 {
73  if ( GeoDataColorStyle::operator!=( other ) ) {
74  return false;
75  }
76 
77  return d->m_width == other.d->m_width &&
78  d->m_physicalWidth == other.d->m_physicalWidth &&
79  d->m_capStyle == other.d->m_capStyle &&
80  d->m_penStyle == other.d->m_penStyle &&
81  d->m_background == other.d->m_background &&
82  d->m_pattern == other.d->m_pattern;
83 }
84 
85 bool GeoDataLineStyle::operator!=( const GeoDataLineStyle &other ) const
86 {
87  return !this->operator==( other );
88 }
89 
90 const char* GeoDataLineStyle::nodeType() const
91 {
92  return d->nodeType();
93 }
94 
95 void GeoDataLineStyle::setWidth( const float &width )
96 {
97  d->m_width = width;
98 }
99 
100 float GeoDataLineStyle::width() const
101 {
102  return d->m_width;
103 }
104 
105 float GeoDataLineStyle::physicalWidth() const
106 {
107  return d->m_physicalWidth;
108 }
109 
110 void GeoDataLineStyle::setPhysicalWidth( const float& realWidth )
111 {
112  d->m_physicalWidth = realWidth;
113 }
114 
115 Qt::PenCapStyle GeoDataLineStyle::capStyle() const
116 {
117  return d->m_capStyle;
118 }
119 
120 void GeoDataLineStyle::setCapStyle( Qt::PenCapStyle style )
121 {
122  d->m_capStyle = style;
123 }
124 
125 Qt::PenStyle GeoDataLineStyle::penStyle() const
126 {
127  return d->m_penStyle;
128 }
129 
130 void GeoDataLineStyle::setPenStyle( Qt::PenStyle style )
131 {
132  d->m_penStyle = style;
133 }
134 
135 bool GeoDataLineStyle::background() const
136 {
137  return d->m_background;
138 }
139 
140 void GeoDataLineStyle::setBackground( bool background )
141 {
142  d->m_background = background;
143 }
144 
145 QVector< qreal > GeoDataLineStyle::dashPattern() const
146 {
147  return d->m_pattern;
148 }
149 
150 void GeoDataLineStyle::setDashPattern( const QVector< qreal >& pattern )
151 {
152  d->m_pattern = pattern;
153 }
154 
155 void GeoDataLineStyle::pack( QDataStream& stream ) const
156 {
157  GeoDataColorStyle::pack( stream );
158 
159  stream << d->m_width;
160  stream << d->m_physicalWidth;
161  stream << (int)d->m_penStyle;
162  stream << (int)d->m_capStyle;
163  stream << d->m_background;
164 }
165 
166 void GeoDataLineStyle::unpack( QDataStream& stream )
167 {
168  GeoDataColorStyle::unpack( stream );
169 
170  stream >> d->m_width;
171  stream >> d->m_physicalWidth;
172  int style;
173  stream >> style;
174  d->m_penStyle = ( Qt::PenStyle ) style;
175  stream >> style;
176  d->m_capStyle = ( Qt::PenCapStyle ) style;
177  stream >> d->m_background;
178 }
179 
180 }
Marble::GeoDataLineStyle::capStyle
Qt::PenCapStyle capStyle() const
Return the current pen cap style.
Definition: GeoDataLineStyle.cpp:115
Marble::GeoDataLineStyle
specifies the style how lines are drawn
Definition: GeoDataLineStyle.h:36
Marble::GeoDataLineStyle::dashPattern
QVector< qreal > dashPattern() const
Return the current dash pattern.
Definition: GeoDataLineStyle.cpp:145
Marble::GeoDataLineStyle::penStyle
Qt::PenStyle penStyle() const
Return the current pen cap style.
Definition: GeoDataLineStyle.cpp:125
Marble::GeoDataLineStyle::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataLineStyle.cpp:90
Marble::GeoDataLineStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataLineStyle.cpp:155
Marble::GeoDataLineStyle::setBackground
void setBackground(bool background)
Set whether to draw the solid background.
Definition: GeoDataLineStyle.cpp:140
QDataStream
Marble::GeoDataColorStyle::setColor
void setColor(const QColor &value)
Set a new color.
Definition: GeoDataColorStyle.cpp:84
GeoDataLineStyle.h
Marble::GeoDataLineStyle::operator==
bool operator==(const GeoDataLineStyle &other) const
Definition: GeoDataLineStyle.cpp:71
Marble::GeoDataLineStyle::~GeoDataLineStyle
~GeoDataLineStyle()
Definition: GeoDataLineStyle.cpp:59
Marble::GeoDataLineStyle::operator=
GeoDataLineStyle & operator=(const GeoDataLineStyle &other)
assignment operator
Definition: GeoDataLineStyle.cpp:64
Marble::GeoDataLineStyle::width
float width() const
Return the current width of the line.
Definition: GeoDataLineStyle.cpp:100
Marble::GeoDataColorStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataColorStyle.cpp:118
Marble::GeoDataLineStyle::setPhysicalWidth
void setPhysicalWidth(const float &realWidth)
Set the physical width of the line (in meters)
Definition: GeoDataLineStyle.cpp:110
Marble::GeoDataColorStyle
an abstract base class for various style classes
Definition: GeoDataColorStyle.h:64
Marble::GeoDataLineStyle::setWidth
void setWidth(const float &width)
Set the width of the line.
Definition: GeoDataLineStyle.cpp:95
Marble::GeoDataLineStyle::setPenStyle
void setPenStyle(Qt::PenStyle style)
Set pen cap style.
Definition: GeoDataLineStyle.cpp:130
Marble::GeoDataLineStyle::setCapStyle
void setCapStyle(Qt::PenCapStyle style)
Set pen cap style.
Definition: GeoDataLineStyle.cpp:120
QColor
Marble::GeoDataLineStyle::operator!=
bool operator!=(const GeoDataLineStyle &other) const
Definition: GeoDataLineStyle.cpp:85
QVector< qreal >
Marble::GeoDataColorStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataColorStyle.cpp:127
Marble::GeoDataLineStyle::setDashPattern
void setDashPattern(const QVector< qreal > &pattern)
Sets the dash pattern.
Definition: GeoDataLineStyle.cpp:150
Marble::GeoDataLineStyle::physicalWidth
float physicalWidth() const
Return the current physical width of the line.
Definition: GeoDataLineStyle.cpp:105
Marble::GeoDataTypes::GeoDataLineStyleType
const char * GeoDataLineStyleType
Definition: GeoDataTypes.cpp:54
GeoDataTypes.h
Marble::GeoDataLineStyle::background
bool background() const
Return true if background get drawn.
Definition: GeoDataLineStyle.cpp:135
Marble::GeoDataColorStyle::operator=
GeoDataColorStyle & operator=(const GeoDataColorStyle &other)
assignment operator
Definition: GeoDataColorStyle.cpp:61
Marble::GeoDataLineStyle::GeoDataLineStyle
GeoDataLineStyle()
Construct a new GeoDataLineStyle.
Definition: GeoDataLineStyle.cpp:43
Marble::GeoDataLineStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataLineStyle.cpp:166
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