[Marble-commits] KDE/kdeedu/marble/src/plugins/runner/monav
Dennis Nienhüser
earthwings at gentoo.org
Sat Oct 9 00:19:05 CEST 2010
SVN commit 1183979 by nienhueser:
Follow symlinks when searching for maps. Improve performance for subsequent requests in the same country.
M +9 -4 MonavPlugin.cpp
--- trunk/KDE/kdeedu/marble/src/plugins/runner/monav/MonavPlugin.cpp #1183978:1183979
@@ -186,7 +186,8 @@
QString base = MarbleDirs::localPath() + "/maps/earth/monav/";
loadMap( base );
QDir::Filters filters = QDir::AllDirs | QDir::Readable | QDir::NoDotAndDotDot;
- QDirIterator iter( base, filters, QDirIterator::Subdirectories );
+ QDirIterator::IteratorFlags flags = QDirIterator::Subdirectories | QDirIterator::FollowSymlinks;
+ QDirIterator iter( base, filters, flags );
while ( iter.hasNext() ) {
iter.next();
loadMap( iter.filePath() );
@@ -250,20 +251,24 @@
QString MonavPlugin::mapDirectoryForRequest( RouteRequest* request ) const
{
- foreach( const MonavMap &map, d->m_maps ) {
+ for ( int j=0; j<d->m_maps.size(); ++j ) {
bool containsAllPoints = true;
for ( int i = 0; i < request->size(); ++i ) {
GeoDataCoordinates via = request->at( i );
- if ( !map.containsPoint( via ) ) {
+ if ( !d->m_maps[j].containsPoint( via ) ) {
containsAllPoints = false;
break;
}
}
if ( containsAllPoints ) {
- return map.m_directory.absolutePath();
+ if ( j ) {
+ // Subsequent route requests will likely be in the same country
+ qSwap( d->m_maps[0], d->m_maps[j] );
}
+ return d->m_maps.first().m_directory.absolutePath();
}
+ }
return QString();
}
More information about the Marble-commits
mailing list