[Marble-devel] Drawing a box on the map
earthwings at gentoo.org
Tue Feb 14 21:22:01 UTC 2012
an easy way (hack) would be to use the selection rubber band Marble uses
when you hold Ctrl and do the interaction you describe. You can access
that rectangle via the MarbleWidget::regionSelected(QList<double>)
signal. The list contains the border points (west, north, east, south,
in degree). To make it persistent, add your own layer as described in
the tutorials and have it paint the rectangle. Alternatively, create a
suitable .kml file with the rectangle, style it and add it to the map
via MarbleWidget::model()->addGeoDataString() or addGeoDataFile().
You can also add another event filter on the widget and handle the user
actions similarly to how MarbleWidgetDefaultInputHandler implements the
rubber band selection.
On 14.02.2012 21:42, Kyle Shannon wrote:
> I was wondering if it is possible to have the user draw a box on the
> map in marblewidget.
> 1) User clicks a point.
> 2) User drags the mouse to another point.
> The two points define a rectangle. I would like the drawing to be
> updated as well as the user drags the mouse. I checked the tutorials,
> and the GeoPainter examples are all pretty static. My question is
> where do I start? Do I need to look into Qt api stuff or somewhere in
> the marble api. I thought I found somenting in the digikam source,
> but it didn't seem like what I was looking for. I am using the QTONLY
> * Kyle Shannon
> * ksshannon at gmail.com <mailto:ksshannon at gmail.com>
> Marble-devel mailing list
> Marble-devel at kde.org
More information about the Marble-devel