[Marble-devel] Kml GroundOverlay

Konrad Enzensberger e.konrad at mpegcode.com
Fri May 31 13:33:08 UTC 2013


Hi,

like posted before, the rotation settings in Kml tag:
<GroundOverlay>
    <LatLonBox>
        <rotation>...

does not have any effect, the image is not rotated.
Because of this is made some modifications to GeometryLayer.cpp :.
createGraphicsItemFromOverlay( const GeoDataOverlay *overlay )
{
    if ( overlay->nodeType() == GeoDataTypes::GeoDataGroundOverlayType ) {
    ...
    //new
    GeoDataLatLonBox box = groundOverlay->latLonBox();
    qreal rotation = box.rotation(GeoDataCoordinates::Degree);
    if(rotation!=0)
    {
        QString qsImg = groundOverlay->absoluteIconFile();
        QImage img(qsImg);
        if(!img.isNull())
        {
            QMatrix rm;
            rm.rotate(rotation);
            img = img.transformed(rm);
            imageItem->setImage( img );
        }
    }//new end
    item = imageItem;
}

This works for me because all my images have same x/y resolution.
The image is now rotated like set in kml file.
 
But for other images (different x/y resolution) , the GeoDataLatLonBox coordinates also have to be rotated,
i think,

br, konrad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20130531/ee4ae17b/attachment.html>


More information about the Marble-devel mailing list