[Marble-commits] KDE/kdeedu/marble/src/lib/geodata
Thibaut Gridel
tgridel at free.fr
Sat Jul 17 00:36:10 CEST 2010
SVN commit 1150837 by tgridel:
GeoDataMultiGeometry: use append(GeoDataGeometry*) instead of append(GeoDataGeometry&)
M +0 -9 data/GeoDataMultiGeometry.cpp
M +0 -1 data/GeoDataMultiGeometry.h
M +2 -2 handlers/gpx/GPXtrksegTagHandler.cpp
M +3 -3 handlers/kml/KmlCoordinatesTagHandler.cpp
M +5 -2 handlers/kml/KmlLineStringTagHandler.cpp
M +6 -2 handlers/kml/KmlLinearRingTagHandler.cpp
M +4 -2 handlers/kml/KmlMultiGeometryTagHandler.cpp
M +3 -2 handlers/kml/KmlPointTagHandler.cpp
M +4 -2 handlers/kml/KmlPolygonTagHandler.cpp
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataMultiGeometry.cpp #1150836:1150837
@@ -168,15 +168,6 @@
}
-
-void GeoDataMultiGeometry::append ( const GeoDataGeometry& value )
-{
- detach();
- GeoDataGeometry *g = new GeoDataGeometry( value );
- g->setParent( this );
- p()->m_vector.append( g );
-}
-
GeoDataMultiGeometry& GeoDataMultiGeometry::operator << ( const GeoDataGeometry& value )
{
detach();
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataMultiGeometry.h #1150836:1150837
@@ -67,7 +67,6 @@
*/
void append( GeoDataGeometry *other );
- void append ( const GeoDataGeometry& value );
GeoDataMultiGeometry& operator << ( const GeoDataGeometry& value );
QVector<GeoDataGeometry*>::Iterator begin();
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/gpx/GPXtrksegTagHandler.cpp #1150836:1150837
@@ -42,13 +42,13 @@
{
GeoDataPlacemark* placemark = parentItem.nodeAs<GeoDataPlacemark>();
GeoDataMultiGeometry *multigeometry = static_cast<GeoDataMultiGeometry*>(placemark->geometry());
- GeoDataLineString linestring;
+ GeoDataLineString *linestring = new GeoDataLineString;
multigeometry->append(linestring);
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << gpxTag_trkseg << "> trkseg: " << multigeometry->size();
#endif
- return static_cast<GeoDataLineString*>(&multigeometry->last());
+ return linestring;
}
mDebug() << "trkseg parsing with parentitem" << parentItem.qualifiedName();
return 0;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlCoordinatesTagHandler.cpp #1150836:1150837
@@ -81,12 +81,12 @@
} else if ( parentItem.represents( kmlTag_LinearRing ) ) {
parentItem.nodeAs<GeoDataLinearRing>()->append( coord );
} else if ( parentItem.represents( kmlTag_MultiGeometry ) ) {
- GeoDataPoint point;
+ GeoDataPoint *point = new GeoDataPoint;
if ( coordinates.size() == 2 ) {
- point.set( DEG2RAD * coordinates.at( 0 ).toDouble(),
+ point->set( DEG2RAD * coordinates.at( 0 ).toDouble(),
DEG2RAD * coordinates.at( 1 ).toDouble() );
} else if ( coordinates.size() == 3 ) {
- point.set( DEG2RAD * coordinates.at( 0 ).toDouble(),
+ point->set( DEG2RAD * coordinates.at( 0 ).toDouble(),
DEG2RAD * coordinates.at( 1 ).toDouble(),
coordinates.at( 2 ).toDouble() );
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlLineStringTagHandler.cpp #1150836:1150837
@@ -43,18 +43,21 @@
GeoStackItem parentItem = parser.parentElement();
- GeoDataLineString lineString;
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_LineString << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
if( parentItem.represents( kmlTag_Placemark ) ) {
+ GeoDataLineString lineString;
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( lineString );
return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
+
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
+ GeoDataLineString *lineString = new GeoDataLineString;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( lineString );
- return static_cast<GeoDataMultiGeometry*>(&parentItem.nodeAs<GeoDataMultiGeometry>()->last());
+ return lineString;
+
} else {
return 0;
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlLinearRingTagHandler.cpp #1150836:1150837
@@ -42,21 +42,25 @@
GeoStackItem parentItem = parser.parentElement();
- GeoDataLinearRing linearRing;
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_LinearRing << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
if( parentItem.represents( kmlTag_outerBoundaryIs ) ) {
+ GeoDataLinearRing linearRing;
parentItem.nodeAs<GeoDataPolygon>()->setOuterBoundary( linearRing );
return &parentItem.nodeAs<GeoDataPolygon>()->outerBoundary();
+
} else if( parentItem.represents( kmlTag_innerBoundaryIs ) ) {
+ GeoDataLinearRing linearRing;
parentItem.nodeAs<GeoDataPolygon>()->appendInnerBoundary( linearRing );
return &parentItem.nodeAs<GeoDataPolygon>()->innerBoundaries().last();
+
} else if( parentItem.nodeAs<GeoDataMultiGeometry>() ) {
+ GeoDataLinearRing *linearRing = new GeoDataLinearRing;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( linearRing );
- return &parentItem.nodeAs<GeoDataMultiGeometry>()->last();
+ return linearRing;
} else
return 0;
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlMultiGeometryTagHandler.cpp #1150836:1150837
@@ -42,21 +42,23 @@
GeoStackItem parentItem = parser.parentElement();
+ if( parentItem.represents( kmlTag_Placemark ) ) {
GeoDataMultiGeometry geom;
- if( parentItem.represents( kmlTag_Placemark ) ) {
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( geom );
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_MultiGeometry << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
+
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
+ GeoDataMultiGeometry *geom = new GeoDataMultiGeometry;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( geom );
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_MultiGeometry << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
- return &parentItem.nodeAs<GeoDataMultiGeometry>()->last();
+ return geom;
} else {
return 0;
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlPointTagHandler.cpp #1150836:1150837
@@ -46,14 +46,15 @@
<< " parent item name: " << parentItem.qualifiedName().first;
#endif // DEBUG_TAGS
return parentItem.nodeAs<GeoDataPlacemark>();
+
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
- GeoDataPoint point;
+ GeoDataPoint *point = new GeoDataPoint;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( point );
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_Point << "> returning: " << parentItem.nodeAs<GeoDataMultiGeometry>()
<< " parent item name: " << parentItem.qualifiedName().first;
#endif // DEBUG_TAGS
- return &parentItem.nodeAs<GeoDataMultiGeometry>()->last();
+ return point;
}
return 0;
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlPolygonTagHandler.cpp #1150836:1150837
@@ -42,18 +42,20 @@
GeoStackItem parentItem = parser.parentElement();
- GeoDataPolygon polygon;
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_Polygon << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
if( parentItem.represents( kmlTag_Placemark ) ) {
+ GeoDataPolygon polygon;
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( polygon );
return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
+
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
+ GeoDataPolygon *polygon = new GeoDataPolygon;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( polygon );
- return &parentItem.nodeAs<GeoDataMultiGeometry>()->last();
+ return polygon;
} else {
return 0;
}
More information about the Marble-commits
mailing list