Commit 97e3eee5 authored by Siddharth Srivastava's avatar Siddharth Srivastava
Browse files

Merge branch 'master' of git.kde.org:marble

parents 330f1d12 c644c3cb
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
SET (TARGET kml-inspector)
PROJECT (${TARGET})
FIND_PACKAGE (Qt4 4.6.0 REQUIRED QtCore QtGui)
FIND_PACKAGE (Marble REQUIRED)
INCLUDE (${QT_USE_FILE})
INCLUDE_DIRECTORIES (${MARBLE_INCLUDE_DIR})
SET (LIBS ${LIBS} ${MARBLE_LIBRARIES} ${QT_LIBRARIES})
ADD_EXECUTABLE (${TARGET} main.cpp)
TARGET_LINK_LIBRARIES (${TARGET} ${LIBS})
The online version of this example can be found at
http://techbase.kde.org/Projects/Marble/Runners/Parse
Marble uses so-called runners to calculate routes, do reverse geocoding, parse
files and search for placemarks (cities, addresses, points of interest, ...).
This tutorial shows how to use the MarbleRunnerManager class to open a .kml (or
.gpx, ...) file and display its structure in a tree view.
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
#include <QtGui/QApplication>
#include <QtGui/QTreeView>
#include <marble/MarbleWidget.h>
#include <marble/MarbleModel.h>
#include <marble/MarbleRunnerManager.h>
#include <marble/GeoDataTreeModel.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.kml";
return 1;
}
MarbleModel *model = new MarbleModel;
MarbleRunnerManager* manager = new MarbleRunnerManager( model->pluginManager() );
GeoDataDocument* document = manager->openFile( inputFile.absoluteFilePath() );
if ( document ) {
GeoDataTreeModel* treeModel = new GeoDataTreeModel;
treeModel->addDocument( document );
QTreeView* treeView = new QTreeView;
treeView->setModel( treeModel );
treeView->show();
} else {
qDebug() << "Unable to open " << inputFile.absoluteFilePath();
}
return app.exec();
}
......@@ -346,6 +346,7 @@ else (APPLE AND QTONLY)
SunLocator.h
ClipPainter.h
GeoGraphicsScene.h
GeoDataTreeModel.h
geodata/data/GeoDataAbstractView.h
geodata/data/GeoDataAccuracy.h
geodata/data/GeoDataColorStyle.h
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment