[Marble-commits] KDE/kdeedu/marble

Dennis Nienhüser earthwings at gentoo.org
Thu Mar 11 19:11:33 CET 2010


SVN commit 1102056 by nienhueser:

Initial patch to support online routing in Marble. Currently uses openrouteservice.org as its backend, but support for other services is easy to add (yournavigation.org already included, but not used). It mainly consists of
  - A QAbstractItemModel to store the current route
  - An interactive paint layer that can show both placemarks (marble runner search results) and the current route. Input support for selecting route points containing instructions (shown as annotations), creating new via points (hover above current route, drag), moving start and destination. The paint layer behaves similar to a QAbstractItemView
  - A manager to initiate route downloading and updating
  - A widget providing input fields for routing trip points (using either MarbleRunnerManager to retrieve placemarks for search terms or picking locations from the map directly) and a list view to show route instructions or the marble runner result of the active input field
    
  Squashed commit of the following:
        use oxygen palette colors
        use global DistanceUnit enum
        Remove the Marble prefix from routing related classes.
        Rename slots. Replace selectPlacemark(QModelIndex) method in the input widget with the already existing setTarget(GeoDataCoordinates) one.
        Minimize the changes to master.
        More cleanup
        Improve search/get directions label
        Various improvements, code style, documentation.
        Fix compiler warnings
        Virtual dtor needed here.
        Documentation
        Add copyright/license header everywhere
        Rename MarbleRoutingDirectionModel to MarbleRoutingProxyModel and MarbleRoutingTargetInputWidget to MarbleRoutingInputWidget.
        Cleanup, documentation
        Improve icons. Runner manager signalizes when all runners have finished.
        Insert via points in order (preferring short routes)
        Improve painted pixmaps
        Get rid of routing provider for cloudmade.com. Their pricing policy is cumbersome.
        Move routing related files to routing subdir.
        Calculate the cached zoom value inside setRadius(), not each time before calling it. Fixes MarbleWidget::centerOn(GeoDataLatLonBox) confusing the internal zoom state.
        Use a custom point selection method (special cursor, no popup) to select a point in the map instead of marble widgets mouseclickgeoposition
        Improve hover handling and cursors
        Fix the z-order for painting and event processing.
        Do not derive routing layer from QAbstractItemView (no benefits). Fix annotation drawing. Improve api.
        Only use one model at a time to avoid confusion. Add documentation.
        Fix memory leak
        Always select the first placemark after searching, if any. When a route has been retrieved, make it fully visible in the map.
        Re-enable setting position from map.
        Refactor MarbleRoutingWidget out of MarbleControlBox.
        Target input widget becomes a real QWidget. User can remove it and make it active.
        Change UI such that route search input fields can be added dynamically. Starts with one field only (search mode). Support for more than two route points. Use QLineEdit instead of QComboBox. Break paint layer methods into shorter methods.
        fix kml reading (buffer must be open)
        Switch from two GeoDataCoordinates to a GeoDataLineString to support via points. Add support for via points in openrouteservice request and improve via support in paint layer and input handling.
        stopover paints can be created in the map (not used for routing atm)
        Use QByteArray instead of QString conversions. Fixes broken encoding
        Fix visual glitches when repainting pixmap
        Share selection model between instructions list view and routing paint layer. Start making paint layer interactive (instructions can be selected, change their color and show instruction in a bubble when selected. source and destination are movable). Start making model editable (source and destination position). Upon model changes, reload the route.
        Add yournavigation.com and openrouteservice.org routing providers. Remove google maps provider, terms of service forbid usage.
        Integrate start, destination and waypoints in routing model. Add proxy filter model that only shows start, destination and routing instructions and use it in the listview. Improve paint layer. Do not use gpx layer anymore.
        Start routing paint layer
        Add google maps support. Provider choice tbd. Map display of kml not yet done as well.
        Add a class to support querying route steps from the user.
        Fix init, fix route painting.
        Initial routing support (only CloudMade, no georeferencing)
        Parse routing instructions (rte/rtept). Allow access to RouteContainer from the outside.


 AM            data/bitmaps/progress.mng  
 AM            data/bitmaps/routing_destination.png  
 AM            data/bitmaps/routing_pick.png  
 AM            data/bitmaps/routing_select.png  
 AM            data/bitmaps/routing_start.png  
 AM            data/bitmaps/routing_step.png  
 AM            data/bitmaps/routing_via.png  
 M  +15 -0     src/lib/CMakeLists.txt  
 M  +6 -1      src/lib/MarbleControlBox.cpp  
 M  +10 -2     src/lib/MarbleRunnerManager.cpp  
 M  +2 -0      src/lib/MarbleRunnerManager.h  
 M  +14 -10    src/lib/libmarble.qrc  
 A             src/lib/routing (directory)  
 A             src/lib/routing/AbstractRoutingProvider.cpp   [License: LGPL]
 A             src/lib/routing/AbstractRoutingProvider.h   [License: LGPL]
 A             src/lib/routing/OrsRoutingProvider.cpp   [License: LGPL]
 A             src/lib/routing/OrsRoutingProvider.h   [License: LGPL]
 A             src/lib/routing/RoutingInputWidget.cpp   [License: LGPL]
 A             src/lib/routing/RoutingInputWidget.h   [License: LGPL]
 A             src/lib/routing/RoutingLayer.cpp   [License: LGPL]
 A             src/lib/routing/RoutingLayer.h   [License: LGPL]
 A             src/lib/routing/RoutingManager.cpp   [License: LGPL]
 A             src/lib/routing/RoutingManager.h   [License: LGPL]
 A             src/lib/routing/RoutingModel.cpp   [License: LGPL]
 A             src/lib/routing/RoutingModel.h   [License: LGPL]
 A             src/lib/routing/RoutingProxyModel.cpp   [License: LGPL]
 A             src/lib/routing/RoutingProxyModel.h   [License: LGPL]
 A             src/lib/routing/RoutingWidget.cpp   [License: LGPL]
 A             src/lib/routing/RoutingWidget.h   [License: LGPL]
 A             src/lib/routing/RoutingWidget.ui  
 A             src/lib/routing/YoursRoutingProvider.cpp   [License: LGPL]
 A             src/lib/routing/YoursRoutingProvider.h   [License: LGPL]


** trunk/KDE/kdeedu/marble/data/bitmaps/progress.mng #property svn:mime-type
   + application/octet-stream
** trunk/KDE/kdeedu/marble/data/bitmaps/routing_destination.png #property svn:mime-type
   + application/octet-stream
** trunk/KDE/kdeedu/marble/data/bitmaps/routing_pick.png #property svn:mime-type
   + application/octet-stream
** trunk/KDE/kdeedu/marble/data/bitmaps/routing_select.png #property svn:mime-type
   + application/octet-stream
** trunk/KDE/kdeedu/marble/data/bitmaps/routing_start.png #property svn:mime-type
   + application/octet-stream
** trunk/KDE/kdeedu/marble/data/bitmaps/routing_step.png #property svn:mime-type
   + application/octet-stream
** trunk/KDE/kdeedu/marble/data/bitmaps/routing_via.png #property svn:mime-type
   + application/octet-stream
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1102055:1102056
@@ -10,6 +10,7 @@
  ${CMAKE_BINARY_DIR}/src/lib
  ${CMAKE_CURRENT_SOURCE_DIR}/AbstractLayer
  ${CMAKE_CURRENT_SOURCE_DIR}/Projections
+ ${CMAKE_CURRENT_SOURCE_DIR}/routing
  ${CMAKE_CURRENT_SOURCE_DIR}/runners
  ${CMAKE_CURRENT_SOURCE_DIR}/geodata
  ${CMAKE_CURRENT_SOURCE_DIR}/geodata/data
@@ -182,6 +183,19 @@
 
     MapThemeSortFilterProxyModel.cpp
 
+    routing/RoutingModel.cpp
+    routing/RoutingProxyModel.cpp
+    routing/RoutingManager.cpp
+    routing/RoutingLayer.cpp
+    routing/RoutingInputWidget.cpp
+    routing/RoutingWidget.cpp
+    routing/OrsRoutingProvider.cpp
+    routing/OrsRoutingProvider.h
+    routing/YoursRoutingProvider.h
+    routing/YoursRoutingProvider.cpp
+    routing/AbstractRoutingProvider.cpp
+    routing/AbstractRoutingProvider.h
+
     MarbleRunnerManager.cpp
     runners/MarbleAbstractRunner.cpp
     runners/LatLonRunner.cpp
@@ -201,6 +215,7 @@
     MarbleAboutDialog.ui
     SunControlWidget.ui
     LatLonEdit.ui
+    routing/RoutingWidget.ui
 )
 
 # FIXME: cleaner approach of src/lib/MarbleControlBox.* vs. marble.qrc
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1102055:1102056
@@ -39,6 +39,7 @@
 #include "gps/PositionTracking.h"
 #include "MarbleLocale.h"
 #include "MarblePlacemarkModel.h"
+#include "RoutingWidget.h"
 #include "MarbleRunnerManager.h"
 #include "MathHelper.h"
 #include "MapThemeSortFilterProxyModel.h"
@@ -76,12 +77,13 @@
     MapThemeSortFilterProxyModel *m_mapSortProxy;
     
     MarbleRunnerManager  *m_runnerManager;
+    RoutingWidget  *m_routingWidget;
     GeoSceneDocument      *mapTheme;
 
     MarbleLocale* m_locale;
 };
 
-MarbleControlBoxPrivate::MarbleControlBoxPrivate()
+MarbleControlBoxPrivate::MarbleControlBoxPrivate() : m_routingWidget(0)
 {
 }
 
@@ -249,6 +251,9 @@
 {
     d->m_widget = widget;
 
+    RoutingWidget *routingWidget = new RoutingWidget(widget, this);
+    d->uiWidget.toolBox->addItem(routingWidget, tr("Routing"));
+
     // Make us aware of all the Placemarks in the MarbleModel so that
     // we can search them.
     setLocations( static_cast<MarblePlacemarkModel*>(d->m_widget->placemarkModel()) );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.cpp #1102055:1102056
@@ -40,7 +40,8 @@
     : QObject(parent),
       m_activeRunners(0),
       m_lastString(""),
-      m_model(new MarblePlacemarkModel)
+      m_model(new MarblePlacemarkModel),
+      m_celestialBodyId("earth")
 {
     m_model->setPlacemarkContainer(&m_placemarkContainer);
     qRegisterMetaType<QVector<GeoDataPlacemark> >("QVector<GeoDataPlacemark>");
@@ -61,8 +62,11 @@
 
 void MarbleRunnerManager::newText(QString text)
 {
-    if (text == m_lastString)
+    if (text == m_lastString) {
+      emit searchFinished(text);
+      emit modelChanged( m_model );
       return;
+    }
     
     m_lastString = text;
     
@@ -112,6 +116,10 @@
     m_model->addPlacemarks( start, result.size() );
     m_modelMutex.unlock();
     emit modelChanged( m_model );
+
+    if (m_runners.size() == 0) {
+        emit searchFinished(m_lastString);
+    }
 }
 
 void MarbleRunnerManager::setCelestialBodyId(const QString &celestialBodyId)
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.h #1102055:1102056
@@ -48,6 +48,8 @@
 signals:
     void modelChanged( MarblePlacemarkModel *model );
 
+    void searchFinished(const QString &text);
+
 private slots:
     void slotRunnerFinished(MarbleAbstractRunner* runner, QVector<GeoDataPlacemark> result);
 
--- trunk/KDE/kdeedu/marble/src/lib/libmarble.qrc #1102055:1102056
@@ -1,12 +1,16 @@
 <RCC>
-    <qresource>
-        <file>../../data/bitmaps/cursor_bc.xpm</file>
-        <file>../../data/bitmaps/cursor_bl.xpm</file>
-        <file>../../data/bitmaps/cursor_br.xpm</file>
-        <file>../../data/bitmaps/cursor_cl.xpm</file>
-        <file>../../data/bitmaps/cursor_cr.xpm</file>
-        <file>../../data/bitmaps/cursor_tc.xpm</file>
-        <file>../../data/bitmaps/cursor_tl.xpm</file>
-        <file>../../data/bitmaps/cursor_tr.xpm</file>
-    </qresource>
+  <qresource>
+    <file>../../data/bitmaps/routing_select.png</file>
+    <file>../../data/bitmaps/routing_pick.png</file>
+    <file>../../data/bitmaps/routing_via.png</file>
+    <file>../../data/bitmaps/progress.mng</file>
+    <file>../../data/bitmaps/cursor_bc.xpm</file>
+    <file>../../data/bitmaps/cursor_bl.xpm</file>
+    <file>../../data/bitmaps/cursor_br.xpm</file>
+    <file>../../data/bitmaps/cursor_cl.xpm</file>
+    <file>../../data/bitmaps/cursor_cr.xpm</file>
+    <file>../../data/bitmaps/cursor_tc.xpm</file>
+    <file>../../data/bitmaps/cursor_tl.xpm</file>
+    <file>../../data/bitmaps/cursor_tr.xpm</file>
+  </qresource>
 </RCC>


More information about the Marble-commits mailing list