[Marble-devel] User interaction with data in a LayerInterface subclass
Torsten Rahn
tackat at t-online.de
Sun May 13 10:32:03 UTC 2012
Hi Amit,
> - what additional advantage does the GeoGraphicsLineString route
> promise? - IIRC GeoGraphicsLineString has no draw or paint method but acts
> as a container for points;
You are probably looking at the wrong class:
The class you are talking about is likely GeoDataLineString which indeed acts
as a container for linestring data.
However I'm talking about
marble/src/lib/geodata/graphicsitem/GeoLineStringGraphicsItem.cpp
That class has got a paint method as you can see.
GeoDataLineStringGraphicsItem would have the following advantages:
- it would not just be pixels painted onto the canvas but the object itself
would "exist" as long as you wish and can be manipulated during its lifetime.
- as an object It would paint itself and could dynamically be changed during
its lifetime.
- and as an object it can receive mouseevents
Have you ever looked at QGraphicsView? I suggest you do. This concept would be
similar to
http://qt-project.org/doc/qt-4.8/qgraphicslineitem.html
And mousehandling would be possible in a similar way as for QGraphicsLineItem
- just that it works with GeoGraphical projections which QGraphicsView doesn't
support.
Best Regards,
Torsten
> how would you see the drawing being done? - 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)?
> - logically where do you see the missing mouse event handling being
> inserted?
>
> BR
>
> Amit
>
> On Wed, May 9, 2012 at 1:00 PM, <marble-devel-request at kde.org> wrote:
> > Today's Topics:
> > 1. Re: User interaction with data in a LayerInterface subclass
> >
> > (Torsten Rahn)
> >
> > 2. Re: User interaction with data in a LayerInterface subclass
> >
> > (Dennis Nienh?ser)
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 9 May 2012 08:06:24 +0200
> > From: "Torsten Rahn" <tackat at t-online.de>
> > To: marble-devel at kde.org
> > Subject: Re: [Marble-devel] User interaction with data in a
> >
> > LayerInterface subclass
> >
> > Message-ID: <201205090806.24649.torsten at kde.org>
> > Content-Type: Text/Plain; charset="iso-8859-15"
> >
> > On Dienstag, 8. Mai 2012 21:08:18 Amit Chaudhuri wrote:
> > > I want to be able to interact with individual lines or nodes by
> > > hovering with a mouse, double clicking or selection through a menu. I
> > > want to
> >
> > show
> >
> > > data such as a node code or a description when an item is hovered over.
> >
> > Ideally the solution would be to use GeoGraphicsLineString from
> > marble/src/lib/geodata/graphicsitem (This should work in a similar manner
> > to
> > GraphicsView), but IIRC it lacks mouse interaction so far (we'd be happy
> > about
> > patches that would provide this functionality though).
> >
> > For its implementation (or for your own GeoPainter based one) you need a
> > way
> > to interact with the drawn line though: In order to determine whether the
> > linestring is "hovered" by the mouse you could use
> >
> > QRegion GeoPainter::regionFromPolyline ( const GeoDataLineString &
> >
> > lineString, qreal strokeWidth = 3 ) const;
> >
> > which has been there for this actual purpose.
> >
> > BR,
> > Torsten
> >
> >
> >
> > Message: 2
> > Date: Wed, 9 May 2012 09:42:39 +0200
> > From: Dennis Nienh?ser <earthwings at gentoo.org>
> > To: <marble-devel at kde.org>
> > Subject: Re: [Marble-devel] User interaction with data in a
> >
> > LayerInterface subclass
> >
> > Message-ID: <4FAA1FEF.9030003 at gentoo.org>
> > Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
> >
> > Am 09.05.2012 08:06, schrieb Torsten Rahn:
> > > On Dienstag, 8. Mai 2012 21:08:18 Amit Chaudhuri wrote:
> > An example implementation of an interactive layer is in
> > src/lib/routing/RoutingLayer. Among other things it implements reaction
> > to hovering using the regionFromPolyline method.
> >
> > Regards,
> > Dennis
> >
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > Marble-devel mailing list
> > Marble-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/marble-devel
> >
> >
> > End of Marble-devel Digest, Vol 57, Issue 17
> > ********************************************
More information about the Marble-devel
mailing list