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