[Marble-devel] Drawing a box on the map

Kyle Shannon ksshannon at gmail.com
Tue Feb 14 22:51:22 UTC 2012


Thanks Dennis,
Is there a hard way that is more proper, or is reimplementing the input
handler proper?  Also addGeoDataString doesn't have much for documentation.
 Does it take a kml?  I am getting a seg fault with a string (generated
from the selection):

<Placemark>
<LinearRing>
<extrude>0</extrude>
<tessellate>0</tessellate>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>
-114.804200,47.627658,0.0
-112.560859,47.627658,0.0
-112.560859,46.053973,0.0
-114.804200,46.053973,0.0
-114.804200,47.627658,0.0
</coordinates>
</LinearRing>
</Placemark>

Which loads into google earth without error.  Is there anywhere else to
look, or should I just go straight to the code?

kss

/**
 *
 * Kyle Shannon
 * ksshannon at gmail.com
 *
 */



On Tue, Feb 14, 2012 at 14:22, Dennis Nienhüser <earthwings at gentoo.org>wrote:

> Hi Kyle,
>
> 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.
>
> Regards,
> Dennis
>
> On 14.02.2012 21:42, Kyle Shannon wrote:
> > Hello,
> > 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
> > build.
> >
> > kss
> >
> > /**
> >  *
> >  * Kyle Shannon
> >  * ksshannon at gmail.com <mailto:ksshannon at gmail.com>
> >  *
> >  */
> >
> >
> >
> > _______________________________________________
> > Marble-devel mailing list
> > Marble-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/marble-devel
>
> _______________________________________________
> Marble-devel mailing list
> Marble-devel at kde.org
> https://mail.kde.org/mailman/listinfo/marble-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20120214/8ba468d1/attachment.html>


More information about the Marble-devel mailing list