[Marble-devel] GroundOverlay

Konrad Enzensberger e.konrad at mpegcode.com
Wed Jun 20 11:13:07 UTC 2012


Hi,

after updating from repository i am facing a problem importing
KML with GroundOverlayTag .
GroundOverlay worked perfect in previous version (from 14.05.2012)

The referenced image is not displayed on the map because of
the GeoImageGraphicsItem::paint() is never called.

paint() is not called because of:

GeometryLayer::render(...)
...
QList<GeoGraphicsItem*> items = d->m_scene.items( viewport->viewLatLonAltBox(),
maxZoomLevel );
...

returns allways a empty list.
Doing more investigation i found that:

void GeometryLayerPrivate::createGraphicsItemFromOverlay( const GeoDataOverlay
*overlay )
{
  ...
  m_scene.addItem( item );

creates and adds the GeoImageGraphicsItem to the scene, but the methode:

void GeoGraphicsScene::addItem( GeoGraphicsItem* item )
{
    // Select zoom level so that the object fit in single tile
    int zoomLevel;
    qreal north, south, east, west;
    item->latLonAltBox().boundaries( north, south, east, west );

allways returns 0 for the north, south, east, and west values.

Problem: the GeoGraphicsItemPrivate - GeoDataLatLonAltBox m_latLonAltBox;

is never set.



I see that in GeometryLayerPrivate::createGraphicsItemFromOverlay(...),

the LatLonBox is set for the GeoImageGraphicsItem:

imageItem->setLatLonBox( groundOverlay->latLonBox() );



But this has no effect for the GeoGraphicsItemPrivate::m_latLonAltBox member



For a quick bugfix i add this line to:

void GeometryLayerPrivate::createGraphicsItemFromOverlay( const GeoDataOverlay
*overlay )
{
    GeoGraphicsItem* item = 0;
    if ( overlay->nodeType() == GeoDataTypes::GeoDataGroundOverlayType ) {
        GeoDataGroundOverlay const * groundOverlay =
static_cast<GeoDataGroundOverlay const *>( overlay );
        GeoImageGraphicsItem *imageItem = new GeoImageGraphicsItem;
        imageItem->setImageFile( groundOverlay->absoluteIconFile() );
        imageItem->setLatLonBox( groundOverlay->latLonBox() );
        item = imageItem;

        //new - enz

        item->setLatLonAltBox( groundOverlay->latLonBox() );



and now the GroundOverlay import works, the images is displayed.



maybe there is a better bugfix, i cant find, what code change is

the main reason for this bug,



br, konrad enzensberger











-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20120620/92f553cb/attachment-0001.html>


More information about the Marble-devel mailing list