This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Display of GeoDataGroundOverlay problem

Tags: None
(comma "," separated)
tdacla
Registered Member
Posts
1
Karma
0
Hi all,

I am doing some development in Qt Marble (Qt 4) and there is a problem I can't solve.
My objective is to display an image projected on the map.
I tried to follow the tutorial here: http://techbase.kde.org/Projects/Marble ... undOverlay, which depicts exactly what I want, but at runtime, I have the following error message:
QFileInfo::absolutePath: Constructed with empty filename
I have absolutly no clue what's going on, so if any of you had the problem and solved it, I would really appreciate!!

I confirm that I used the exact same code as in the tutorial, without any addition to it.
Let me know if you still want me to post it here

edit: It seems the error happens when the following command is run:
Code: Select all
model()->treeModel()->addDocument( document );


Thanks for your help
Cheers,
tibo
amangeot
Registered Member
Posts
2
Karma
0
Hi everyone,
I have the same problem, using Qt4.8 and MarbleWidget 16 on Ubuntu.
Is there any chance you already solved the problem Tibo ? Or did you go for another way to project an image onto the map ?

The message comes from the following line, after a bounding box and an overlay :
Code: Select all
model()->treeModel()->addDocument( document );

The path is correct. I tried several sizes but I always receive this message :
QFileInfo::absolutePath: Constructed with empty filename

and no image is being projected.

Any idea where to take a look ?

Thanks, would help a lot, Marble is a such a great widget !

Adrien
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS
Can you provide a minimum example? Code + input files. Thanks.
amangeot
Registered Member
Posts
2
Karma
0
Yes sure, i simply used the example code, testing the image's filepath. No image is projected on the map :

Here is the output :
File exists
QFileInfo::absolutePath: Constructed with empty filename


The error message comes from this line exactly :
Code: Select all
model()->treeModel()->addDocument( document );

Code: Select all
#include <QDebug>
#include <QFileInfo>
#include <QApplication>
#include <QImage>

#include <marble/MarbleWidget.h>
#include <marble/GeoDataDocument.h>
#include <marble/GeoDataGroundOverlay.h>
#include <marble/GeoDataTreeModel.h>
#include <marble/MarbleModel.h>

using namespace Marble;

int main(int argc, char** argv) {

    QApplication app(argc,argv);

//    QFileInfo inputFile( app.arguments().last() );
//    if ( app.arguments().size() < 2 || !inputFile.exists() ) {
//        qWarning() << "Usage: " << app.arguments().first() << "file.png";
//        return 1;
//    }

    // Create a Marble QWidget without a parent
    MarbleWidget *mapWidget = new MarbleWidget();

    // Load the Satellite map
    mapWidget->setMapThemeId( "earth/bluemarble/bluemarble.dgml" );

    // Create a bounding box from the given corner points
    GeoDataLatLonBox box( 55, 48, 14.5, 6, GeoDataCoordinates::Degree );
    box.setRotation( 0, GeoDataCoordinates::Degree );

    /// BEGIN TEST
   
    QString filePath = "/home/batman/Documentos/Programas/OMNISYS/build-EW_Simulator-Qt_4_8_4-Debug/rio_map.png";
    if (QFile(filePath).exists())
        qDebug() << "File exists";
    else
        qDebug() << "File not found";
   
    /// END TEST
   
    // Create an overlay and assign the image to render and its bounding box to it
    GeoDataGroundOverlay *overlay = new GeoDataGroundOverlay;
    overlay->setLatLonBox( box );
//    overlay->setIcon( QImage( inputFile.absoluteFilePath() ) );
    overlay->setIcon( QImage(filePath) );

    // Create a document as a container for the overlay
    GeoDataDocument *document = new GeoDataDocument();
    document->append( overlay );

    // Add the document to MarbleWidget's tree model
    mapWidget->model()->treeModel()->addDocument( document );

    mapWidget->show();

    return app.exec();
}
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS
Just tested that code with git master and it renders fine (the ground overlay shown atop Germany)


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]