[Marble-commits] branches/KDE/4.3/kdeedu/marble/src/lib/geodata/data
Torsten Rahn
tackat at kde.org
Sat Jul 25 17:55:50 CEST 2009
SVN commit 1002299 by rahn:
- Backport of r1002292
- Fix rendering for linestrings which cross the dateline an uneven number of times.
This hopefully also fixes the leak reported by tgridel.
M +28 -4 GeoDataLineString.cpp
M +1 -0 GeoDataLineString.h
--- branches/KDE/4.3/kdeedu/marble/src/lib/geodata/data/GeoDataLineString.cpp #1002298:1002299
@@ -223,6 +223,23 @@
return *this;
}
+GeoDataLineString& GeoDataLineString::operator << ( const GeoDataLineString& value )
+{
+ GeoDataGeometry::detach();
+ p()->m_rangeCorrected.clear();
+ p()->m_dirtyRange = true;
+ p()->m_dirtyBox = true;
+
+ QVector<GeoDataCoordinates>::const_iterator itCoords = value.constBegin();
+ QVector<GeoDataCoordinates>::const_iterator itEnd = value.constEnd();
+
+ for( ; itCoords != itEnd; ++itCoords ) {
+ p()->m_vector.append( *itCoords );
+ }
+
+ return *this;
+}
+
void GeoDataLineString::clear()
{
GeoDataGeometry::detach();
@@ -361,11 +378,11 @@
}
}
- for( QVector<GeoDataCoordinates>::const_iterator itCoords
- = m_vector.constBegin();
- itCoords != m_vector.constEnd();
- ++itCoords ) {
+ QVector<GeoDataCoordinates>::const_iterator itCoords = m_vector.constBegin();
+ QVector<GeoDataCoordinates>::const_iterator itEnd = m_vector.constEnd();
+ for( ; itCoords != itEnd; ++itCoords ) {
+
currentCoords = *itCoords;
if ( itCoords == m_vector.constBegin() ) {
@@ -499,6 +516,13 @@
itPreviousPoint = itPoint;
}
+ // If the line string doesn't cross the dateline an even number of times
+ // then need to take care of the data stored in the unfinishedLineString
+ if ( unfinished && unfinishedLineString && !unfinishedLineString->isEmpty() ) {
+ *dateLineCorrected << *unfinishedLineString;
+ delete unfinishedLineString;
+ }
+
lineStrings << dateLineCorrected;
}
--- branches/KDE/4.3/kdeedu/marble/src/lib/geodata/data/GeoDataLineString.h #1002298:1002299
@@ -94,6 +94,7 @@
void append ( const GeoDataCoordinates& value );
GeoDataLineString& operator << ( const GeoDataCoordinates& value );
+ GeoDataLineString& operator << ( const GeoDataLineString& value );
QVector<GeoDataCoordinates>::Iterator begin();
QVector<GeoDataCoordinates>::Iterator end();
More information about the Marble-commits
mailing list