• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • apps
  • marble-kde
kdemain.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2007 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007 Inge Wallin <ingwa@kde.org>
10 // Copyright 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
11 //
12 
13 #include <KDE/KApplication>
14 #include <KDE/KLocale>
15 #include <KDE/KAboutData>
16 #include <KDE/KCmdLineArgs>
17 #include <KDE/KConfig>
18 #include <KDE/KConfigGroup>
19 #include <KDE/KGlobal>
20 
21 #include <QFile>
22 
23 #include "ControlView.h"
24 #include "KdeMainWindow.h"
25 #include "MarbleDebug.h"
26 
27 #include "MarbleTest.h"
28 
29 #ifdef STATIC_BUILD
30  #include <QtPlugin>
31  Q_IMPORT_PLUGIN(qjpeg)
32  Q_IMPORT_PLUGIN(qsvg)
33 #endif
34 
35 using namespace Marble;
36 
37 // The GraphicsSystem needs to be set before the instantiation of the
38 // QApplication. Therefore we need to parse the current setting
39 // in this unusual place :-/
40 
41 QString readGraphicsSystem( int argc, char *argv[], const KAboutData& aboutData )
42 {
43  QCoreApplication app( argc, argv );
44  KComponentData componentData( aboutData, KComponentData::SkipMainComponentRegistration );
45 
46  KConfigGroup viewGroup( componentData.config(), "View" );
47  QString graphicsSystem = viewGroup.readEntry( "graphicsSystem", "RasterGraphics" );
48 
49  QString graphicsString( "native" );
50  if ( graphicsSystem == QString( "RasterGraphics" ) ) {
51  graphicsString = QString( "raster" );
52  }
53  if ( graphicsSystem == QString( "OpenGLGraphics" ) ) {
54  graphicsString = QString( "opengl" );
55  }
56 
57  return graphicsString;
58 }
59 
60 int main ( int argc, char *argv[] )
61 {
62  KAboutData aboutData( "marble", 0,
63  ki18n( "Marble Virtual Globe" ),
64  ControlView::applicationVersion().toLatin1(),
65  ki18n( "A World Atlas." ),
66  KAboutData::License_LGPL,
67  ki18n( "(c) 2007-2012" ), // FIXME: use subs() here and replace 2012 by %1
68  KLocalizedString(),
69  "http://edu.kde.org/marble" );
70 
71  // Active Development Team of Marble
72  aboutData.addAuthor( ki18n( "Torsten Rahn" ),
73  ki18n( "Developer and Original Author" ),
74  "rahn@kde.org" );
75  aboutData.addAuthor( ki18n( "Bernhard Beschow" ),
76  ki18n( "WMS Support, Mobile, Performance" ),
77  "bbeschow@cs.tu-berlin.de" );
78  aboutData.addAuthor( ki18n( "Thibaut Gridel" ),
79  ki18n( "Geodata" ),
80  "tgridel@free.fr" );
81  aboutData.addAuthor( ki18n( "Jens-Michael Hoffmann" ),
82  ki18n( "OpenStreetMap Integration, OSM Namefinder, Download Management" ),
83  "jmho@c-xx.com", "http://www.c-xx.com" );
84  aboutData.addAuthor( ki18n( "Florian E&szlig;er" ),
85  ki18n( "Elevation Profile" ),
86  "f.esser@rwth-aachen.de" );
87  aboutData.addAuthor( ki18n( "Wes Hardaker" ),
88  ki18n( "APRS Plugin" ),
89  "marble@hardakers.net" );
90  aboutData.addAuthor( ki18n( "Bastian Holst" ),
91  ki18n( "Online Services support" ),
92  "bastianholst@gmx.de" );
93  aboutData.addAuthor( ki18n( "Guillaume Martres" ),
94  ki18n( "Satellites" ),
95  "smarter@ubuntu.com" );
96  aboutData.addAuthor( ki18n( "Rene Kuettner" ),
97  ki18n( "Satellites, Eclipses" ),
98  "rene@bitkanal.net" );
99  aboutData.addAuthor( ki18n( "Friedrich W. H. Kossebau" ),
100  ki18n( "Plasma Integration, Bugfixes" ),
101  "kossebau@kde.org" );
102  aboutData.addAuthor( ki18n( "Dennis Nienhüser" ),
103  ki18n( "Routing, Navigation, Mobile" ),
104  "earthwings@gentoo.org" );
105  aboutData.addAuthor( ki18n( "Niko Sams" ),
106  ki18n( "Routing, Elevation Profile" ),
107  "niko.sams@gmail.com" );
108  aboutData.addAuthor( ki18n( "Patrick Spendrin" ),
109  ki18n( "Core Developer: KML and Windows support" ),
110  "pspendrin@gmail.com" );
111  aboutData.addAuthor( ki18n( "Eckhart Wörner" ),
112  ki18n( "Bugfixes" ),
113  "kde@ewsoftware.de" );
114 
115  // Developers:
116 
117  aboutData.addAuthor( ki18n( "Inge Wallin" ),
118  ki18n( "Core Developer and Co-Maintainer" ),
119  "inge@lysator.liu.se" );
120  aboutData.addAuthor( ki18n( "Henry de Valence" ),
121  ki18n( "Core Developer: Marble Runners, World-Clock Plasmoid" ),
122  "hdevalence@gmail.com" );
123  aboutData.addAuthor( ki18n( "Pino Toscano" ),
124  ki18n( "Network plugins" ),
125  "pino@kde.org" );
126  aboutData.addAuthor( ki18n( "Harshit Jain" ),
127  ki18n( "Planet filter" ),
128  "sonu.itbhu@googlemail.com" );
129  aboutData.addAuthor( ki18n( "Simon Edwards" ),
130  ki18n( "Marble Python Bindings" ),
131  "simon@simonzone.com" );
132  aboutData.addAuthor( ki18n( "Magnus Valle" ),
133  ki18n( "Historical Maps" ),
134  "" );
135  aboutData.addAuthor( ki18n( "Médéric Boquien" ),
136  ki18n( "Astronomical Observatories" ),
137  "mboquien@free.fr" );
138 
139  // ESA Summer of Code in Space
140  aboutData.addAuthor( ki18n( "Rene Kuettner" ),
141  ki18n( "ESA Summer of Code in Space 2012 Project:"
142  " Visualization of planetary satellites" ),
143  "rene@bitkanal.net" );
144  aboutData.addAuthor( ki18n( "Guillaume Martres" ),
145  ki18n( "ESA Summer of Code in Space 2011 Project:"
146  " Visualisation of Satellite Orbits" ),
147  "smarter@ubuntu.com" );
148 
149  // Google Summer of Code
150  aboutData.addAuthor( ki18n( "Konstantin Oblaukhov" ),
151  ki18n( "Google Summer of Code 2011 Project:"
152  " OpenStreetMap Vector Rendering" ),
153  "oblaukhov.konstantin@gmail.com" );
154  aboutData.addAuthor( ki18n( "Daniel Marth" ),
155  ki18n( "Google Summer of Code 2011 Project:"
156  " Marble Touch on MeeGo" ),
157  "danielmarth@gmx.at" );
158  aboutData.addAuthor( ki18n( "Gaurav Gupta" ),
159  ki18n( "Google Summer of Code 2010 Project:"
160  " Bookmarks" ),
161  "1989.gaurav@gmail.com" );
162  aboutData.addAuthor( ki18n( "Harshit Jain " ),
163  ki18n( "Google Summer of Code 2010 Project:"
164  " Time Support" ),
165  "hjain.itbhu@gmail.com" );
166  aboutData.addAuthor( ki18n( "Siddharth Srivastava" ),
167  ki18n( "Google Summer of Code 2010 Project:"
168  " Turn-by-turn Navigation" ),
169  "akssps011@gmail.com" );
170  aboutData.addAuthor( ki18n( "Andrew Manson" ),
171  ki18n( "Google Summer of Code 2009 Project:"
172  " OSM Annotation" ),
173  "g.real.ate@gmail.com" );
174  aboutData.addAuthor( ki18n( "Bastian Holst" ),
175  ki18n( "Google Summer of Code 2009 Project:"
176  " Online Services" ),
177  "bastianholst@gmx.de" );
178  aboutData.addAuthor( ki18n( "Patrick Spendrin" ),
179  ki18n( "Google Summer of Code 2008 Project:"
180  " Vector Tiles for Marble" ),
181  "pspendrin@gmail.com" );
182  aboutData.addAuthor( ki18n( "Shashank Singh" ),
183  ki18n( "Google Summer of Code 2008 Project:"
184  " Panoramio / Wikipedia -photo support for Marble" ),
185  "shashank.personal@gmail.com" );
186  aboutData.addAuthor( ki18n( "Carlos Licea" ),
187  ki18n( "Google Summer of Code 2007 Project:"
188  " Equirectangular Projection (\"Flat Map\")" ),
189  "carlos.licea@kdemail.net" );
190  aboutData.addAuthor( ki18n( "Andrew Manson" ),
191  ki18n( "Google Summer of Code 2007 Project:"
192  " GPS Support for Marble" ),
193  "g.real.ate@gmail.com" );
194  aboutData.addAuthor( ki18n( "Murad Tagirov" ),
195  ki18n( "Google Summer of Code 2007 Project:"
196  " KML Support for Marble" ),
197  "tmurad@gmail.com" );
198 
199  // Developers
200  aboutData.addAuthor( ki18n( "Simon Schmeisser" ),
201  ki18n( "Development & Patches" ));
202  aboutData.addAuthor( ki18n( "Claudiu Covaci" ),
203  ki18n( "Development & Patches" ));
204  aboutData.addAuthor( ki18n( "David Roberts" ),
205  ki18n( "Development & Patches" ));
206  aboutData.addAuthor( ki18n( "Nikolas Zimmermann" ),
207  ki18n( "Development & Patches" ));
208  aboutData.addAuthor( ki18n( "Jan Becker" ),
209  ki18n( "Development & Patches" ));
210  aboutData.addAuthor( ki18n( "Stefan Asserhäll" ),
211  ki18n( "Development & Patches" ));
212  aboutData.addAuthor( ki18n( "Laurent Montel" ),
213  ki18n( "Development & Patches" ));
214  aboutData.addAuthor( ki18n( "Mayank Madan" ),
215  ki18n( "Development & Patches" ));
216  aboutData.addAuthor( ki18n( "Prashanth Udupa" ),
217  ki18n( "Development & Patches" ));
218  aboutData.addAuthor( ki18n( "Anne-Marie Mahfouf" ),
219  ki18n( "Development & Patches" ));
220  aboutData.addAuthor( ki18n( "Josef Spillner" ),
221  ki18n( "Development & Patches" ));
222  aboutData.addAuthor( ki18n( "Frerich Raabe" ),
223  ki18n( "Development & Patches" ));
224  aboutData.addAuthor( ki18n( "Frederik Gladhorn" ),
225  ki18n( "Development & Patches" ));
226  aboutData.addAuthor( ki18n( "Fredrik Höglund" ),
227  ki18n( "Development & Patches" ));
228  aboutData.addAuthor( ki18n( "Albert Astals Cid" ),
229  ki18n( "Development & Patches" ));
230  aboutData.addAuthor( ki18n( "Thomas Zander" ),
231  ki18n( "Development & Patches" ));
232  aboutData.addAuthor( ki18n( "Joseph Wenninger" ),
233  ki18n( "Development & Patches" ));
234  aboutData.addAuthor( ki18n( "Kris Thomsen" ),
235  ki18n( "Development & Patches" ));
236  aboutData.addAuthor( ki18n( "Daniel Molkentin" ),
237  ki18n( "Development & Patches" ));
238  aboutData.addAuthor( ki18n( "Christophe Leske" ),
239  ki18n( "Platforms & Distributions" ));
240  aboutData.addAuthor( ki18n( "Sebastian Wiedenroth" ),
241  ki18n( "Platforms & Distributions" ));
242  aboutData.addAuthor( ki18n( "Tim Sutton" ),
243  ki18n( "Platforms & Distributions" ));
244  aboutData.addAuthor( ki18n( "Christian Ehrlicher" ),
245  ki18n( "Platforms & Distributions" ));
246  aboutData.addAuthor( ki18n( "Ralf Habacker" ),
247  ki18n( "Platforms & Distributions" ));
248  aboutData.addAuthor( ki18n( "Steffen Joeris" ),
249  ki18n( "Platforms & Distributions" ));
250  aboutData.addAuthor( ki18n( "Marcus Czeslinski" ),
251  ki18n( "Platforms & Distributions" ));
252  aboutData.addAuthor( ki18n( "Marcus D. Hanwell" ),
253  ki18n( "Platforms & Distributions" ));
254  aboutData.addAuthor( ki18n( "Chitlesh Goorah" ),
255  ki18n( "Platforms & Distributions" ));
256  aboutData.addAuthor( ki18n( "Nuno Pinheiro" ),
257  ki18n( "Artwork" ));
258  aboutData.addAuthor( ki18n( "Torsten Rahn" ),
259  ki18n( "Artwork" ));
260 
261  // Credits
262  aboutData.addCredit( ki18n( "Luis Silva" ),
263  ki18n( "Various Suggestions & Testing" ));
264  aboutData.addCredit( ki18n( "Stefan Jordan" ),
265  ki18n( "Various Suggestions & Testing" ));
266  aboutData.addCredit( ki18n( "Robert Scott" ),
267  ki18n( "Various Suggestions & Testing" ));
268  aboutData.addCredit( ki18n( "Lubos Petrovic" ),
269  ki18n( "Various Suggestions & Testing" ));
270  aboutData.addCredit( ki18n( "Benoit Sigoure" ),
271  ki18n( "Various Suggestions & Testing" ));
272  aboutData.addCredit( ki18n( "Martin Konold" ),
273  ki18n( "Various Suggestions & Testing" ));
274  aboutData.addCredit( ki18n( "Matthias Welwarsky" ),
275  ki18n( "Various Suggestions & Testing" ));
276  aboutData.addCredit( ki18n( "Rainer Endres" ),
277  ki18n( "Various Suggestions & Testing" ));
278  aboutData.addCredit( ki18n( "Ralf Gesellensetter" ),
279  ki18n( "Various Suggestions & Testing" ));
280  aboutData.addCredit( ki18n( "Tim Alder" ),
281  ki18n( "Various Suggestions & Testing" ));
282  aboutData.addCredit( ki18n( "John Layt" ),
283  ki18n( "Special thanks for providing an"
284  " important source of inspiration by creating"
285  " Marble's predecessor \"Kartographer\"." ));
286 
287  QApplication::setGraphicsSystem( readGraphicsSystem( argc, argv, aboutData ) );
288 
289  KCmdLineArgs::init( argc, argv, &aboutData );
290 
291  // Autodetect profiles
292  MarbleGlobal::Profiles profiles = MarbleGlobal::detectProfiles();
293 
294  KCmdLineOptions options;
295  options.add( "debug-info", ki18n( "Enable debug output" ) );
296  options.add( "timedemo", ki18n( "Make a time measurement to check performance" ) );
297  options.add( "fps", ki18n( "Show frame rate" ) );
298  options.add( "tile-id", ki18n( "Show tile IDs" ) );
299  options.add( "runtimeTrace", ki18n( "Show time spent in each layer" ) );
300  options.add( "marbledatapath <data path>", ki18n( "Use a different directory which contains map data" ) );
301  if( profiles & MarbleGlobal::SmallScreen ) {
302  options.add( "nosmallscreen", ki18n( "Do not use the interface optimized for small screens" ) );
303  }
304  else {
305  options.add( "smallscreen", ki18n( "Use the interface optimized for small screens" ) );
306  }
307  if( profiles & MarbleGlobal::HighResolution ) {
308  options.add( "nohighresolution", ki18n( "Do not use the interface optimized for high resolutions" ) );
309  }
310  else {
311  options.add( "highresolution", ki18n( "Use the interface optimized for high resolutions" ) );
312  }
313  options.add( "latlon <coordinates>", ki18n( "Show map at given lat lon coordinates" ) );
314  options.add( "distance <value>", ki18n( "Set the distance of the observer to the globe (in km)" ) );
315  options.add( "map <id>", ki18n( "Use map id (e.g. \"earth/openstreetmap/openstreetmap.dgml\")" ) );
316  options.add( "+[file]", ki18n( "One or more placemark files to be opened" ) );
317 
318  KCmdLineArgs::addCmdLineOptions( options );
319  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
320 
321  KApplication app;
322  KGlobal::locale()->insertCatalog( "marble_qt" );
323 
324 
325 
326  MarbleDebug::setEnabled( args->isSet( "debug-info" ) );
327 
328  if ( args->isSet( "smallscreen" ) ) {
329  profiles |= MarbleGlobal::SmallScreen;
330  }
331  else {
332  profiles &= ~MarbleGlobal::SmallScreen;
333  }
334 
335  if ( args->isSet( "highresolution" ) ) {
336  profiles |= MarbleGlobal::HighResolution;
337  }
338  else {
339  profiles &= ~MarbleGlobal::HighResolution;
340  }
341 
342  MarbleGlobal::getInstance()->setProfiles( profiles );
343 
344  QString marbleDataPath = args->getOption( "marbledatapath" );
345  if( marbleDataPath.isEmpty() ) {
346  marbleDataPath.clear();
347  }
348  MainWindow *window = new MainWindow( marbleDataPath );
349  window->setAttribute( Qt::WA_DeleteOnClose, true );
350  window->show();
351 
352  if ( args->isSet( "timedemo" ) ) {
353  window->resize(900, 640);
354  MarbleTest test( window->marbleWidget() );
355  test.timeDemo();
356  return 0;
357  }
358 
359  if ( args->isSet( "fps" ) ) {
360  window->marbleControl()->marbleWidget()->setShowFrameRate( true );
361  }
362 
363  if ( args->isSet( "tile-id" ) ) {
364  window->marbleControl()->marbleWidget()->setShowTileId( true );
365  }
366 
367  const QString map = args->getOption( "map" );
368  if ( !map.isEmpty() ) {
369  window->marbleWidget()->setMapThemeId(map);
370  }
371 
372  const QString coordinatesString = args->getOption( "latlon" );
373  if ( !coordinatesString.isEmpty() ) {
374  bool success = false;
375  const GeoDataCoordinates coordinates = GeoDataCoordinates::fromString(coordinatesString, success);
376  if ( success ) {
377  const qreal longitude = coordinates.longitude(GeoDataCoordinates::Degree);
378  const qreal latitude = coordinates.latitude(GeoDataCoordinates::Degree);
379  window->marbleWidget()->centerOn(longitude, latitude);
380  }
381  }
382 
383  const QString distance = args->getOption( "distance" );
384  if ( !distance.isEmpty() ) {
385  bool success = false;
386  const qreal distanceValue = distance.toDouble(&success);
387  if ( success )
388  window->marbleWidget()->setDistance(distanceValue);
389  }
390 
391  // Read the files that are given on the command line.
392  for ( int i = 0; i < args->count(); ++i ) {
393 
394  // FIXME: Use openUrl( args->url(i) ) instead?
395  if ( QFile::exists( args->arg( i ) ) )
396  window->marbleControl()->addGeoDataFile( args->arg( i ) );
397  }
398 
399  return app.exec();
400 }
KdeMainWindow.h
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::MarbleGlobal::setProfiles
void setProfiles(Profiles profiles)
Definition: MarbleGlobal.cpp:52
Marble::MainWindow::marbleControl
ControlView * marbleControl() const
Definition: KdeMainWindow.cpp:74
Marble::MarbleGlobal::HighResolution
Definition: MarbleGlobal.h:269
Marble::MarbleGlobal::detectProfiles
static Profiles detectProfiles()
Automatically detects the profile.
Definition: MarbleGlobal.cpp:56
Marble::GeoDataCoordinates::latitude
qreal latitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the latitude of the GeoDataCoordinates object use the unit parameter to switch between Radi...
Definition: GeoDataCoordinates.cpp:751
MarbleDebug.h
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
Marble::MarbleWidget::setMapThemeId
void setMapThemeId(const QString &maptheme)
Set a new map theme.
Definition: MarbleWidget.cpp:865
Marble::ControlView::applicationVersion
static QString applicationVersion()
Returns the version of the Marble applications (which differs from the Marble library version)...
Definition: ControlView.cpp:102
Marble::MarbleTest
Definition: MarbleTest.h:24
main
int main(int argc, char *argv[])
Definition: kdemain.cpp:60
Marble::GeoDataCoordinates::longitude
qreal longitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the longitude of the GeoDataCoordinates object use the unit parameter to switch between Rad...
Definition: GeoDataCoordinates.cpp:739
Marble::MarbleWidget::centerOn
void centerOn(const qreal lon, const qreal lat, bool animated=false)
Center the view on a geographical point.
Definition: MarbleWidget.cpp:626
Marble::ControlView::marbleWidget
MarbleWidget * marbleWidget() const
Definition: ControlView.h:59
QCoreApplication
readGraphicsSystem
QString readGraphicsSystem(int argc, char *argv[], const KAboutData &aboutData)
Definition: kdemain.cpp:41
Marble::MarbleGlobal::SmallScreen
Definition: MarbleGlobal.h:268
Marble::MarbleGlobal::getInstance
static MarbleGlobal * getInstance()
Definition: MarbleGlobal.cpp:37
MarbleTest.h
Marble::MainWindow
Definition: KdeMainWindow.h:26
Marble::MarbleTest::timeDemo
void timeDemo()
Definition: MarbleTest.cpp:31
Marble::MarbleWidget::setShowTileId
void setShowTileId(bool visible)
Set whether the is tile is visible NOTE: This is part of the transitional debug API and might be subj...
Definition: MarbleWidget.cpp:1070
Marble::MarbleGlobal
Definition: MarbleGlobal.h:258
Marble::MarbleWidget::setDistance
void setDistance(qreal distance)
Set the distance of the observer to the globe in km.
Definition: MarbleWidget.cpp:1197
Marble::ControlView::addGeoDataFile
void addGeoDataFile(QString filename)
Definition: ControlView.cpp:614
Marble::GeoDataCoordinates::fromString
static GeoDataCoordinates fromString(const QString &string, bool &successful)
try to parse the string into a coordinate pair
Definition: GeoDataCoordinates.cpp:909
ControlView.h
Marble::MainWindow::marbleWidget
MarbleWidget * marbleWidget() const
Definition: KdeMainWindow.cpp:79
Marble::MarbleDebug::setEnabled
static void setEnabled(bool enabled)
setEnabled Toggle debug information output generation
Definition: MarbleDebug.cpp:47
Marble::MarbleWidget::setShowFrameRate
void setShowFrameRate(bool visible)
Set whether the frame rate gets shown.
Definition: MarbleWidget.cpp:1051
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal