[Marble-commits] branches/KDE/4.5/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Sun Sep 26 11:01:31 CEST 2010
SVN commit 1179820 by nienhueser:
Write xml that validates against http://www.topografix.com/GPX/1/1/gpx.xsd
BUG: 251676
Backport of commit 1179736.
M +12 -13 RoutingModel.cpp
--- branches/KDE/4.5/kdeedu/marble/src/lib/routing/RoutingModel.cpp #1179819:1179820
@@ -275,28 +275,27 @@
content += "<metadata>\n <link href=\"http://edu.kde.org/marble\">\n ";
content += "<text>Marble Virtual Globe</text>\n </link>\n</metadata>\n";
- QList<RouteElement> instructions;
- content += "<trk>\n <name>Route</name>\n <trkseg>\n";
+ QList<RouteElement> waypoints;
+ content += " <rte>\n <name>Route</name>\n";
foreach( const RouteElement &element, d->m_route ) {
- if ( element.type == WayPoint ) {
+ if ( element.type == Instruction ) {
qreal lon = element.position.longitude( GeoDataCoordinates::Degree );
qreal lat = element.position.latitude( GeoDataCoordinates::Degree );
- content += QString( " <trkpt lat=\"%1\" lon=\"%2\"></trkpt>\n" ).arg( lat, 0, 'f', 7 ).arg( lon, 0, 'f', 7 );
- } else {
- instructions << element;
+ content += QString( " <rtept lat=\"%1\" lon=\"%2\"><name>%3</name></rtept>\n" ).arg( lat, 0, 'f', 7 ).arg( lon, 0, 'f', 7 ).arg( element.description );
+ } else if ( element.type == WayPoint ) {
+ waypoints << element;
}
}
- content += " </trkseg>\n </trk>\n";
+ content += " </rte>\n";
- content += " <rte>\n <name>Route</name>\n";
- foreach( const RouteElement &element, instructions ) {
- Q_ASSERT( element.type == Instruction );
+ content += "<trk>\n <name>Route</name>\n <trkseg>\n";
+ foreach( const RouteElement &element, waypoints ) {
+ Q_ASSERT( element.type == WayPoint );
qreal lon = element.position.longitude( GeoDataCoordinates::Degree );
qreal lat = element.position.latitude( GeoDataCoordinates::Degree );
- content += QString( " <rtept lat=\"%1\" lon=\"%2\">%3</rtept>\n" ).arg( lat, 0, 'f', 7 ).arg( lon, 0, 'f', 7 ).arg( element.description );
+ content += QString( " <trkpt lat=\"%1\" lon=\"%2\"></trkpt>\n" ).arg( lat, 0, 'f', 7 ).arg( lon, 0, 'f', 7 );
}
-
- content += " </rte>\n";
+ content += " </trkseg>\n </trk>\n";
content += "</gpx>\n";
device->write( content.toUtf8() );
More information about the Marble-commits
mailing list