• 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
  • tools
  • maptheme-previewimage
tools/maptheme-previewimage/main.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 2013 Dennis Nienhüser <earthwings@gentoo.org>
9 //
10 
11 #include <MarbleWidget.h>
12 #include <RenderPlugin.h>
13 
14 #include <QDebug>
15 #include <QApplication>
16 #include <QPixmap>
17 #include <QPainter>
18 
19 using namespace Marble;
20 
21 int main(int argc, char** argv)
22 {
23  QApplication app(argc,argv);
24 
25  if ( argc < 2 ) {
26  qDebug() << "Usage: " << argv[0] << " <maptheme> [output.png]";
27  qDebug() << "Where <maptheme> is a map theme id a la 'body/maptheme/maptheme.dgml'.";
28  return 1;
29  }
30 
31  MarbleWidget *mapWidget = new MarbleWidget;
32  mapWidget->setMapThemeId( argv[1] );
33  QStringList const features = QStringList() << "atmosphere";
34  foreach( RenderPlugin* plugin, mapWidget->renderPlugins() ) {
35  if ( !features.contains( plugin->nameId() ) ) {
36  plugin->setEnabled( false );
37  }
38  }
39  double const scale = 4.0;
40  mapWidget->resize( 130 * scale, 130 * scale );
41  mapWidget->centerOn( 49.59526, 18.48104 );
42  mapWidget->setRadius( 120 * scale / 2.0 );
43 
44  QPixmap canvas( ":/canvas.png" );
45  QPainter globePainter( &canvas );
46  QPixmap const globe = QPixmap::grabWidget( mapWidget );
47  globePainter.drawPixmap( QPoint( 2, 2 ), globe.scaled( 130, 130, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
48  globePainter.end();
49  canvas.save( argc > 2 ? argv[2] : "preview.png" );
50 
51  return 0;
52 }
QPainter
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:102
Marble::MarbleWidget::setMapThemeId
void setMapThemeId(const QString &maptheme)
Set a new map theme.
Definition: MarbleWidget.cpp:865
Marble::RenderPlugin::nameId
QString nameId
Definition: RenderPlugin.h:48
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::MarbleWidget::setRadius
void setRadius(int radius)
Set the radius of the globe in pixels.
Definition: MarbleWidget.cpp:331
Marble::RenderPlugin::setEnabled
void setEnabled(bool enabled)
settting enabled
Definition: RenderPlugin.cpp:137
RenderPlugin.h
MarbleWidget.h
This file contains the headers for MarbleWidget.
main
int main(int argc, char **argv)
Definition: tools/maptheme-previewimage/main.cpp:21
Marble::RenderPlugin
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
Marble::MarbleWidget::renderPlugins
QList< RenderPlugin * > renderPlugins() const
Returns a list of all RenderPlugins on the widget, this includes float items.
Definition: MarbleWidget.cpp:1251
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 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