File indexing completed on 2024-10-13 03:32:52

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #include <QDebug>
0007 #include <QFileInfo>
0008 #include <QApplication>
0009 #include <QTreeView>
0010 
0011 #include <marble/MarbleWidget.h>
0012 #include <marble/MarbleModel.h>
0013 #include <marble/ParsingRunnerManager.h>
0014 #include <marble/GeoDataTreeModel.h>
0015 
0016 using namespace Marble;
0017 
0018 int main(int argc, char** argv)
0019 {
0020     QApplication app(argc,argv);
0021 
0022     QFileInfo inputFile( app.arguments().last() );
0023     if ( app.arguments().size() < 2 || !inputFile.exists() ) {
0024         qWarning() << "Usage: " << app.arguments().first() << "file.kml";
0025         return 1;
0026     }
0027 
0028     MarbleModel model;
0029     ParsingRunnerManager manager( model.pluginManager() );
0030 
0031     GeoDataDocument* document = manager.openFile( inputFile.absoluteFilePath() );
0032     if ( !document ) {
0033         qDebug() << "Unable to open " << inputFile.absoluteFilePath();
0034         return 2;
0035     }
0036 
0037     GeoDataTreeModel treeModel;
0038     treeModel.addDocument( document );
0039 
0040     QTreeView treeView;
0041     treeView.setModel( &treeModel );
0042     treeView.show();
0043 
0044     return app.exec();
0045 }