[Marble-devel] Adding placemarks to MarbleWidget

Michael G. Hansen mikeml2 at pfna.de
Tue Sep 1 08:00:20 CEST 2009


Hi Kishore,

I am in a similar situation as you, currently working on clustering
support in digikam:
https://bugs.kde.org/show_bug.cgi?id=205001

For drawing custom placemarks and lines between them, also have a look
at trippy:
http://github.com/mghansen256/trippy/tree/master

It just subclasses MarbleWidget and then implements customPaint and does
not use any KML. It does not implement any drag-and-drop like behavior,
though. If you need custom mouse interaction, you could add an
eventfilter to Marble and handle mouse clicks there (have a look at my
patch for digikam for that).

Better access to drawing functionality (GraphicsItems, etc) is only
provided for plugins (see thread from a few days ago), and plugins have
to be shipped as separate shared libraries. Currently there is no way to
simply say widget->addPlugin() for a plugin residing in your executable.
But you can write a plugin for the drawing part, and then access it from
your client application by browsing through
MarbleWidget::map()->renderPlugins() - that worked for me. In the long
run, we can send a patch to Torsten for easier access.

Hope that helps,

Michael





It does not implement any drag-and-drop like behavior, though.
Kishore wrote:
> Hi, I am using MarbleWidget in my Qt application. In my application, i want 
> the widget to put in some placemarks on the map and draw some primitives (like 
> lines between placemarks). The user should be able to drag a placemark to a 
> new location and when  he does that i need a mechanism to be informed of the 
> new location.
> 
> What is the best way to achieve this? Looking at MarbleWidget API is not 
> obvious to me. There also is a MarbleGraphicsItem class that is probably the 
> way to go, but i see to obvious way to register my item with MarbleWidget so 
> that it is rendered and managed by it.
> 
> I have QGraphicsScene in mind and i am trying to draw a parallel with the 
> MarbleWidget API. QGraphicsScene has addItem(QGraphicsItem *) but MarbleWidget 
> has no equivalent addItem(MArbleGraphicsItem *) API.


-- 
Michael Hansen - http://www.pfna.de/
Monheim / Germany


More information about the Marble-devel mailing list