[Marble-commits] KDE/kdeedu/marble/src
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Tue Aug 24 09:42:52 CEST 2010
SVN commit 1167256 by beschow:
use MarbleModel rather than MarbleMap in MarbleRunners
MarbleRunners seem to operate on Data, but do not perform graphical operations. MarbleModel provides data without having a bias to a graphical representation
(MarbleWidget or MarbleMap). Thus, using MarbleModel instead of MarbleMap in the runners would make them more agnostic to the graphical representation.
REVIEW: 5075
M +5 -6 lib/MarbleAbstractRunner.cpp
M +4 -4 lib/MarbleAbstractRunner.h
M +1 -2 lib/MarbleControlBox.cpp
M +9 -7 lib/MarbleRunnerManager.cpp
M +2 -2 lib/MarbleRunnerManager.h
M +3 -3 plugins/runner/localdatabase/LocalDatabaseRunner.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleAbstractRunner.cpp #1167255:1167256
@@ -8,7 +8,6 @@
// Copyright 2008 Henry de Valence <hdevalence at gmail.com>
#include "MarbleAbstractRunner.h"
-#include "MarbleMap.h"
#include <QtCore/QThread>
#include <QtCore/QString>
@@ -18,7 +17,7 @@
MarbleAbstractRunner::MarbleAbstractRunner( QObject *parent )
: QObject( parent ),
- m_map( 0 )
+ m_model( 0 )
{
// nothing to do
}
@@ -28,14 +27,14 @@
return GeoDataFeature::Default;
}
-void MarbleAbstractRunner::setMap( MarbleMap* map )
+void MarbleAbstractRunner::setModel( MarbleModel* model )
{
- m_map = map;
+ m_model = model;
}
-MarbleMap * MarbleAbstractRunner::map()
+MarbleModel * MarbleAbstractRunner::model()
{
- return m_map;
+ return m_model;
}
void MarbleAbstractRunner::search( const QString & )
--- trunk/KDE/kdeedu/marble/src/lib/MarbleAbstractRunner.h #1167255:1167256
@@ -21,7 +21,7 @@
namespace Marble
{
-class MarbleMap;
+class MarbleModel;
class RouteSkeleton;
/**
@@ -41,7 +41,7 @@
/**
* Stores a pointer to the currently used map
*/
- void setMap( MarbleMap * map );
+ void setModel( MarbleModel * model );
/**
* This function gives the icon for this runner
@@ -97,10 +97,10 @@
/**
* Access to the currently used map, or null if no was set with @see setMap
*/
- MarbleMap * map();
+ MarbleModel * model();
private:
- MarbleMap *m_map;
+ MarbleModel *m_model;
};
}
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1167255:1167256
@@ -33,7 +33,6 @@
#include "CurrentLocationWidget.h"
#include "LegendWidget.h"
#include "MarbleWidget.h"
-#include "MarbleMap.h"
#include "MarbleModel.h"
#include "FileViewModel.h"
#include "MarblePlacemarkModel.h"
@@ -258,7 +257,7 @@
this, SLOT( setLocations( MarblePlacemarkModel* ) ) );
d->m_widget = widget;
- d->m_runnerManager->setMap( d->m_widget->map() );
+ d->m_runnerManager->setModel( widget->model() );
d->m_routingWidget = new RoutingWidget( widget, this );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.cpp #1167255:1167256
@@ -27,12 +27,14 @@
namespace Marble
{
+class MarbleModel;
+
class MarbleRunnerManagerPrivate
{
public:
QString m_lastSearchTerm;
QMutex m_modelMutex;
- MarbleMap * m_map;
+ MarbleModel * m_marbleModel;
MarblePlacemarkModel *m_model;
int m_searchTasks;
QVector<GeoDataPlacemark*> m_placemarkContainer;
@@ -50,7 +52,7 @@
QList<RunnerPlugin*> plugins( RunnerPlugin::Capability capability );
};
MarbleRunnerManagerPrivate::MarbleRunnerManagerPrivate( PluginManager* pluginManager ) :
- m_map( 0 ),
+ m_marbleModel( 0 ),
m_model( new MarblePlacemarkModel ),
m_searchTasks( 0 ),
m_routeSkeleton( 0 ),
@@ -112,7 +114,7 @@
MarbleAbstractRunner* runner = plugin->newRunner();
connect( runner, SIGNAL( reverseGeocodingFinished( GeoDataCoordinates, GeoDataPlacemark ) ),
this, SLOT( addReverseGeocodingResult( GeoDataCoordinates, GeoDataPlacemark ) ) );
- runner->setMap( d->m_map );
+ runner->setModel( d->m_marbleModel );
QThreadPool::globalInstance()->start( new ReverseGeocodingTask( runner, coordinates ) );
}
}
@@ -140,7 +142,7 @@
MarbleAbstractRunner* runner = plugin->newRunner();
connect( runner, SIGNAL( searchFinished( QVector<GeoDataPlacemark*> ) ),
this, SLOT( addSearchResult( QVector<GeoDataPlacemark*> ) ) );
- runner->setMap( d->m_map );
+ runner->setModel( d->m_marbleModel );
QThreadPool::globalInstance()->start( new SearchTask( runner, searchTerm ) );
}
}
@@ -164,10 +166,10 @@
}
}
-void MarbleRunnerManager::setMap( MarbleMap * map )
+void MarbleRunnerManager::setModel( MarbleModel * model )
{
// TODO: Terminate runners which are making use of the map.
- d->m_map = map;
+ d->m_marbleModel = model;
}
void MarbleRunnerManager::setCelestialBodyId( const QString &celestialBodyId )
@@ -197,7 +199,7 @@
MarbleAbstractRunner* runner = plugin->newRunner();
connect( runner, SIGNAL( routeCalculated( GeoDataDocument* ) ),
this, SLOT( addRoutingResult( GeoDataDocument* ) ) );
- runner->setMap( d->m_map );
+ runner->setModel( d->m_marbleModel );
QThreadPool::globalInstance()->start( new RoutingTask( runner, skeleton ) );
}
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.h #1167255:1167256
@@ -23,7 +23,7 @@
class GeoDataDocument;
class GeoDataPlacemark;
-class MarbleMap;
+class MarbleModel;
class MarblePlacemarkModel;
class PluginManager;
class RouteSkeleton;
@@ -53,7 +53,7 @@
/**
* Set a pointer to the map instance to be passed to MarbleAbstractRunner instances
*/
- void setMap( MarbleMap * map );
+ void setModel( MarbleModel * model );
/**
* Toggle offline mode. In offline mode, runners shall not try to access
--- trunk/KDE/kdeedu/marble/src/plugins/runner/localdatabase/LocalDatabaseRunner.cpp #1167255:1167256
@@ -11,7 +11,7 @@
#include "LocalDatabaseRunner.h"
#include "MarbleAbstractRunner.h"
-#include "MarbleMap.h"
+#include "MarbleModel.h"
#include "MarblePlacemarkModel.h"
#include "GeoDataFeature.h"
#include "GeoDataPlacemark.h"
@@ -45,9 +45,9 @@
{
QVector<GeoDataPlacemark*> vector;
- if (map()) {
+ if (model()) {
MarblePlacemarkModel * placemarkModel =
- qobject_cast<MarblePlacemarkModel*>( map()->placemarkModel() );
+ qobject_cast<MarblePlacemarkModel*>( model()->placemarkModel() );
if (placemarkModel) {
QModelIndexList resultList;
More information about the Marble-commits
mailing list