<br>Torsten, Dennis, (Konrad),<br><br>Many thanks for the pointers. Below is an outline of the approach I've used and some questions about the GeoGraphicsLineString idea.<br><br>For my working proof of concept <img goomoji="330" style="margin: 0pt 0.2ex; vertical-align: middle;" src="cid:330@goomoji.gmail"> based on Geopainter::regionFromEllipse...the approach eventually taken was as follows:<br>
<br><ul><li>create a simple class to hold string info I am interested in (e.g. name of thing being hovered over) plus a QRegion object</li><li>hold a QList of pointers to heap objects of above class (enables calling of methods to report e.g. 'name' or 'contains') in the LayerInterface subclass<br>
</li><li>also hold a QHash of strings & pointers to the class heap objects to uniquely id each item and to allow pointer look up from string<br></li><li>eventFilter picks up MouseMove events and I iterate over the QList calling 'contains' - a method in my simple class which uses the QRegion::contains(QPoint) method</li>
<li>render clears both the QList & QHash and deletes heap objects<br></li><li>render calls my database to get the info I paint into the layer and checks each item agains the QHash. Items not hashed are drawn by a method which wraps Geopainter::drawEllipsecreated and extracts the corresponding QRegion. This is checked to make sure it is non-empty and if ok we create the simple class instance on the heap including the crucial QRegion.<br>
</li></ul>I found I had to be careful to not consume the mouse events in order to preserve MarbleWidget's own mouse interactions. Also, it was important to refresh my containers to avoid remembering an old position for a previous view of the map. Will extend to cover lines next perhaps and look at how to report the hover results to the user. [ At present I only report to qDebug() ]<br>
<br><br>I'd be interested in exploring the alternative idea of using GeoGraphicsLineString. And I'd be happy to look at the possibility of adding the missing mouse support. But a few things are unclear to me at this stage:<br>
<br><ul><li>what additional advantage does the GeoGraphicsLineString route promise?</li><li>IIRC GeoGraphicsLineString has no draw or paint method but acts as a container for points; how would you see the drawing being done?</li>
<li>can such an implementation still use the LayerInterface style of approach, or does it require a completely different starting point (e.g. creating GraphicsScenes etc)?</li><li>logically where do you see the missing mouse event handling being inserted?<br>
</li></ul>BR <br><br>Amit<br><br><br><div class="gmail_quote">On Wed, May 9, 2012 at 1:00 PM, <span dir="ltr"><<a href="mailto:marble-devel-request@kde.org" target="_blank">marble-devel-request@kde.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Today's Topics:<br>
<br>
1. Re: User interaction with data in a LayerInterface subclass<br>
(Torsten Rahn)<br>
2. Re: User interaction with data in a LayerInterface subclass<br>
(Dennis Nienh?ser)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 9 May 2012 08:06:24 +0200<br>
From: "Torsten Rahn" <<a href="mailto:tackat@t-online.de">tackat@t-online.de</a>><br>
To: <a href="mailto:marble-devel@kde.org">marble-devel@kde.org</a><br>
Subject: Re: [Marble-devel] User interaction with data in a<br>
LayerInterface subclass<br>
Message-ID: <<a href="mailto:201205090806.24649.torsten@kde.org">201205090806.24649.torsten@kde.org</a>><br>
Content-Type: Text/Plain; charset="iso-8859-15"<br>
<br>
On Dienstag, 8. Mai 2012 21:08:18 Amit Chaudhuri wrote:<br>
> I want to be able to interact with individual lines or nodes by hovering<br>
> with a mouse, double clicking or selection through a menu. I want to show<br>
> data such as a node code or a description when an item is hovered over.<br>
<br>
Ideally the solution would be to use GeoGraphicsLineString from<br>
marble/src/lib/geodata/graphicsitem (This should work in a similar manner to<br>
GraphicsView), but IIRC it lacks mouse interaction so far (we'd be happy about<br>
patches that would provide this functionality though).<br>
<br>
For its implementation (or for your own GeoPainter based one) you need a way<br>
to interact with the drawn line though: In order to determine whether the<br>
linestring is "hovered" by the mouse you could use<br>
<br>
QRegion GeoPainter::regionFromPolyline ( const GeoDataLineString &<br>
lineString, qreal strokeWidth = 3 ) const;<br>
<br>
which has been there for this actual purpose.<br>
<br>
BR,<br>
Torsten<br>
<br>
<br>
<br>
Message: 2<br>
Date: Wed, 9 May 2012 09:42:39 +0200<br>
From: Dennis Nienh?ser <<a href="mailto:earthwings@gentoo.org">earthwings@gentoo.org</a>><br>
To: <<a href="mailto:marble-devel@kde.org">marble-devel@kde.org</a>><br>
Subject: Re: [Marble-devel] User interaction with data in a<br>
LayerInterface subclass<br>
Message-ID: <<a href="mailto:4FAA1FEF.9030003@gentoo.org">4FAA1FEF.9030003@gentoo.org</a>><br>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed<br>
<br>
Am 09.05.2012 08:06, schrieb Torsten Rahn:<br>
> On Dienstag, 8. Mai 2012 21:08:18 Amit Chaudhuri wrote:<br>
</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">An example implementation of an interactive layer is in<br>
src/lib/routing/RoutingLayer. Among other things it implements reaction<br>
to hovering using the regionFromPolyline method.<br>
<br>
Regards,<br>
Dennis<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Marble-devel mailing list<br>
<a href="mailto:Marble-devel@kde.org">Marble-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/marble-devel" target="_blank">https://mail.kde.org/mailman/listinfo/marble-devel</a><br>
<br>
<br>
End of Marble-devel Digest, Vol 57, Issue 17<br>
********************************************<br>
</blockquote></div><br>