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

marble

  • sources
  • kde-4.12
  • 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 const char* GeoDataLineStyle::nodeType() const
72 {
73  return d->nodeType();
74 }
75 
76 void GeoDataLineStyle::setWidth( const float &width )
77 {
78  d->m_width = width;
79 }
80 
81 float GeoDataLineStyle::width() const
82 {
83  return d->m_width;
84 }
85 
86 float GeoDataLineStyle::physicalWidth() const
87 {
88  return d->m_physicalWidth;
89 }
90 
91 void GeoDataLineStyle::setPhysicalWidth( const float& realWidth )
92 {
93  d->m_physicalWidth = realWidth;
94 }
95 
96 Qt::PenCapStyle GeoDataLineStyle::capStyle() const
97 {
98  return d->m_capStyle;
99 }
100 
101 void GeoDataLineStyle::setCapStyle( Qt::PenCapStyle style )
102 {
103  d->m_capStyle = style;
104 }
105 
106 Qt::PenStyle GeoDataLineStyle::penStyle() const
107 {
108  return d->m_penStyle;
109 }
110 
111 void GeoDataLineStyle::setPenStyle( Qt::PenStyle style )
112 {
113  d->m_penStyle = style;
114 }
115 
116 bool GeoDataLineStyle::background() const
117 {
118  return d->m_background;
119 }
120 
121 void GeoDataLineStyle::setBackground( bool background )
122 {
123  d->m_background = background;
124 }
125 
126 QVector< qreal > GeoDataLineStyle::dashPattern() const
127 {
128  return d->m_pattern;
129 }
130 
131 void GeoDataLineStyle::setDashPattern( const QVector< qreal >& pattern )
132 {
133  d->m_pattern = pattern;
134 }
135 
136 void GeoDataLineStyle::pack( QDataStream& stream ) const
137 {
138  GeoDataColorStyle::pack( stream );
139 
140  stream << d->m_width;
141  stream << d->m_physicalWidth;
142  stream << (int)d->m_penStyle;
143  stream << (int)d->m_capStyle;
144  stream << d->m_background;
145 }
146 
147 void GeoDataLineStyle::unpack( QDataStream& stream )
148 {
149  GeoDataColorStyle::unpack( stream );
150 
151  stream >> d->m_width;
152  stream >> d->m_physicalWidth;
153  int style;
154  stream >> style;
155  d->m_penStyle = ( Qt::PenStyle ) style;
156  stream >> style;
157  d->m_capStyle = ( Qt::PenCapStyle ) style;
158  stream >> d->m_background;
159 }
160 
161 }
Marble::GeoDataLineStyle::capStyle
Qt::PenCapStyle capStyle() const
Return the current pen cap style.
Definition: GeoDataLineStyle.cpp:96
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:126
Marble::GeoDataLineStyle::penStyle
Qt::PenStyle penStyle() const
Return the current pen cap style.
Definition: GeoDataLineStyle.cpp:106
Marble::GeoDataLineStyle::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataLineStyle.cpp:71
Marble::GeoDataLineStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataLineStyle.cpp:136
Marble::GeoDataLineStyle::setBackground
void setBackground(bool background)
Set whether to draw the solid background.
Definition: GeoDataLineStyle.cpp:121
Marble::GeoDataColorStyle::setColor
void setColor(const QColor &value)
Set a new color.
Definition: GeoDataColorStyle.cpp:73
GeoDataLineStyle.h
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:81
Marble::GeoDataColorStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataColorStyle.cpp:107
Marble::GeoDataLineStyle::setPhysicalWidth
void setPhysicalWidth(const float &realWidth)
Set the physical width of the line (in meters)
Definition: GeoDataLineStyle.cpp:91
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:76
Marble::GeoDataLineStyle::setPenStyle
void setPenStyle(Qt::PenStyle style)
Set pen cap style.
Definition: GeoDataLineStyle.cpp:111
Marble::GeoDataLineStyle::setCapStyle
void setCapStyle(Qt::PenCapStyle style)
Set pen cap style.
Definition: GeoDataLineStyle.cpp:101
Marble::GeoDataColorStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataColorStyle.cpp:116
Marble::GeoDataLineStyle::setDashPattern
void setDashPattern(const QVector< qreal > &pattern)
Sets the dash pattern.
Definition: GeoDataLineStyle.cpp:131
Marble::GeoDataLineStyle::physicalWidth
float physicalWidth() const
Return the current physical width of the line.
Definition: GeoDataLineStyle.cpp:86
Marble::GeoDataTypes::GeoDataLineStyleType
const char * GeoDataLineStyleType
Definition: GeoDataTypes.cpp:50
GeoDataTypes.h
Marble::GeoDataLineStyle::background
bool background() const
Return true if background get drawn.
Definition: GeoDataLineStyle.cpp:116
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:147
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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