• 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
GeoDataLineString.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 Torsten Rahn <rahn@kde.org>
9 // Copyright 2009 Patrick Spendrin <ps_ml@gmx.de>
10 //
11 
12 
13 #include "GeoDataLineString.h"
14 #include "GeoDataLineString_p.h"
15 
16 #include "GeoDataLinearRing.h"
17 #include "MarbleMath.h"
18 #include "Quaternion.h"
19 #include "MarbleDebug.h"
20 
21 
22 namespace Marble
23 {
24 GeoDataLineString::GeoDataLineString( TessellationFlags f )
25  : GeoDataGeometry( new GeoDataLineStringPrivate( f ) )
26 {
27 // mDebug() << "1) GeoDataLineString created:" << p();
28 }
29 
30 GeoDataLineString::GeoDataLineString( GeoDataLineStringPrivate* priv )
31  : GeoDataGeometry( priv )
32 {
33 // mDebug() << "2) GeoDataLineString created:" << p();
34 }
35 
36 GeoDataLineString::GeoDataLineString( const GeoDataGeometry & other )
37  : GeoDataGeometry( other )
38 {
39 // mDebug() << "3) GeoDataLineString created:" << p();
40 }
41 
42 GeoDataLineString::~GeoDataLineString()
43 {
44 #ifdef DEBUG_GEODATA
45  mDebug() << "delete Linestring";
46 #endif
47 }
48 
49 GeoDataLineStringPrivate* GeoDataLineString::p() const
50 {
51  return static_cast<GeoDataLineStringPrivate*>(d);
52 }
53 
54 void GeoDataLineStringPrivate::interpolateDateLine( const GeoDataCoordinates & previousCoords,
55  const GeoDataCoordinates & currentCoords,
56  GeoDataCoordinates & previousAtDateLine,
57  GeoDataCoordinates & currentAtDateLine,
58  TessellationFlags f )
59 {
60  GeoDataCoordinates dateLineCoords;
61 
62  int recursionCounter = 0;
63 
64 // mDebug() << Q_FUNC_INFO;
65 
66  if ( f.testFlag( RespectLatitudeCircle ) && previousCoords.latitude() == currentCoords.latitude() ) {
67  dateLineCoords = currentCoords;
68  }
69  else {
70  dateLineCoords = findDateLine( previousCoords, currentCoords, recursionCounter );
71  }
72 
73  previousAtDateLine = dateLineCoords;
74  currentAtDateLine = dateLineCoords;
75 
76  if ( previousCoords.longitude() < 0 ) {
77  previousAtDateLine.setLongitude( -M_PI );
78  currentAtDateLine.setLongitude( +M_PI );
79  }
80  else {
81  previousAtDateLine.setLongitude( +M_PI );
82  currentAtDateLine.setLongitude( -M_PI );
83  }
84 }
85 
86 GeoDataCoordinates GeoDataLineStringPrivate::findDateLine( const GeoDataCoordinates & previousCoords,
87  const GeoDataCoordinates & currentCoords,
88  int recursionCounter )
89 {
90  int currentSign = ( currentCoords.longitude() < 0.0 ) ? -1 : +1 ;
91  int previousSign = ( previousCoords.longitude() < 0.0 ) ? -1 : +1 ;
92 
93  qreal longitudeDiff = fabs( previousSign * M_PI - previousCoords.longitude() )
94  + fabs( currentSign * M_PI - currentCoords.longitude() );
95 
96  if ( longitudeDiff < 0.001 || recursionCounter == 100 ) {
97 // mDebug() << "stopped at recursion" << recursionCounter << " and longitude difference " << longitudeDiff;
98  return currentCoords;
99  }
100  ++recursionCounter;
101 
102  qreal lon = 0.0;
103  qreal lat = 0.0;
104 
105  qreal altDiff = currentCoords.altitude() - previousCoords.altitude();
106 
107  const Quaternion itpos = Quaternion::nlerp( previousCoords.quaternion(), currentCoords.quaternion(), 0.5 );
108  itpos.getSpherical( lon, lat );
109 
110  qreal altitude = previousCoords.altitude() + 0.5 * altDiff;
111 
112  GeoDataCoordinates interpolatedCoords( lon, lat, altitude );
113 
114  int interpolatedSign = ( interpolatedCoords.longitude() < 0.0 ) ? -1 : +1 ;
115 
116 /*
117  mDebug() << "SRC" << previousCoords.toString();
118  mDebug() << "TAR" << currentCoords.toString();
119  mDebug() << "IPC" << interpolatedCoords.toString();
120 */
121 
122  if ( interpolatedSign != currentSign ) {
123  return findDateLine( interpolatedCoords, currentCoords, recursionCounter );
124  }
125 
126  return findDateLine( previousCoords, interpolatedCoords, recursionCounter );
127 }
128 
129 bool GeoDataLineString::isEmpty() const
130 {
131  return p()->m_vector.isEmpty();
132 }
133 
134 int GeoDataLineString::size() const
135 {
136  return p()->m_vector.size();
137 }
138 
139 GeoDataCoordinates& GeoDataLineString::at( int pos )
140 {
141  GeoDataGeometry::detach();
142  p()->m_dirtyRange = true;
143  p()->m_dirtyBox = true;
144  return p()->m_vector[ pos ];
145 }
146 
147 const GeoDataCoordinates& GeoDataLineString::at( int pos ) const
148 {
149  return p()->m_vector.at( pos );
150 }
151 
152 GeoDataCoordinates& GeoDataLineString::operator[]( int pos )
153 {
154  GeoDataGeometry::detach();
155  p()->m_dirtyRange = true;
156  p()->m_dirtyBox = true;
157  return p()->m_vector[ pos ];
158 }
159 
160 const GeoDataCoordinates& GeoDataLineString::operator[]( int pos ) const
161 {
162  return p()->m_vector[ pos ];
163 }
164 
165 GeoDataCoordinates& GeoDataLineString::last()
166 {
167  GeoDataGeometry::detach();
168  p()->m_dirtyRange = true;
169  p()->m_dirtyBox = true;
170  return p()->m_vector.last();
171 }
172 
173 GeoDataCoordinates& GeoDataLineString::first()
174 {
175  GeoDataGeometry::detach();
176  return p()->m_vector.first();
177 }
178 
179 const GeoDataCoordinates& GeoDataLineString::last() const
180 {
181  return p()->m_vector.last();
182 }
183 
184 const GeoDataCoordinates& GeoDataLineString::first() const
185 {
186  return p()->m_vector.first();
187 }
188 
189 QVector<GeoDataCoordinates>::Iterator GeoDataLineString::begin()
190 {
191  GeoDataGeometry::detach();
192  return p()->m_vector.begin();
193 }
194 
195 QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::begin() const
196 {
197  return p()->m_vector.constBegin();
198 }
199 
200 QVector<GeoDataCoordinates>::Iterator GeoDataLineString::end()
201 {
202  GeoDataGeometry::detach();
203  return p()->m_vector.end();
204 }
205 
206 QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::end() const
207 {
208  return p()->m_vector.constEnd();
209 }
210 
211 QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::constBegin() const
212 {
213  return p()->m_vector.constBegin();
214 }
215 
216 QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::constEnd() const
217 {
218  return p()->m_vector.constEnd();
219 }
220 
221 void GeoDataLineString::append ( const GeoDataCoordinates& value )
222 {
223  GeoDataGeometry::detach();
224  GeoDataLineStringPrivate* d = p();
225  delete d->m_rangeCorrected;
226  d->m_rangeCorrected = 0;
227  d->m_dirtyRange = true;
228  d->m_dirtyBox = true;
229  d->m_vector.append( value );
230 }
231 
232 GeoDataLineString& GeoDataLineString::operator << ( const GeoDataCoordinates& value )
233 {
234  GeoDataGeometry::detach();
235  GeoDataLineStringPrivate* d = p();
236  delete d->m_rangeCorrected;
237  d->m_rangeCorrected = 0;
238  d->m_dirtyRange = true;
239  d->m_dirtyBox = true;
240  d->m_vector.append( value );
241  return *this;
242 }
243 
244 GeoDataLineString& GeoDataLineString::operator << ( const GeoDataLineString& value )
245 {
246  GeoDataGeometry::detach();
247  GeoDataLineStringPrivate* d = p();
248  delete d->m_rangeCorrected;
249  d->m_rangeCorrected = 0;
250  d->m_dirtyRange = true;
251  d->m_dirtyBox = true;
252 
253  QVector<GeoDataCoordinates>::const_iterator itCoords = value.constBegin();
254  QVector<GeoDataCoordinates>::const_iterator itEnd = value.constEnd();
255 
256  for( ; itCoords != itEnd; ++itCoords ) {
257  d->m_vector.append( *itCoords );
258  }
259 
260  return *this;
261 }
262 
263 void GeoDataLineString::clear()
264 {
265  GeoDataGeometry::detach();
266  GeoDataLineStringPrivate* d = p();
267  delete d->m_rangeCorrected;
268  d->m_rangeCorrected = 0;
269  d->m_dirtyRange = true;
270  d->m_dirtyBox = true;
271 
272  d->m_vector.clear();
273 }
274 
275 bool GeoDataLineString::isClosed() const
276 {
277  return false;
278 }
279 
280 bool GeoDataLineString::tessellate() const
281 {
282  return p()->m_tessellationFlags.testFlag(Tessellate);
283 }
284 
285 void GeoDataLineString::setTessellate( bool tessellate )
286 {
287  GeoDataGeometry::detach();
288  // According to the KML reference the tesselation of line strings in Google Earth
289  // is generally done along great circles. However for subsequent points that share
290  // the same latitude the latitude circles are followed. Our Tesselate and RespectLatitude
291  // Flags provide this behaviour. For true polygons the latitude circles don't get considered.
292 
293  if ( tessellate ) {
294  p()->m_tessellationFlags |= Tessellate;
295  p()->m_tessellationFlags |= RespectLatitudeCircle;
296  } else {
297  p()->m_tessellationFlags ^= Tessellate;
298  p()->m_tessellationFlags ^= RespectLatitudeCircle;
299  }
300 }
301 
302 TessellationFlags GeoDataLineString::tessellationFlags() const
303 {
304  return p()->m_tessellationFlags;
305 }
306 
307 void GeoDataLineString::setTessellationFlags( TessellationFlags f )
308 {
309  p()->m_tessellationFlags = f;
310 }
311 
312 GeoDataLineString GeoDataLineString::toNormalized() const
313 {
314  GeoDataLineString normalizedLineString;
315 
316  normalizedLineString.setTessellationFlags( tessellationFlags() );
317 
318  qreal lon;
319  qreal lat;
320 
321  // FIXME: Think about how we can avoid unnecessary copies
322  // if the linestring stays the same.
323  QVector<GeoDataCoordinates>::const_iterator end = p()->m_vector.constEnd();
324  for( QVector<GeoDataCoordinates>::const_iterator itCoords
325  = p()->m_vector.constBegin();
326  itCoords != end;
327  ++itCoords ) {
328 
329  itCoords->geoCoordinates( lon, lat );
330  qreal alt = itCoords->altitude();
331  GeoDataCoordinates::normalizeLonLat( lon, lat );
332 
333  GeoDataCoordinates normalizedCoords( *itCoords );
334  normalizedCoords.set( lon, lat, alt );
335  normalizedLineString << normalizedCoords;
336  }
337 
338  return normalizedLineString;
339 }
340 
341 GeoDataLineString GeoDataLineString::toRangeCorrected() const
342 {
343  if ( p()->m_dirtyRange ) {
344 
345  delete p()->m_rangeCorrected;
346 
347  if( isClosed() ) {
348  p()->m_rangeCorrected = new GeoDataLinearRing( toPoleCorrected() );
349  } else {
350  p()->m_rangeCorrected = new GeoDataLineString( toPoleCorrected() );
351  }
352  p()->m_dirtyRange = false;
353  }
354 
355  return *p()->m_rangeCorrected;
356 }
357 
358 QVector<GeoDataLineString*> GeoDataLineString::toDateLineCorrected() const
359 {
360  QVector<GeoDataLineString*> lineStrings;
361 
362  p()->toDateLineCorrected( *this, lineStrings );
363 
364  return lineStrings;
365 }
366 
367 GeoDataLineString GeoDataLineString::toPoleCorrected() const
368 {
369  if( isClosed() ) {
370  GeoDataLinearRing poleCorrected;
371  p()->toPoleCorrected( *this, poleCorrected );
372  return poleCorrected;
373  } else {
374  GeoDataLineString poleCorrected;
375  p()->toPoleCorrected( *this, poleCorrected );
376  return poleCorrected;
377  }
378 }
379 
380 void GeoDataLineStringPrivate::toPoleCorrected( const GeoDataLineString& q, GeoDataLineString& poleCorrected )
381 {
382  poleCorrected.setTessellationFlags( q.tessellationFlags() );
383 
384  GeoDataCoordinates previousCoords;
385  GeoDataCoordinates currentCoords;
386 
387  if ( q.isClosed() ) {
388  if ( !( m_vector.first().isPole() ) &&
389  ( m_vector.last().isPole() ) ) {
390  qreal firstLongitude = ( m_vector.first() ).longitude();
391  GeoDataCoordinates modifiedCoords( m_vector.last() );
392  modifiedCoords.setLongitude( firstLongitude );
393  poleCorrected << modifiedCoords;
394  }
395  }
396 
397  QVector<GeoDataCoordinates>::const_iterator itCoords = m_vector.constBegin();
398  QVector<GeoDataCoordinates>::const_iterator itEnd = m_vector.constEnd();
399 
400  for( ; itCoords != itEnd; ++itCoords ) {
401 
402  currentCoords = *itCoords;
403 
404  if ( itCoords == m_vector.constBegin() ) {
405  previousCoords = currentCoords;
406  }
407 
408  if ( currentCoords.isPole() ) {
409  if ( previousCoords.isPole() ) {
410  continue;
411  }
412  else {
413  qreal previousLongitude = previousCoords.longitude();
414  GeoDataCoordinates currentModifiedCoords( currentCoords );
415  currentModifiedCoords.setLongitude( previousLongitude );
416  poleCorrected << currentModifiedCoords;
417  }
418  }
419  else {
420  if ( previousCoords.isPole() ) {
421  qreal currentLongitude = currentCoords.longitude();
422  GeoDataCoordinates previousModifiedCoords( previousCoords );
423  previousModifiedCoords.setLongitude( currentLongitude );
424  poleCorrected << previousModifiedCoords;
425  poleCorrected << currentCoords;
426  }
427  else {
428  // No poles at all. Nothing special to handle
429  poleCorrected << currentCoords;
430  }
431  }
432  previousCoords = currentCoords;
433  }
434 
435  if ( q.isClosed() ) {
436  if ( ( m_vector.first().isPole() ) &&
437  !( m_vector.last().isPole() ) ) {
438  qreal lastLongitude = ( m_vector.last() ).longitude();
439  GeoDataCoordinates modifiedCoords( m_vector.first() );
440  modifiedCoords.setLongitude( lastLongitude );
441  poleCorrected << modifiedCoords;
442  }
443  }
444 }
445 
446 void GeoDataLineStringPrivate::toDateLineCorrected(
447  const GeoDataLineString & q,
448  QVector<GeoDataLineString*> & lineStrings
449  )
450 {
451  const bool isClosed = q.isClosed();
452 
453  const QVector<GeoDataCoordinates>::const_iterator itStartPoint = q.constBegin();
454  const QVector<GeoDataCoordinates>::const_iterator itEndPoint = q.constEnd();
455  QVector<GeoDataCoordinates>::const_iterator itPoint = itStartPoint;
456  QVector<GeoDataCoordinates>::const_iterator itPreviousPoint = itPoint;
457 
458  TessellationFlags f = q.tessellationFlags();
459 
460  GeoDataLineString * unfinishedLineString = 0;
461 
462  GeoDataLineString * dateLineCorrected = isClosed ? new GeoDataLinearRing( f )
463  : new GeoDataLineString( f );
464 
465  qreal currentLon = 0.0;
466  qreal previousLon = 0.0;
467  int previousSign = 1;
468 
469  bool unfinished = false;
470 
471  for (; itPoint != itEndPoint; ++itPoint ) {
472  currentLon = itPoint->longitude();
473 
474  int currentSign = ( currentLon < 0.0 ) ? -1 : +1 ;
475 
476  if( itPoint == q.constBegin() ) {
477  previousSign = currentSign;
478  previousLon = currentLon;
479  }
480 
481  // If we are crossing the date line ...
482  if ( previousSign != currentSign && fabs(previousLon) + fabs(currentLon) > M_PI ) {
483 
484  unfinished = !unfinished;
485 
486  GeoDataCoordinates previousTemp;
487  GeoDataCoordinates currentTemp;
488 
489  interpolateDateLine( *itPreviousPoint, *itPoint,
490  previousTemp, currentTemp, q.tessellationFlags() );
491 
492  *dateLineCorrected << previousTemp;
493 
494  if ( isClosed && unfinished ) {
495  // If it's a linear ring and if it crossed the IDL only once then
496  // store the current string inside the unfinishedLineString for later use ...
497  unfinishedLineString = dateLineCorrected;
498  // ... and start a new linear ring for now.
499  dateLineCorrected = new GeoDataLinearRing( f );
500  }
501  else {
502  // Now it can only be a (finished) line string or a finished linear ring.
503  // Store it in the vector if the size is not zero.
504  if ( dateLineCorrected->size() > 0 ) {
505  lineStrings << dateLineCorrected;
506  }
507  else {
508  // Or delete it.
509  delete dateLineCorrected;
510  }
511 
512  // If it's a finished linear ring restore the "remembered" unfinished String
513  if ( isClosed && !unfinished && unfinishedLineString ) {
514  dateLineCorrected = unfinishedLineString;
515  }
516  else {
517  // if it's a line string just create a new line string.
518  dateLineCorrected = new GeoDataLineString( f );
519  }
520  }
521 
522  *dateLineCorrected << currentTemp;
523  *dateLineCorrected << *itPoint;
524 
525  }
526  else {
527  *dateLineCorrected << *itPoint;
528  }
529 
530  previousSign = currentSign;
531  previousLon = currentLon;
532  itPreviousPoint = itPoint;
533  }
534 
535  // If the line string doesn't cross the dateline an even number of times
536  // then need to take care of the data stored in the unfinishedLineString
537  if ( unfinished && unfinishedLineString && !unfinishedLineString->isEmpty() ) {
538  *dateLineCorrected << *unfinishedLineString;
539  delete unfinishedLineString;
540  }
541 
542  lineStrings << dateLineCorrected;
543 }
544 
545 const GeoDataLatLonAltBox& GeoDataLineString::latLonAltBox() const
546 {
547  // GeoDataLatLonAltBox::fromLineString is very expensive
548  // that's why we recreate it only if the m_dirtyBox
549  // is TRUE.
550  // DO NOT REMOVE THIS CONSTRUCT OR MARBLE WILL BE SLOW.
551  if ( p()->m_dirtyBox ) {
552  p()->m_latLonAltBox = GeoDataLatLonAltBox::fromLineString( *this );
553  }
554  p()->m_dirtyBox = false;
555 
556  return p()->m_latLonAltBox;
557 }
558 
559 qreal GeoDataLineString::length( qreal planetRadius, int offset ) const
560 {
561  if( offset < 0 || offset >= size() ) {
562  return 0;
563  }
564 
565  qreal length = 0.0;
566  QVector<GeoDataCoordinates> const & vector = p()->m_vector;
567  int const start = qMax(offset+1, 1);
568  int const end = p()->m_vector.size();
569  for( int i=start; i<end; ++i )
570  {
571  length += distanceSphere( vector[i-1], vector[i] );
572  }
573 
574  return planetRadius * length;
575 }
576 
577 QVector<GeoDataCoordinates>::Iterator GeoDataLineString::erase ( QVector<GeoDataCoordinates>::Iterator pos )
578 {
579  GeoDataGeometry::detach();
580  GeoDataLineStringPrivate* d = p();
581  delete d->m_rangeCorrected;
582  d->m_rangeCorrected = 0;
583  d->m_dirtyRange = true;
584  d->m_dirtyBox = true;
585  return d->m_vector.erase( pos );
586 }
587 
588 QVector<GeoDataCoordinates>::Iterator GeoDataLineString::erase ( QVector<GeoDataCoordinates>::Iterator begin,
589  QVector<GeoDataCoordinates>::Iterator end )
590 {
591  GeoDataGeometry::detach();
592  GeoDataLineStringPrivate* d = p();
593  delete d->m_rangeCorrected;
594  d->m_rangeCorrected = 0;
595  d->m_dirtyRange = true;
596  d->m_dirtyBox = true;
597  return d->m_vector.erase( begin, end );
598 }
599 
600 void GeoDataLineString::remove ( int i )
601 {
602  GeoDataGeometry::detach();
603  GeoDataLineStringPrivate* d = p();
604  d->m_dirtyRange = true;
605  d->m_dirtyBox = true;
606  d->m_vector.remove( i );
607 }
608 
609 void GeoDataLineString::pack( QDataStream& stream ) const
610 {
611  GeoDataGeometry::pack( stream );
612 
613  stream << size();
614  stream << (qint32)(p()->m_tessellationFlags);
615 
616  for( QVector<GeoDataCoordinates>::const_iterator iterator
617  = p()->m_vector.constBegin();
618  iterator != p()->m_vector.constEnd();
619  ++iterator ) {
620  mDebug() << "innerRing: size" << p()->m_vector.size();
621  GeoDataCoordinates coord = ( *iterator );
622  coord.pack( stream );
623  }
624 
625 }
626 
627 void GeoDataLineString::unpack( QDataStream& stream )
628 {
629  GeoDataGeometry::detach();
630  GeoDataGeometry::unpack( stream );
631  qint32 size;
632  qint32 tessellationFlags;
633 
634  stream >> size;
635  stream >> tessellationFlags;
636 
637  p()->m_tessellationFlags = (TessellationFlags)(tessellationFlags);
638 
639  for(qint32 i = 0; i < size; i++ ) {
640  GeoDataCoordinates coord;
641  coord.unpack( stream );
642  p()->m_vector.append( coord );
643  }
644 }
645 
646 }
Marble::GeoDataLineString::begin
QVector< GeoDataCoordinates >::Iterator begin()
Returns an iterator that points to the begin of the LineString.
Definition: GeoDataLineString.cpp:189
Marble::GeoDataLineString::toDateLineCorrected
virtual QVector< GeoDataLineString * > toDateLineCorrected() const
The line string corrected for date line crossing.
Definition: GeoDataLineString.cpp:358
Quaternion.h
Marble::GeoDataLineString::length
virtual qreal length(qreal planetRadius, int offset=0) const
Returns the length of LineString across a sphere starting from a coordinate in LineString This method...
Definition: GeoDataLineString.cpp:559
Marble::GeoDataCoordinates::unpack
virtual void unpack(QDataStream &stream)
Unserialize the contents of the feature from stream.
Definition: GeoDataCoordinates.cpp:1300
Marble::GeoDataLatLonAltBox::fromLineString
static GeoDataLatLonAltBox fromLineString(const GeoDataLineString &lineString)
Create the smallest bounding box from a line string.
Definition: GeoDataLatLonAltBox.cpp:216
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::GeoDataLineString::setTessellate
void setTessellate(bool tessellate)
Sets the tessellation property for the LineString.
Definition: GeoDataLineString.cpp:285
Marble::GeoDataLineString::last
GeoDataCoordinates & last()
Returns a reference to the last node in the LineString. This method detaches the returned coordinate ...
Definition: GeoDataLineString.cpp:165
Marble::GeoDataGeometry::unpack
virtual void unpack(QDataStream &stream)
Unserialize the contents of the feature from stream.
Definition: GeoDataGeometry.cpp:135
Marble::GeoDataLineString::constEnd
QVector< GeoDataCoordinates >::ConstIterator constEnd() const
Returns a const iterator that points to the end of the LineString.
Definition: GeoDataLineString.cpp:216
Marble::GeoDataLinearRing
A LinearRing that allows to store a closed, contiguous set of line segments.
Definition: GeoDataLinearRing.h:68
MarbleMath.h
Marble::GeoDataLineString::size
int size() const
Returns the number of nodes in a LineString.
Definition: GeoDataLineString.cpp:134
Marble::GeoDataGeometry
A base class for all geodata features.
Definition: GeoDataGeometry.h:47
Marble::GeoDataLineStringPrivate::m_dirtyRange
bool m_dirtyRange
Definition: GeoDataLineString_p.h:91
Marble::GeoDataLineStringPrivate::m_dirtyBox
bool m_dirtyBox
Definition: GeoDataLineString_p.h:93
Marble::GeoDataLineString::end
QVector< GeoDataCoordinates >::Iterator end()
Returns an iterator that points to the end of the LineString.
Definition: GeoDataLineString.cpp:200
Marble::GeoDataGeometry::detach
void detach()
Definition: GeoDataGeometry.cpp:54
Marble::distanceSphere
qreal distanceSphere(qreal lon1, qreal lat1, qreal lon2, qreal lat2)
This method calculates the shortest distance between two points on a sphere.
Definition: MarbleMath.h:52
Marble::GeoDataCoordinates::latitude
qreal latitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the latitude of the GeoDataCoordinates object use the unit parameter to switch between Radi...
Definition: GeoDataCoordinates.cpp:751
Marble::Quaternion::nlerp
static Quaternion nlerp(const Quaternion &q1, const Quaternion &q2, qreal t)
Definition: Quaternion.cpp:207
Marble::GeoDataLineStringPrivate::m_tessellationFlags
TessellationFlags m_tessellationFlags
Definition: GeoDataLineString_p.h:96
Marble::GeoDataLineString::toRangeCorrected
virtual GeoDataLineString toRangeCorrected() const
Provides a more generic representation of the LineString.
Definition: GeoDataLineString.cpp:341
Marble::GeoDataLineString::unpack
virtual void unpack(QDataStream &stream)
Unserialize the LineString from a stream.
Definition: GeoDataLineString.cpp:627
MarbleDebug.h
Marble::GeoDataLineString::tessellationFlags
TessellationFlags tessellationFlags() const
Returns the tessellation flags for a LineString.
Definition: GeoDataLineString.cpp:302
Marble::GeoDataLineString::toPoleCorrected
virtual GeoDataLineString toPoleCorrected() const
The line string with more generic pole values.
Definition: GeoDataLineString.cpp:367
Marble::GeoDataGeometry::pack
virtual void pack(QDataStream &stream) const
Serialize the contents of the feature to stream.
Definition: GeoDataGeometry.cpp:127
Marble::GeoDataLineString::isClosed
virtual bool isClosed() const
Returns whether a LineString is a closed polygon.
Definition: GeoDataLineString.cpp:275
Marble::GeoDataCoordinates::altitude
qreal altitude() const
return the altitude of the Point in meters
Definition: GeoDataCoordinates.cpp:1197
Marble::GeoDataLineString::setTessellationFlags
void setTessellationFlags(TessellationFlags f)
Sets the given tessellation flags for a LineString.
Definition: GeoDataLineString.cpp:307
Marble::GeoDataLineStringPrivate::toPoleCorrected
void toPoleCorrected(const GeoDataLineString &q, GeoDataLineString &poleCorrected)
Definition: GeoDataLineString.cpp:380
Marble::GeoDataLineStringPrivate::findDateLine
GeoDataCoordinates findDateLine(const GeoDataCoordinates &previousCoords, const GeoDataCoordinates &currentCoords, int recursionCounter)
Definition: GeoDataLineString.cpp:86
GeoDataLineString.h
Marble::GeoDataLineString::first
GeoDataCoordinates & first()
Returns a reference to the first node in the LineString. This method detaches the returned coordinate...
Definition: GeoDataLineString.cpp:173
Marble::GeoDataLineStringPrivate::m_vector
QVector< GeoDataCoordinates > m_vector
Definition: GeoDataLineString_p.h:88
Marble::GeoDataCoordinates::normalizeLonLat
static void normalizeLonLat(qreal &lon, qreal &lat, GeoDataCoordinates::Unit=GeoDataCoordinates::Radian)
normalize both longitude and latitude at the same time This method normalizes both latitude and longi...
Definition: GeoDataCoordinates.cpp:845
Marble::GeoDataCoordinates::set
void set(qreal lon, qreal lat, qreal alt=0, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
(re)set the coordinates in a GeoDataCoordinates object
Definition: GeoDataCoordinates.cpp:657
Marble::GeoDataLineString::append
void append(const GeoDataCoordinates &position)
Appends a given geodesic position as a new node to the LineString.
Definition: GeoDataLineString.cpp:221
Marble::GeoDataLineString
A LineString that allows to store a contiguous set of line segments.
Definition: GeoDataLineString.h:75
Marble::GeoDataLineString::at
GeoDataCoordinates & at(int pos)
Returns a reference to the coordinates of a node at a given position. This method detaches the return...
Definition: GeoDataLineString.cpp:139
Marble::GeoDataCoordinates::longitude
qreal longitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the longitude of the GeoDataCoordinates object use the unit parameter to switch between Rad...
Definition: GeoDataCoordinates.cpp:739
Marble::GeoDataLineString::pack
virtual void pack(QDataStream &stream) const
Serialize the LineString to a stream.
Definition: GeoDataLineString.cpp:609
GeoDataLineString_p.h
GeoDataLinearRing.h
Marble::GeoDataLineString::remove
void remove(int i)
Removes the node at the given position and destroys it.
Definition: GeoDataLineString.cpp:600
Marble::RespectLatitudeCircle
Definition: MarbleGlobal.h:33
Marble::GeoDataCoordinates::setLongitude
void setLongitude(qreal lon, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
set the longitude in a GeoDataCoordinates object
Definition: GeoDataCoordinates.cpp:679
Marble::GeoDataLineStringPrivate::m_rangeCorrected
GeoDataLineString * m_rangeCorrected
Definition: GeoDataLineString_p.h:90
Marble::GeoDataLineStringPrivate
Definition: GeoDataLineString_p.h:21
Marble::GeoDataLineString::isEmpty
bool isEmpty() const
Returns whether the LineString has no nodes at all.
Definition: GeoDataLineString.cpp:129
Marble::GeoDataLineString::operator[]
GeoDataCoordinates & operator[](int pos)
Returns a reference to the coordinates of a node at a given position. This method detaches the return...
Definition: GeoDataLineString.cpp:152
Marble::GeoDataLineString::~GeoDataLineString
virtual ~GeoDataLineString()
Destroys a LineString.
Definition: GeoDataLineString.cpp:42
Marble::GeoDataLineString::constBegin
QVector< GeoDataCoordinates >::ConstIterator constBegin() const
Returns a const iterator that points to the begin of the LineString.
Definition: GeoDataLineString.cpp:211
Marble::GeoDataLineStringPrivate::toDateLineCorrected
void toDateLineCorrected(const GeoDataLineString &q, QVector< GeoDataLineString * > &lineStrings)
Definition: GeoDataLineString.cpp:446
Marble::GeoDataCoordinates::isPole
bool isPole(Pole=AnyPole) const
return whether our coordinates represent a pole This method can be used to check whether the coordina...
Definition: GeoDataCoordinates.cpp:1231
Marble::Quaternion
Definition: Quaternion.h:43
Marble::GeoDataLineString::clear
void clear()
Destroys all nodes in a LineString.
Definition: GeoDataLineString.cpp:263
Marble::GeoDataLineString::toNormalized
virtual GeoDataLineString toNormalized() const
The line string with nodes that have proper longitude/latitude ranges.
Definition: GeoDataLineString.cpp:312
Marble::GeoDataLineString::erase
QVector< GeoDataCoordinates >::Iterator erase(QVector< GeoDataCoordinates >::Iterator position)
Removes the node at the given position and returns it.
Definition: GeoDataLineString.cpp:577
M_PI
#define M_PI
Definition: GeoDataCoordinates.h:26
Marble::GeoDataLineString::p
GeoDataLineStringPrivate * p() const
Definition: GeoDataLineString.cpp:49
Marble::GeoDataLineStringPrivate::interpolateDateLine
void interpolateDateLine(const GeoDataCoordinates &previousCoords, const GeoDataCoordinates &currentCoords, GeoDataCoordinates &previousAtDateline, GeoDataCoordinates &currentAtDateline, TessellationFlags f)
Definition: GeoDataLineString.cpp:54
Marble::GeoDataLineString::GeoDataLineString
GeoDataLineString(TessellationFlags f=NoTessellation)
Creates a new LineString.
Definition: GeoDataLineString.cpp:24
Marble::GeoDataGeometryPrivate::m_latLonAltBox
GeoDataLatLonAltBox m_latLonAltBox
Definition: GeoDataGeometry_p.h:71
Marble::Quaternion::getSpherical
void getSpherical(qreal &lon, qreal &lat) const
Definition: Quaternion.cpp:48
Marble::Tessellate
Definition: MarbleGlobal.h:32
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
Marble::GeoDataLatLonAltBox
A class that defines a 3D bounding box for geographic data.
Definition: GeoDataLatLonAltBox.h:49
Marble::GeoDataLineString::latLonAltBox
virtual const GeoDataLatLonAltBox & latLonAltBox() const
Returns the smallest latLonAltBox that contains the LineString.
Definition: GeoDataLineString.cpp:545
Marble::GeoDataLineString::tessellate
bool tessellate() const
Returns whether the LineString follows the earth's surface.
Definition: GeoDataLineString.cpp:280
Marble::GeoDataCoordinates::quaternion
const Quaternion & quaternion() const
return a Quaternion with the used coordinates
Definition: GeoDataCoordinates.cpp:1226
Marble::GeoDataCoordinates::pack
virtual void pack(QDataStream &stream) const
Serialize the contents of the feature to stream.
Definition: GeoDataCoordinates.cpp:1293
Marble::GeoDataLineString::operator<<
GeoDataLineString & operator<<(const GeoDataCoordinates &position)
Appends a given geodesic position as a new node to the LineString.
Definition: GeoDataLineString.cpp:232
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 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