• 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
GeoDataNetworkLinkControl.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 2013 Mohammed Nafees <nafees.technocool@gmail.com>
9 //
10 
11 #include "GeoDataNetworkLinkControl.h"
12 #include "GeoDataTypes.h"
13 #include "GeoDataCamera.h"
14 #include "GeoDataLookAt.h"
15 
16 namespace Marble
17 {
18 
19 class GeoDataNetworkLinkControlPrivate
20 {
21 public:
22  GeoDataNetworkLinkControlPrivate();
23 
24  GeoDataNetworkLinkControlPrivate( const GeoDataNetworkLinkControlPrivate &other );
25 
26  qreal m_minRefreshPeriod;
27  qreal m_maxSessionLength;
28  QString m_cookie;
29  QString m_message;
30  QString m_linkName;
31  QString m_linkDescription;
32  QString m_linkSnippet;
33  int m_maxLines;
34  QDateTime m_expires;
35  GeoDataUpdate m_update;
36  GeoDataAbstractView *m_abstractView;
37 };
38 
39 GeoDataNetworkLinkControlPrivate::GeoDataNetworkLinkControlPrivate() :
40  m_minRefreshPeriod( 0.0 ),
41  m_maxSessionLength( 0.0 ),
42  m_cookie( "" ),
43  m_message( "" ),
44  m_linkName( "" ),
45  m_linkDescription( "" ),
46  m_linkSnippet( "" ),
47  m_maxLines( 2 ),
48  m_expires(),
49  m_update(),
50  m_abstractView( 0 )
51 {
52 }
53 
54 GeoDataNetworkLinkControlPrivate::GeoDataNetworkLinkControlPrivate( const GeoDataNetworkLinkControlPrivate &other ) :
55  m_minRefreshPeriod( other.m_minRefreshPeriod ),
56  m_maxSessionLength( other.m_maxSessionLength ),
57  m_cookie( other.m_cookie ),
58  m_message( other.m_message ),
59  m_linkName( other.m_linkName ),
60  m_linkDescription( other.m_linkDescription ),
61  m_linkSnippet( other.m_linkSnippet ),
62  m_maxLines( other.m_maxLines ),
63  m_expires( other.m_expires ),
64  m_update( other.m_update ),
65  m_abstractView( other.m_abstractView ? other.m_abstractView->copy() : 0 )
66 {
67 }
68 
69 GeoDataNetworkLinkControl::GeoDataNetworkLinkControl() :
70  d( new GeoDataNetworkLinkControlPrivate )
71 {
72 }
73 
74 GeoDataNetworkLinkControl::GeoDataNetworkLinkControl( const Marble::GeoDataNetworkLinkControl &other ) :
75  GeoDataContainer(), d( new GeoDataNetworkLinkControlPrivate( *other.d ) )
76 {
77 }
78 
79 GeoDataNetworkLinkControl &GeoDataNetworkLinkControl::operator=( const GeoDataNetworkLinkControl &other )
80 {
81  GeoDataContainer::operator =( other );
82  *d = *other.d;
83  d->m_abstractView = other.d->m_abstractView ? other.d->m_abstractView->copy() : 0;
84  return *this;
85 }
86 
87 
88 bool GeoDataNetworkLinkControl::operator==( const GeoDataNetworkLinkControl &other ) const
89 {
90  if ( !GeoDataContainer::equals(other) ||
91  d->m_minRefreshPeriod != other.d->m_minRefreshPeriod ||
92  d->m_maxSessionLength != other.d->m_maxSessionLength ||
93  d->m_cookie != other.d->m_cookie ||
94  d->m_message != other.d->m_message ||
95  d->m_linkName != other.d->m_linkName ||
96  d->m_linkDescription != other.d->m_linkDescription ||
97  d->m_linkSnippet != other.d->m_linkSnippet ||
98  d->m_maxLines != other.d->m_maxLines ||
99  d->m_expires != other.d->m_expires ||
100  d->m_update != other.d->m_update ) {
101  return false;
102  }
103 
104  if ( !d->m_abstractView && !other.d->m_abstractView ) {
105  return true;
106  } else if ( (!d->m_abstractView && other.d->m_abstractView) ||
107  (d->m_abstractView && !other.d->m_abstractView) ) {
108  return false;
109  }
110 
111  if ( d->m_abstractView->nodeType() != other.d->m_abstractView->nodeType() ) {
112  return false;
113  }
114 
115  if ( d->m_abstractView->nodeType() == GeoDataTypes::GeoDataCameraType ) {
116  GeoDataCamera *thisCam = dynamic_cast<GeoDataCamera*>( d->m_abstractView );
117  GeoDataCamera *otherCam = dynamic_cast<GeoDataCamera*>( other.d->m_abstractView );
118  Q_ASSERT(thisCam && otherCam);
119 
120  if ( *thisCam != *otherCam ) {
121  return false;
122  }
123  } else if ( d->m_abstractView->nodeType() == GeoDataTypes::GeoDataLookAtType ) {
124  GeoDataLookAt *thisLookAt = dynamic_cast<GeoDataLookAt*>( d->m_abstractView );
125  GeoDataLookAt *otherLookAt = dynamic_cast<GeoDataLookAt*>( other.d->m_abstractView );
126  Q_ASSERT(thisLookAt && otherLookAt);
127 
128  if ( *thisLookAt != *otherLookAt ) {
129  return false;
130  }
131  }
132 
133  return true;
134 }
135 
136 bool GeoDataNetworkLinkControl::operator!=( const GeoDataNetworkLinkControl &other ) const
137 {
138  return !this->operator==( other );
139 }
140 
141 GeoDataNetworkLinkControl::~GeoDataNetworkLinkControl()
142 {
143  delete d->m_abstractView;
144  delete d;
145 }
146 
147 const char *GeoDataNetworkLinkControl::nodeType() const
148 {
149  return GeoDataTypes::GeoDataNetworkLinkControlType;
150 }
151 
152 qreal GeoDataNetworkLinkControl::minRefreshPeriod() const
153 {
154  return d->m_minRefreshPeriod;
155 }
156 
157 void GeoDataNetworkLinkControl::setMinRefreshPeriod( const qreal &minRefreshPeriod )
158 {
159  d->m_minRefreshPeriod = minRefreshPeriod;
160 }
161 
162 qreal GeoDataNetworkLinkControl::maxSessionLength() const
163 {
164  return d->m_maxSessionLength;
165 }
166 
167 void GeoDataNetworkLinkControl::setMaxSessionLength( const qreal &maxSessionLength )
168 {
169  d->m_maxSessionLength = maxSessionLength;
170 }
171 
172 QString GeoDataNetworkLinkControl::cookie() const
173 {
174  return d->m_cookie;
175 }
176 
177 void GeoDataNetworkLinkControl::setCookie( const QString &cookie )
178 {
179  d->m_cookie = cookie;
180 }
181 
182 QString GeoDataNetworkLinkControl::message() const
183 {
184  return d->m_message;
185 }
186 
187 void GeoDataNetworkLinkControl::setMessage( const QString &message )
188 {
189  d->m_message = message;
190 }
191 
192 QString GeoDataNetworkLinkControl::linkName() const
193 {
194  return d->m_linkName;
195 }
196 
197 void GeoDataNetworkLinkControl::setLinkName( const QString &linkName )
198 {
199  d->m_linkName = linkName;
200 }
201 
202 QString GeoDataNetworkLinkControl::linkDescription() const
203 {
204  return d->m_linkDescription;
205 }
206 
207 void GeoDataNetworkLinkControl::setLinkDescription( const QString &linkDescription )
208 {
209  d->m_linkDescription = linkDescription;
210 }
211 
212 QString GeoDataNetworkLinkControl::linkSnippet() const
213 {
214  return d->m_linkSnippet;
215 }
216 
217 void GeoDataNetworkLinkControl::setLinkSnippet( const QString &linkSnippet )
218 {
219  d->m_linkSnippet = linkSnippet;
220 }
221 
222 int GeoDataNetworkLinkControl::maxLines() const
223 {
224  return d->m_maxLines;
225 }
226 
227 void GeoDataNetworkLinkControl::setMaxLines( const int &maxLines )
228 {
229  d->m_maxLines = maxLines;
230 }
231 
232 QDateTime GeoDataNetworkLinkControl::expires() const
233 {
234  return d->m_expires;
235 }
236 
237 void GeoDataNetworkLinkControl::setExpires( const QDateTime &expires )
238 {
239  d->m_expires = expires;
240 }
241 
242 GeoDataUpdate &GeoDataNetworkLinkControl::update()
243 {
244  return d->m_update;
245 }
246 
247 const GeoDataUpdate& GeoDataNetworkLinkControl::update() const
248 {
249  return d->m_update;
250 }
251 
252 void GeoDataNetworkLinkControl::setUpdate( const GeoDataUpdate &update )
253 {
254  d->m_update = update;
255 }
256 
257 GeoDataAbstractView *GeoDataNetworkLinkControl::abstractView() const
258 {
259  return d->m_abstractView;
260 }
261 
262 void GeoDataNetworkLinkControl::setAbstractView( GeoDataAbstractView *abstractView )
263 {
264  d->m_abstractView = abstractView;
265  d->m_abstractView->setParent( this );
266 }
267 
268 }
Marble::GeoDataNetworkLinkControl::setCookie
void setCookie(const QString &cookie)
Definition: GeoDataNetworkLinkControl.cpp:177
Marble::GeoDataNetworkLinkControl::setUpdate
void setUpdate(const GeoDataUpdate &update)
Definition: GeoDataNetworkLinkControl.cpp:252
Marble::GeoDataAbstractView
Definition: GeoDataAbstractView.h:30
Marble::GeoDataTypes::GeoDataLookAtType
const char * GeoDataLookAtType
Definition: GeoDataTypes.cpp:58
Marble::GeoDataNetworkLinkControl::minRefreshPeriod
qreal minRefreshPeriod() const
Definition: GeoDataNetworkLinkControl.cpp:152
Marble::GeoDataNetworkLinkControl::setAbstractView
void setAbstractView(GeoDataAbstractView *abstractView)
Sets the abstract view and takes control of this pointer.
Definition: GeoDataNetworkLinkControl.cpp:262
Marble::GeoDataNetworkLinkControl::maxLines
int maxLines() const
Definition: GeoDataNetworkLinkControl.cpp:222
Marble::GeoDataNetworkLinkControl::~GeoDataNetworkLinkControl
~GeoDataNetworkLinkControl()
Definition: GeoDataNetworkLinkControl.cpp:141
Marble::GeoDataContainer
A base class that can hold GeoDataFeatures.
Definition: GeoDataContainer.h:47
Marble::GeoDataCamera
Definition: GeoDataCamera.h:22
Marble::GeoDataNetworkLinkControl::linkSnippet
QString linkSnippet() const
Definition: GeoDataNetworkLinkControl.cpp:212
Marble::GeoDataNetworkLinkControl::linkDescription
QString linkDescription() const
Definition: GeoDataNetworkLinkControl.cpp:202
Marble::GeoDataNetworkLinkControl::linkName
QString linkName() const
Definition: GeoDataNetworkLinkControl.cpp:192
GeoDataCamera.h
Marble::GeoDataNetworkLinkControl::operator!=
bool operator!=(const GeoDataNetworkLinkControl &other) const
Definition: GeoDataNetworkLinkControl.cpp:136
Marble::GeoDataNetworkLinkControl::update
GeoDataUpdate & update()
Definition: GeoDataNetworkLinkControl.cpp:242
Marble::GeoDataNetworkLinkControl::cookie
QString cookie() const
Definition: GeoDataNetworkLinkControl.cpp:172
Marble::GeoDataNetworkLinkControl::expires
QDateTime expires() const
Definition: GeoDataNetworkLinkControl.cpp:232
Marble::GeoDataNetworkLinkControl::setLinkSnippet
void setLinkSnippet(const QString &linkSnippet)
Definition: GeoDataNetworkLinkControl.cpp:217
GeoDataLookAt.h
Marble::GeoDataNetworkLinkControl::message
QString message() const
Definition: GeoDataNetworkLinkControl.cpp:182
Marble::GeoDataNetworkLinkControl::operator=
GeoDataNetworkLinkControl & operator=(const GeoDataNetworkLinkControl &other)
Definition: GeoDataNetworkLinkControl.cpp:79
Marble::GeoDataNetworkLinkControl::setLinkName
void setLinkName(const QString &linkName)
Definition: GeoDataNetworkLinkControl.cpp:197
QString
Marble::GeoDataNetworkLinkControl::setMinRefreshPeriod
void setMinRefreshPeriod(const qreal &minRefreshPeriod)
Definition: GeoDataNetworkLinkControl.cpp:157
Marble::GeoDataLookAt
Definition: GeoDataLookAt.h:23
Marble::GeoDataTypes::GeoDataCameraType
const char * GeoDataCameraType
Definition: GeoDataTypes.cpp:31
Marble::GeoDataNetworkLinkControl::operator==
bool operator==(const GeoDataNetworkLinkControl &other) const
Definition: GeoDataNetworkLinkControl.cpp:88
Marble::GeoDataNetworkLinkControl::setMaxSessionLength
void setMaxSessionLength(const qreal &maxSessionLength)
Definition: GeoDataNetworkLinkControl.cpp:167
Marble::GeoDataNetworkLinkControl::setMaxLines
void setMaxLines(const int &maxLines)
Definition: GeoDataNetworkLinkControl.cpp:227
Marble::GeoDataNetworkLinkControl::setMessage
void setMessage(const QString &message)
Definition: GeoDataNetworkLinkControl.cpp:187
Marble::GeoDataUpdate
Definition: GeoDataUpdate.h:25
Marble::GeoDataNetworkLinkControl::abstractView
GeoDataAbstractView * abstractView() const
Definition: GeoDataNetworkLinkControl.cpp:257
Marble::GeoDataTypes::GeoDataNetworkLinkControlType
const char * GeoDataNetworkLinkControlType
Definition: GeoDataTypes.cpp:94
Marble::GeoDataNetworkLinkControl::maxSessionLength
qreal maxSessionLength() const
Definition: GeoDataNetworkLinkControl.cpp:162
Marble::GeoDataNetworkLinkControl::setExpires
void setExpires(const QDateTime &expires)
Definition: GeoDataNetworkLinkControl.cpp:237
GeoDataNetworkLinkControl.h
GeoDataTypes.h
Marble::GeoDataNetworkLinkControl
Definition: GeoDataNetworkLinkControl.h:27
Marble::GeoDataContainer::equals
bool equals(const GeoDataContainer &other) const
Definition: GeoDataContainer.cpp:66
Marble::GeoDataNetworkLinkControl::setLinkDescription
void setLinkDescription(const QString &linkDescription)
Definition: GeoDataNetworkLinkControl.cpp:207
Marble::GeoDataNetworkLinkControl::GeoDataNetworkLinkControl
GeoDataNetworkLinkControl()
Definition: GeoDataNetworkLinkControl.cpp:69
Marble::GeoDataNetworkLinkControl::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataNetworkLinkControl.cpp:147
QDateTime
Marble::GeoDataFeature::operator=
GeoDataFeature & operator=(const GeoDataFeature &other)
Definition: GeoDataFeature.cpp:80
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