[Marble-devel] dbus interface to Marble, some questions

Arnd Baecker arnd.baecker at web.de
Fri Feb 27 09:02:21 CET 2009


Hi,

I am just playing around with the recently added dbus interface
to marble, see
http://techbase.kde.org/Projects/Marble/MarbleDBus
and
http://techbase.kde.org/Development/Tutorials/D-Bus/Introduction
for more info.

To give some more examples (which I will add to the wiki, promised ;-):

marble_pid="$(pidof marble)"
alias CALL="qdbus org.kde.marble-$marble_pid /MarbleWidget"

# Changing map themes can be done via
CALL org.kde.MarbleWidget.setMapThemeId "earth/srtm/srtm.dgml"
CALL org.kde.MarbleWidget.setMapThemeId "earth/openstreetmap/openstreetmap.dgml"

# move to   lon lat
CALL org.kde.MarbleWidget.centerOn 8.8 53.2

# Set zoom:
CALL org.kde.MarbleWidget.zoomView 2000

The range of values passed to zoomView
is defined  in the .dgml files, eg for
marble/data/maps/earth/openstreetmap/openstreetmap.dgml
the range is
               <minimum>   900  </minimum>
               <maximum>  4000  </maximum>
while for  Bluemarble it is
                <minimum>   900  </minimum>
                <maximum>  2400  </maximum>

So far so good!

Now I tried to set the home location:
  CALL org.kde.MarbleWidget.setHome 8.8 53.2
works while
  CALL org.kde.MarbleWidget.setHome 8.8 53.2 2000
  Invalid number of parameters
According to qdbusviewer setHome should have
  lon (double) lat(double) zoom(int)
as parameters.
Actually, qdbusview shows "MarbleWidget::setHome" twice,
presumably because MarbleWidget.cpp defines both
  void MarbleWidget::setHome( qreal lon, qreal lat, int zoom )
  void MarbleWidget::setHome(const GeoDataCoordinates& homePoint, int zoom)
?

Then I tried to open a gpx file:
  CALL org.kde.MarbleWidget.openGpxFile /tmp/test.gpx
  Invalid number of parameters
Hmm. It should work this way (in theory), or?
Well, just doing
  CALL | grep openGpxFile
shows
  method QString org.kde.MarbleWidget.openGpxFile()
i.e., no argument?


Now my main question: Is there any way, to get the
lon,lat,zoom of the center of the current view as return parameters
using a dbus call?
I.e. I am missing the get* Routines (if that's technically possible...).
Maybe the
  method QDBusVariant org.freedesktop.DBus.Properties.Get(QString
  interface_name, QString property_name)
could do the job, but so far I did not succeed in finding
the right invocation of that, i.e.:
   CALL org.freedesktop.DBus.Properties.Get  XXX geoCoordinates
   Error: org.freedesktop.DBus.Error.InvalidArgs
  Interface XXX was not found in object /MarbleWidget
But maybe this is anyway the wrong approach ...

Why would this be interesting/useful?
This would for example allow for writing a small script which
uses the current coordinates and invokes a web browser
with the right coordinates for displaying the region
in openstreetmap (in particular openstreetbugs)
or any other mapping application.
Or one could use it to try routing algorithms,
steered from an outside application:
a) mark point A <enter> b) mark point B <enter> c) computation
d) display the resulting gpx file within marble

Maybe things like this would be done better via a KROSS interface
(http://techbase.kde.org/Development/Languages/Kross)
in the long run, but for the moment, just being
able to get coordinates etc. out of marble would be very interesting IMO.

Best,

Arnd


More information about the Marble-devel mailing list