• 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
  • examples
  • cpp
  • overlay-rendering
examples/cpp/overlay-rendering/main.cpp
Go to the documentation of this file.
1 #include <QDebug>
2 #include <QFileInfo>
3 #include <QApplication>
4 #include <QImage>
5 
6 #include <marble/MarbleWidget.h>
7 #include <GeoDataDocument.h>
8 #include <GeoDataGroundOverlay.h>
9 #include <marble/GeoDataTreeModel.h>
10 #include <marble/MarbleModel.h>
11 
12 using namespace Marble;
13 
14 int main(int argc, char** argv) {
15 
16  QApplication app(argc,argv);
17 
18  QFileInfo inputFile( app.arguments().last() );
19  if ( app.arguments().size() < 2 || !inputFile.exists() ) {
20  qWarning() << "Usage: " << app.arguments().first() << "file.png";
21  return 1;
22  }
23 
24  // Create a Marble QWidget without a parent
25  MarbleWidget *mapWidget = new MarbleWidget();
26 
27  // Load the Satellite map
28  mapWidget->setMapThemeId( "earth/bluemarble/bluemarble.dgml" );
29 
30  // Create a bounding box from the given corner points
31  GeoDataLatLonBox box( 55, 48, 14.5, 6, GeoDataCoordinates::Degree );
32  box.setRotation( 0, GeoDataCoordinates::Degree );
33 
34  // Create an overlay and assign the image to render and its bounding box to it
35  GeoDataGroundOverlay *overlay = new GeoDataGroundOverlay;
36  overlay->setLatLonBox( box );
37  overlay->setIcon( QImage( inputFile.absoluteFilePath() ) );
38 
39  // Create a document as a container for the overlay
40  GeoDataDocument *document = new GeoDataDocument();
41  document->append( overlay );
42 
43  // Add the document to MarbleWidget's tree model
44  mapWidget->model()->treeModel()->addDocument( document );
45 
46  mapWidget->show();
47 
48  return app.exec();
49 }
50 
GeoDataDocument.h
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:64
GeoDataGroundOverlay.h
Marble::MarbleModel::treeModel
GeoDataTreeModel * treeModel()
Return the list of Placemarks as a QAbstractItemModel *.
Definition: MarbleModel.cpp:407
MarbleModel.h
This file contains the headers for MarbleModel.
Marble::GeoDataOverlay::setIcon
void setIcon(const QImage &icon)
Definition: GeoDataOverlay.cpp:88
Marble::GeoDataTreeModel::addDocument
int addDocument(GeoDataDocument *document)
Definition: GeoDataTreeModel.cpp:595
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
main
int main(int argc, char **argv)
Definition: examples/cpp/overlay-rendering/main.cpp:14
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::MarbleWidget::model
MarbleModel * model() const
Return the model that this view shows.
Definition: MarbleWidget.cpp:283
GeoDataTreeModel.h
Marble::GeoDataContainer::append
void append(GeoDataFeature *other)
add an element
Definition: GeoDataContainer.cpp:165
Marble::GeoDataGroundOverlay
Definition: GeoDataGroundOverlay.h:24
MarbleWidget.h
This file contains the headers for MarbleWidget.
Marble::GeoDataGroundOverlay::setLatLonBox
void setLatLonBox(const GeoDataLatLonBox &box)
Definition: GeoDataGroundOverlay.cpp:88
Marble::GeoDataLatLonBox::setRotation
void setRotation(const qreal rotation, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
Definition: GeoDataLatLonBox.cpp:177
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
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