[Marble-devel] API and loading of KML files

Thomas 'Tom' Malkus tom at dl7bj.de
Fri Sep 26 23:52:48 UTC 2014


Hi,

I am new to Marble and Qt.

I wrote this short code to test the possibility to use Marble for Ham 
Radio applications. I tried it with this KML File: 
http://web.bxhome.org/sites/default/files/usr/pfx.kmz to display so 
called DXCC entities.

#include <QtGui/QApplication>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>

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

using namespace Marble;

int main(int argc, char** argv)
{
   QApplication app(argc,argv);
   MarbleWidget *mapWidget = new MarbleWidget();

 
mapWidget->model()->addGeoDataFile("/home/tom/projects/Qt/dxcc/test.kml"); 


     mapWidget->resize(800,600);
     mapWidget->setWindowTitle("DXCC Map");
     mapWidget->setMapThemeId("earth/bluemarble/bluemarble.dgml");

     mapWidget->setZoom(1100);

     GeoDataCoordinates 
position(8.545486,53.106076,0.0,GeoDataCoordinates::Degree);

     mapWidget->centerOn(position);

     mapWidget->show();
     return app.exec();
}

When I start this program, the position and zoom level is correct, but 
only for a short moment, less than a second.

Then the globe will be shrinked for roundabout the half size of the 
window and the center position goes to 30° longitude and 15° latitude. I 
think this happens, if the KML file is complete loaded.

This doesn't happen, if I reduce the KML file to one entity. With two 
entities the zoom level goes up, but also the position is set to 30° 
longitude and 15° latitude.

This is not, what I want. I try to display a specific DXCC entitiy 
centered and zoomed. Where is my mistake?

Thanks,
Tom
-- 
DARC OV I18|DL-QRP-AG #1186|G-QRP #14624|FISTS #15933|AGCW #2737|ARRL
http://dl7bj.org                            https://twitter.com/dl7bj


More information about the Marble-devel mailing list