<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/api.php?action=feedcontributions&amp;user=Mayankmadan&amp;feedformat=atom</id>
		<title>KDE TechBase - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/api.php?action=feedcontributions&amp;user=Mayankmadan&amp;feedformat=atom"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Special:Contributions/Mayankmadan"/>
		<updated>2013-05-23T01:36:15Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/VehicleTracking</id>
		<title>Projects/Marble/Runners/VehicleTracking</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/VehicleTracking"/>
				<updated>2013-01-14T13:02:49Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/DisplayGeoDataPlacemark|Tutorial 6 - Displaying Places the proper way (via GeoDataDocuments)]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/OnlineServices|Tutorial 8 - Creating new online services]]|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We want to present you another C++ example of Marble Runnable usage, here on KDE TechBase. It's about the cars. Imagine that there are two flying cars in the air. They are driving around ukranian city Kiev (EURO-2012). They are driving circles around it with set radius and speed. At the end of tutorial you will have an application with smth like:&lt;br /&gt;
&lt;br /&gt;
[[File:Marble-VehicleTracking-1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's think about implementation a bit:&lt;br /&gt;
&lt;br /&gt;
# Init [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarbleWidget.html MarbleWidget]&lt;br /&gt;
# Implement [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataPlacemark.html placemarks] for cars &amp;quot;Bus&amp;quot; and &amp;quot;Car&amp;quot;&lt;br /&gt;
# Change their [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html coordinates] using trigonometry functions&lt;br /&gt;
# Apply new [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html coordinates] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We need to change coordinates with really small interval (~10 ms). In this way, to not block GUI thread we need to use multi-threading. For that we suggest that model:&lt;br /&gt;
&lt;br /&gt;
# Create [http://qt-project.org/doc/qt-5.0/qtcore/qthread.html QThread] #1&lt;br /&gt;
# Create CarWorker #1 (= worker for cars' coordinates)&lt;br /&gt;
# Move CarWorker #1 into thread #1&lt;br /&gt;
# The same for Car #2 (1-3)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then we will have three threads - GUI, Calculations #1, Calculations #2. To connect calc. threads with GUI we should use Qt S/S (Signal/Slot) connection.&lt;br /&gt;
&lt;br /&gt;
{{Warning|2=Important|1=Use here connection type Qt::BlockingQueuedConnection, another way GUI thread will be blocked}}&lt;br /&gt;
&lt;br /&gt;
Now we have a nice implementation plan. Let's start coding.&lt;br /&gt;
&lt;br /&gt;
# main() creates an object of the Window (our main QWidget-based window) &lt;br /&gt;
# Window creates the [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarbleWidget.html MarbleWidget] and sets two GeoDataPlacemarks there&lt;br /&gt;
# main() calls Window::startCars()&lt;br /&gt;
# Window creates two [http://qt-project.org/doc/qt-5.0/qtcore/qthread.html QThreads]&lt;br /&gt;
# Window creates two CarWorkers&lt;br /&gt;
# Window moves car workers into their threads&lt;br /&gt;
# Threads are started&lt;br /&gt;
&lt;br /&gt;
Then each CarWorker creates a [http://qt-project.org/doc/qt-5.0/qtcore/qtimer.html QTimer] with interval x. On timeout() it calls the CarWorker::iterate() - function to calculate new position of placemark and notify Window (another thread) about it.&lt;br /&gt;
&lt;br /&gt;
Everything is going on until the application finishes.&lt;br /&gt;
&lt;br /&gt;
'''The code with comments:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//&lt;br /&gt;
// This file is part of the Marble Virtual Globe.&lt;br /&gt;
//&lt;br /&gt;
// This program is free software licensed under the GNU LGPL. You can&lt;br /&gt;
// find a copy of this license in LICENSE.txt in the top directory of&lt;br /&gt;
// the source code.&lt;br /&gt;
//&lt;br /&gt;
// Copyright 2012 Illya Kovalevskyy &amp;lt;illya.kovalevskyy@gmail.com&amp;gt;&lt;br /&gt;
// Copyright 2012 Torsten Rahn      &amp;lt;tackat@kde.org&amp;gt;&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QThread&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QTimer&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QHash&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/qmath.h&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QVBoxLayout&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleGlobal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataDocument.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPlacemark.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLineString.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataTreeModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
// CarWorker Class&lt;br /&gt;
class CarWorker : public QObject&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    CarWorker(const GeoDataCoordinates&amp;amp; city, qreal radius, qreal speed);&lt;br /&gt;
&lt;br /&gt;
signals:&lt;br /&gt;
    /// This signal will be emitted when we need to&lt;br /&gt;
    /// move the placemark.&lt;br /&gt;
    void coordinatesChanged(GeoDataCoordinates coord);&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
    void startWork();&lt;br /&gt;
    void finishWork();&lt;br /&gt;
&lt;br /&gt;
private slots:&lt;br /&gt;
    void iterate();&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    QTimer *m_timer;&lt;br /&gt;
    GeoDataCoordinates m_city;&lt;br /&gt;
    qreal m_radius;&lt;br /&gt;
    qreal m_speed;&lt;br /&gt;
    qreal m_alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
CarWorker::CarWorker(const GeoDataCoordinates &amp;amp;city, qreal radius, qreal speed) :&lt;br /&gt;
    QObject(),&lt;br /&gt;
    m_timer(new QTimer(this)),&lt;br /&gt;
    m_city(city),&lt;br /&gt;
    m_radius(radius),&lt;br /&gt;
    m_speed(speed),&lt;br /&gt;
    m_alpha(0.0)&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
void CarWorker::startWork()&lt;br /&gt;
{&lt;br /&gt;
    m_timer-&amp;gt;setInterval(0);&lt;br /&gt;
    connect(m_timer, SIGNAL(timeout()), this, SLOT(iterate()));&lt;br /&gt;
    m_timer-&amp;gt;start();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/// Single timer loop iteration:&lt;br /&gt;
/// Calculates new coordinates for the car&lt;br /&gt;
void CarWorker::iterate()&lt;br /&gt;
{&lt;br /&gt;
    /// A bit of math&lt;br /&gt;
    qreal lon = m_city.longitude(GeoDataCoordinates::Degree) + m_radius * qCos(m_alpha * DEG2RAD);&lt;br /&gt;
    qreal lat = m_city.latitude(GeoDataCoordinates::Degree) + m_radius * qSin(m_alpha * DEG2RAD);&lt;br /&gt;
&lt;br /&gt;
    GeoDataCoordinates coord(lon, lat, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    emit coordinatesChanged(coord);&lt;br /&gt;
&lt;br /&gt;
    /// Iteration is finished. We need to increase angle&lt;br /&gt;
    m_alpha += m_speed;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void CarWorker::finishWork()&lt;br /&gt;
{&lt;br /&gt;
    m_timer-&amp;gt;stop();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Window Class&lt;br /&gt;
class Window : public QWidget&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    Window(QWidget *parent = 0);&lt;br /&gt;
    void startCars();&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
    void setCarCoordinates(const GeoDataCoordinates &amp;amp;coord);&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MarbleWidget *m_marbleWidget;&lt;br /&gt;
    CarWorker *m_firstWorker;&lt;br /&gt;
    CarWorker *m_secondWorker;&lt;br /&gt;
    GeoDataPlacemark *m_carFirst;&lt;br /&gt;
    GeoDataPlacemark *m_carSecond;&lt;br /&gt;
    QThread *m_threadFirst;&lt;br /&gt;
    QThread *m_threadSecond;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Window::Window(QWidget *parent) :&lt;br /&gt;
    QWidget(parent),&lt;br /&gt;
    m_marbleWidget(new MarbleWidget)&lt;br /&gt;
{&lt;br /&gt;
    QVBoxLayout *layout = new QVBoxLayout(this);&lt;br /&gt;
    layout-&amp;gt;addWidget(m_marbleWidget);&lt;br /&gt;
    setLayout(layout);&lt;br /&gt;
&lt;br /&gt;
    // Load the OpenStreetMap map&lt;br /&gt;
    m_marbleWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
    m_marbleWidget-&amp;gt;setProjection( Mercator );&lt;br /&gt;
    setGeometry(80, 60, 1000, 800);&lt;br /&gt;
    GeoDataCoordinates Kiev(30.523333, 50.45, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    m_marbleWidget-&amp;gt;centerOn(Kiev);&lt;br /&gt;
    m_marbleWidget-&amp;gt;setZoom(2300);&lt;br /&gt;
&lt;br /&gt;
    m_carFirst = new GeoDataPlacemark(&amp;quot;Bus&amp;quot;);&lt;br /&gt;
    m_carSecond = new GeoDataPlacemark(&amp;quot;Car&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    GeoDataDocument *document = new GeoDataDocument;&lt;br /&gt;
&lt;br /&gt;
    document-&amp;gt;append(m_carFirst);&lt;br /&gt;
    document-&amp;gt;append(m_carSecond);&lt;br /&gt;
&lt;br /&gt;
    m_marbleWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;addDocument(document);&lt;br /&gt;
&lt;br /&gt;
    show();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::startCars()&lt;br /&gt;
{&lt;br /&gt;
    GeoDataCoordinates Kiev(30.523333, 50.45, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
&lt;br /&gt;
    m_threadFirst = new QThread;&lt;br /&gt;
    m_firstWorker = new CarWorker(Kiev, (qreal)0.1, (qreal)0.7);&lt;br /&gt;
    m_firstWorker-&amp;gt;moveToThread(m_threadFirst);&lt;br /&gt;
&lt;br /&gt;
    connect(m_firstWorker, SIGNAL(coordinatesChanged(GeoDataCoordinates)),&lt;br /&gt;
            this, SLOT(setCarCoordinates(GeoDataCoordinates)), Qt::BlockingQueuedConnection);&lt;br /&gt;
&lt;br /&gt;
    m_threadSecond = new QThread;&lt;br /&gt;
    m_secondWorker = new CarWorker(Kiev, (qreal)0.2, (qreal)-0.5);&lt;br /&gt;
    m_secondWorker-&amp;gt;moveToThread(m_threadSecond);&lt;br /&gt;
&lt;br /&gt;
    connect(m_secondWorker, SIGNAL(coordinatesChanged(GeoDataCoordinates)),&lt;br /&gt;
            this, SLOT(setCarCoordinates(GeoDataCoordinates)), Qt::BlockingQueuedConnection);&lt;br /&gt;
&lt;br /&gt;
    connect(m_threadFirst, SIGNAL(started()), m_firstWorker, SLOT(startWork()));&lt;br /&gt;
    connect(m_threadFirst, SIGNAL(finished()), m_firstWorker, SLOT(finishWork()));&lt;br /&gt;
&lt;br /&gt;
    connect(m_threadSecond, SIGNAL(started()), m_secondWorker, SLOT(startWork()));&lt;br /&gt;
    connect(m_threadSecond, SIGNAL(finished()), m_secondWorker, SLOT(finishWork()));&lt;br /&gt;
&lt;br /&gt;
    m_threadFirst-&amp;gt;start();&lt;br /&gt;
    m_threadSecond-&amp;gt;start();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::setCarCoordinates(const GeoDataCoordinates &amp;amp;coord)&lt;br /&gt;
{&lt;br /&gt;
    CarWorker *worker = qobject_cast&amp;lt;CarWorker*&amp;gt;(sender());&lt;br /&gt;
    if (worker == m_firstWorker) {&lt;br /&gt;
        m_carFirst-&amp;gt;setCoordinate(coord);&lt;br /&gt;
        m_marbleWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;updateFeature(m_carFirst);&lt;br /&gt;
    } else if (worker == m_secondWorker) {&lt;br /&gt;
        m_carSecond-&amp;gt;setCoordinate(coord);&lt;br /&gt;
        m_marbleWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;updateFeature(m_carSecond);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
&lt;br /&gt;
    Window window;&lt;br /&gt;
    window.startCars();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;vehicletracking.moc&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before running qmake, create a [http://doc.trolltech.com/qmake-tutorial.html qmake project file]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
TEMPLATE = app&lt;br /&gt;
TARGET = vehicletracking&lt;br /&gt;
DEPENDPATH += .&lt;br /&gt;
INCLUDEPATH += .&lt;br /&gt;
SOURCES += vehicletracking.cpp&lt;br /&gt;
LIBS += -lmarblewidget &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Save this file as &amp;quot;vehicletracking.pro&amp;quot; in the same directory and run&lt;br /&gt;
&amp;lt;source lang = &amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
qmake&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
then execute &amp;lt;tt&amp;gt;./vehicletracking&amp;lt;/tt&amp;gt;. If everything goes fine, marble widget will appear as shown in the screenshot at the start of the tutorial.&lt;br /&gt;
&lt;br /&gt;
'''Find your way and explore the world! ;)'''&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/PaintingGeoDataLineString</id>
		<title>Projects/Marble/Runners/PaintingGeoDataLineString</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/PaintingGeoDataLineString"/>
				<updated>2013-01-13T17:18:40Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Painting GeoDataLineString: Using the GeoPainter in order to paint a GeoDataLineString object|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/LayerInterface|Tutorial 14 - Drawing in Custom Layers]]|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous tutorial proved how GeoPainter can be used in order to paint shapes and text at different coordinates of the map (through a GeoDataCoordinates parameter) in a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html MarbleWidget]. Now, we'll show a new way of adding extra content to the globe: by painting GeoDataLineString's using our GeoPainter. &lt;br /&gt;
&lt;br /&gt;
Briefly, [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLineString.html GeoDataLineString] is a tool class which implements LineStrings (also referred to as &amp;quot;polylines&amp;quot;), allowing us to store a contiguous set of line segments. As you will see in the example, it consists of several nodes (GeoDataCoordinates points), which are connected through line segments. &lt;br /&gt;
&lt;br /&gt;
GeoDataLineString allows LineStrings to be tessellated in order to make them follow the terrain and the curvature of the Earth. The tessellation options allow different ways of visualization: &lt;br /&gt;
&lt;br /&gt;
* Not tessellated, connects each two nodes directly&lt;br /&gt;
&lt;br /&gt;
* A tessellated line, each segment is bent such that the LineString follows the curvature of the Earth and its terrain. A tessellated line segment connects each two nodes at the shortest possible distance (&amp;quot;along great circles&amp;quot;). &lt;br /&gt;
&lt;br /&gt;
* A tessellated line which follows latitude circles whenever possible: in this case latitude circles are followed as soon as two subsequent nodes have exactly the same amount of latitude. In all other places the line segments follow great circles. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoPainter.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLineString.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
class MyMarbleWidget : public MarbleWidget &lt;br /&gt;
{&lt;br /&gt;
	public:&lt;br /&gt;
	virtual void customPaint(GeoPainter* painter);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void MyMarbleWidget::customPaint(GeoPainter* painter) {&lt;br /&gt;
&lt;br /&gt;
	GeoDataCoordinates France( 2.2, 48.52, 0.0, GeoDataCoordinates::Degree );&lt;br /&gt;
	painter-&amp;gt;setPen( QColor( 0, 0, 0 ) );&lt;br /&gt;
	painter-&amp;gt;drawText( France, &amp;quot;France&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	GeoDataCoordinates Canada( -77.02, 48.52, 0.0, GeoDataCoordinates::Degree );&lt;br /&gt;
	painter-&amp;gt;setPen( QColor( 0, 0, 0 ) );&lt;br /&gt;
	painter-&amp;gt;drawText( Canada, &amp;quot;Canada&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	//A line from France to Canada without tessellation&lt;br /&gt;
&lt;br /&gt;
	GeoDataLineString shapeNoTessellation( NoTessellation );&lt;br /&gt;
	shapeNoTessellation &amp;lt;&amp;lt; France &amp;lt;&amp;lt; Canada;&lt;br /&gt;
&lt;br /&gt;
	painter-&amp;gt;setPen( oxygenSkyBlue4 );&lt;br /&gt;
	painter-&amp;gt;drawPolyline( shapeNoTessellation );&lt;br /&gt;
&lt;br /&gt;
	//The same line, but with tessellation&lt;br /&gt;
	&lt;br /&gt;
	GeoDataLineString shapeTessellate( Tessellate );&lt;br /&gt;
	shapeTessellate &amp;lt;&amp;lt; France &amp;lt;&amp;lt; Canada;&lt;br /&gt;
&lt;br /&gt;
	painter-&amp;gt;setPen( oxygenBrickRed4 );&lt;br /&gt;
	painter-&amp;gt;drawPolyline( shapeTessellate );&lt;br /&gt;
&lt;br /&gt;
	//Now following the latitude circles&lt;br /&gt;
&lt;br /&gt;
	GeoDataLineString shapeLatitudeCircle( RespectLatitudeCircle | Tessellate );&lt;br /&gt;
	shapeLatitudeCircle &amp;lt;&amp;lt; France &amp;lt;&amp;lt; Canada;&lt;br /&gt;
&lt;br /&gt;
	painter-&amp;gt;setPen( oxygenForestGreen4 );&lt;br /&gt;
	painter-&amp;gt;drawPolyline( shapeLatitudeCircle );&lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
int main(int argc, char** argv) {&lt;br /&gt;
&lt;br /&gt;
	QApplication app(argc,argv);&lt;br /&gt;
		   &lt;br /&gt;
	// Create a Marble QWidget without a parent&lt;br /&gt;
	MarbleWidget *mapWidget = new MyMarbleWidget();&lt;br /&gt;
				    &lt;br /&gt;
	// Load the OpenStreetMap map&lt;br /&gt;
	mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/plain/plain.dgml&amp;quot;);&lt;br /&gt;
							 &lt;br /&gt;
	mapWidget-&amp;gt;show();&lt;br /&gt;
								  &lt;br /&gt;
	return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the code above as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and you end up with a globe view similar to this:&lt;br /&gt;
&lt;br /&gt;
[[Image:GeoDataLineStringTutorial.png]]&lt;br /&gt;
&lt;br /&gt;
As you can see, the blue line corresponds to the straight-no-tessellation way of visualization, the red one follows the great circles, and the green one sticks to the latitude circles, since the two endpoints have the same latitude.&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/LayerInterface</id>
		<title>Projects/Marble/LayerInterface</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/LayerInterface"/>
				<updated>2013-01-13T17:17:38Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Drawing in Custom Layers|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/MarbleGeoPainter|Tutorial 13 - Painting onto the map]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/PaintingGeoDataLineString|Tutorial 15 - Painting GeoDataLineString: Using the GeoPainter in order to paint a GeoDataLineString object]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The previous tutorial showed how to override the customPaint() method in MarbleWidget to paint on top of the map. It is also possible to paint at different layer positions. This is similar to providing a z-order of elements being painted.&lt;br /&gt;
&lt;br /&gt;
To achieve this, we'll take a look at an example. Instead of deriving from MarbleWidget, we create our own Marble::LayerInterface class. After passing it to Marble, it will be included in painting similar to how customPaint() was called. This time however we are able to specify at which layer to paint.&lt;br /&gt;
&lt;br /&gt;
To illustrate the painting in different layers, the code below paints a clock and implements the ability to dynamically switch its layer position by pressing '+'. Notice how the current layer position is indicated in the window title. When painting in the &amp;quot;STARS&amp;quot; layer, you won't see anything -- we'll paint behind the map. In the &amp;quot;SURFACE&amp;quot; layer, city names and other placemarks will be painted on top of us. In contrast, &amp;quot;ORBIT&amp;quot; will make us paint over placemarks, while float items (info boxes) still paint above us. This will change when we paint in the &amp;quot;USER TOOLS&amp;quot; layer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleMap.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoPainter.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/LayerInterface.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtCore/QTime&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QTimer&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QKeyEvent&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
class MyPaintLayer : public QObject, public LayerInterface&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    // Constructor&lt;br /&gt;
    MyPaintLayer(MarbleWidget* widget);&lt;br /&gt;
&lt;br /&gt;
    // Implemented from LayerInterface&lt;br /&gt;
    virtual QStringList renderPosition() const;&lt;br /&gt;
&lt;br /&gt;
    // Implemented from LayerInterface&lt;br /&gt;
    virtual bool render( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
       const QString&amp;amp; renderPos = &amp;quot;NONE&amp;quot;, GeoSceneLayer * layer = 0 );&lt;br /&gt;
&lt;br /&gt;
    // Overriding QObject&lt;br /&gt;
    virtual bool eventFilter(QObject *obj, QEvent *event);&lt;br /&gt;
&lt;br /&gt;
    GeoDataCoordinates approximate(const GeoDataCoordinates &amp;amp;base, qreal angle, qreal dist) const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MarbleWidget* m_widget;&lt;br /&gt;
&lt;br /&gt;
    int m_index;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
MyPaintLayer::MyPaintLayer(MarbleWidget* widget) : m_widget(widget), m_index(0)&lt;br /&gt;
{&lt;br /&gt;
    // nothing to do&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
QStringList MyPaintLayer::renderPosition() const&lt;br /&gt;
{&lt;br /&gt;
    // We will paint in exactly one of the following layers.&lt;br /&gt;
    // The current one can be changed by pressing the '+' key&lt;br /&gt;
    QStringList layers = QStringList() &amp;lt;&amp;lt; &amp;quot;SURFACE&amp;quot; &amp;lt;&amp;lt; &amp;quot;HOVERS_ABOVE_SURFACE&amp;quot;;&lt;br /&gt;
    layers &amp;lt;&amp;lt; &amp;quot;ORBIT&amp;quot; &amp;lt;&amp;lt; &amp;quot;USER_TOOLS&amp;quot; &amp;lt;&amp;lt; &amp;quot;STARS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    int index = m_index % layers.size();&lt;br /&gt;
    return QStringList() &amp;lt;&amp;lt; layers.at(index);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool MyPaintLayer::eventFilter(QObject *obj, QEvent *event)&lt;br /&gt;
{&lt;br /&gt;
    // Adjust the current layer when '+' is pressed&lt;br /&gt;
    if (event-&amp;gt;type() == QEvent::KeyPress)&lt;br /&gt;
    {&lt;br /&gt;
        QKeyEvent *keyEvent = static_cast&amp;lt;QKeyEvent *&amp;gt;(event);&lt;br /&gt;
        if (keyEvent-&amp;gt;key() == Qt::Key_Plus) {&lt;br /&gt;
            ++m_index;&lt;br /&gt;
            return true;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
GeoDataCoordinates MyPaintLayer::approximate(const GeoDataCoordinates &amp;amp;base, qreal angle, qreal dist) const&lt;br /&gt;
{&lt;br /&gt;
    // This is just a rough estimation that ignores projections.&lt;br /&gt;
    // It only works for short distances. Don't use in real code.&lt;br /&gt;
    GeoDataCoordinates::Unit deg = GeoDataCoordinates::Degree;&lt;br /&gt;
    return GeoDataCoordinates ( base.longitude(deg) + 1.5 * dist * sin(angle),&lt;br /&gt;
				base.latitude(deg) + dist * cos(angle), 0.0, deg);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool MyPaintLayer::render( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
    const QString&amp;amp; renderPos, GeoSceneLayer * layer )&lt;br /&gt;
{&lt;br /&gt;
    // Have window title reflect the current paint layer&lt;br /&gt;
    m_widget-&amp;gt;setWindowTitle(renderPosition().first());&lt;br /&gt;
    GeoDataCoordinates home(8.4, 48.0, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    QTime now = QTime::currentTime();&lt;br /&gt;
&lt;br /&gt;
    painter-&amp;gt;setRenderHint(QPainter::Antialiasing, true);&lt;br /&gt;
&lt;br /&gt;
    // Large circle built by 60 small circles&lt;br /&gt;
    painter-&amp;gt;setPen( QPen(QBrush(QColor::fromRgb(255,255,255,200)), 3.0, Qt::SolidLine, Qt::RoundCap ) );&lt;br /&gt;
    for (int i=0; i&amp;lt;60; ++i)&lt;br /&gt;
        painter-&amp;gt;drawEllipse(approximate(home, M_PI * i / 30.0, 1.0), 5, 5);&lt;br /&gt;
&lt;br /&gt;
    // hour, minute, second hand&lt;br /&gt;
    painter-&amp;gt;drawLine(home, approximate(home, M_PI * now.minute() / 30.0, 0.75));&lt;br /&gt;
    painter-&amp;gt;drawLine(home, approximate(home, M_PI * now.hour() / 6.0, 0.5));&lt;br /&gt;
    painter-&amp;gt;setPen(QPen(QBrush(Qt::red), 4.0, Qt::SolidLine, Qt::RoundCap ));&lt;br /&gt;
    painter-&amp;gt;drawLine(home, approximate(home, M_PI * now.second() / 30.0, 1.0));&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget;&lt;br /&gt;
&lt;br /&gt;
    // Create and register our paint layer&lt;br /&gt;
    MyPaintLayer* layer = new MyPaintLayer(mapWidget);&lt;br /&gt;
    // Uncomment for older versions of Marble:&lt;br /&gt;
    // mapWidget-&amp;gt;map()-&amp;gt;model()-&amp;gt;addLayer(layer);&lt;br /&gt;
    mapWidget-&amp;gt;addLayer(layer);&lt;br /&gt;
&lt;br /&gt;
    // Install an event handler: Pressing + will change the layer we paint at&lt;br /&gt;
    mapWidget-&amp;gt;installEventFilter(layer);&lt;br /&gt;
&lt;br /&gt;
    // Finish widget creation.&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/bluemarble/bluemarble.dgml&amp;quot;);&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
&lt;br /&gt;
    // Update each second to give the clock second resolution&lt;br /&gt;
    QTimer seconds;&lt;br /&gt;
    seconds.setInterval(1000);&lt;br /&gt;
    QObject::connect(&amp;amp;seconds, SIGNAL(timeout()), mapWidget, SLOT(update()));&lt;br /&gt;
    seconds.start();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the code above as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and you end up with a globe view painting a little different interpretation of a world clock:&lt;br /&gt;
&lt;br /&gt;
[[Image:Marble-paintlayer.png]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/LayerInterface</id>
		<title>Projects/Marble/LayerInterface</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/LayerInterface"/>
				<updated>2013-01-13T17:15:19Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Drawing in Custom Layers|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/MarbleGeoPainter|Tutorial 13 - Painting onto the map]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/PaintingGeoDataLineString|Tutorial 14 - Painting GeoDataLineString: Using the GeoPainter in order to paint a GeoDataLineString object]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The previous tutorial showed how to override the customPaint() method in MarbleWidget to paint on top of the map. It is also possible to paint at different layer positions. This is similar to providing a z-order of elements being painted.&lt;br /&gt;
&lt;br /&gt;
To achieve this, we'll take a look at an example. Instead of deriving from MarbleWidget, we create our own Marble::LayerInterface class. After passing it to Marble, it will be included in painting similar to how customPaint() was called. This time however we are able to specify at which layer to paint.&lt;br /&gt;
&lt;br /&gt;
To illustrate the painting in different layers, the code below paints a clock and implements the ability to dynamically switch its layer position by pressing '+'. Notice how the current layer position is indicated in the window title. When painting in the &amp;quot;STARS&amp;quot; layer, you won't see anything -- we'll paint behind the map. In the &amp;quot;SURFACE&amp;quot; layer, city names and other placemarks will be painted on top of us. In contrast, &amp;quot;ORBIT&amp;quot; will make us paint over placemarks, while float items (info boxes) still paint above us. This will change when we paint in the &amp;quot;USER TOOLS&amp;quot; layer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleMap.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoPainter.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/LayerInterface.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtCore/QTime&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QTimer&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QKeyEvent&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
class MyPaintLayer : public QObject, public LayerInterface&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    // Constructor&lt;br /&gt;
    MyPaintLayer(MarbleWidget* widget);&lt;br /&gt;
&lt;br /&gt;
    // Implemented from LayerInterface&lt;br /&gt;
    virtual QStringList renderPosition() const;&lt;br /&gt;
&lt;br /&gt;
    // Implemented from LayerInterface&lt;br /&gt;
    virtual bool render( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
       const QString&amp;amp; renderPos = &amp;quot;NONE&amp;quot;, GeoSceneLayer * layer = 0 );&lt;br /&gt;
&lt;br /&gt;
    // Overriding QObject&lt;br /&gt;
    virtual bool eventFilter(QObject *obj, QEvent *event);&lt;br /&gt;
&lt;br /&gt;
    GeoDataCoordinates approximate(const GeoDataCoordinates &amp;amp;base, qreal angle, qreal dist) const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MarbleWidget* m_widget;&lt;br /&gt;
&lt;br /&gt;
    int m_index;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
MyPaintLayer::MyPaintLayer(MarbleWidget* widget) : m_widget(widget), m_index(0)&lt;br /&gt;
{&lt;br /&gt;
    // nothing to do&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
QStringList MyPaintLayer::renderPosition() const&lt;br /&gt;
{&lt;br /&gt;
    // We will paint in exactly one of the following layers.&lt;br /&gt;
    // The current one can be changed by pressing the '+' key&lt;br /&gt;
    QStringList layers = QStringList() &amp;lt;&amp;lt; &amp;quot;SURFACE&amp;quot; &amp;lt;&amp;lt; &amp;quot;HOVERS_ABOVE_SURFACE&amp;quot;;&lt;br /&gt;
    layers &amp;lt;&amp;lt; &amp;quot;ORBIT&amp;quot; &amp;lt;&amp;lt; &amp;quot;USER_TOOLS&amp;quot; &amp;lt;&amp;lt; &amp;quot;STARS&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    int index = m_index % layers.size();&lt;br /&gt;
    return QStringList() &amp;lt;&amp;lt; layers.at(index);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool MyPaintLayer::eventFilter(QObject *obj, QEvent *event)&lt;br /&gt;
{&lt;br /&gt;
    // Adjust the current layer when '+' is pressed&lt;br /&gt;
    if (event-&amp;gt;type() == QEvent::KeyPress)&lt;br /&gt;
    {&lt;br /&gt;
        QKeyEvent *keyEvent = static_cast&amp;lt;QKeyEvent *&amp;gt;(event);&lt;br /&gt;
        if (keyEvent-&amp;gt;key() == Qt::Key_Plus) {&lt;br /&gt;
            ++m_index;&lt;br /&gt;
            return true;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
GeoDataCoordinates MyPaintLayer::approximate(const GeoDataCoordinates &amp;amp;base, qreal angle, qreal dist) const&lt;br /&gt;
{&lt;br /&gt;
    // This is just a rough estimation that ignores projections.&lt;br /&gt;
    // It only works for short distances. Don't use in real code.&lt;br /&gt;
    GeoDataCoordinates::Unit deg = GeoDataCoordinates::Degree;&lt;br /&gt;
    return GeoDataCoordinates ( base.longitude(deg) + 1.5 * dist * sin(angle),&lt;br /&gt;
				base.latitude(deg) + dist * cos(angle), 0.0, deg);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool MyPaintLayer::render( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
    const QString&amp;amp; renderPos, GeoSceneLayer * layer )&lt;br /&gt;
{&lt;br /&gt;
    // Have window title reflect the current paint layer&lt;br /&gt;
    m_widget-&amp;gt;setWindowTitle(renderPosition().first());&lt;br /&gt;
    GeoDataCoordinates home(8.4, 48.0, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    QTime now = QTime::currentTime();&lt;br /&gt;
&lt;br /&gt;
    painter-&amp;gt;setRenderHint(QPainter::Antialiasing, true);&lt;br /&gt;
&lt;br /&gt;
    // Large circle built by 60 small circles&lt;br /&gt;
    painter-&amp;gt;setPen( QPen(QBrush(QColor::fromRgb(255,255,255,200)), 3.0, Qt::SolidLine, Qt::RoundCap ) );&lt;br /&gt;
    for (int i=0; i&amp;lt;60; ++i)&lt;br /&gt;
        painter-&amp;gt;drawEllipse(approximate(home, M_PI * i / 30.0, 1.0), 5, 5);&lt;br /&gt;
&lt;br /&gt;
    // hour, minute, second hand&lt;br /&gt;
    painter-&amp;gt;drawLine(home, approximate(home, M_PI * now.minute() / 30.0, 0.75));&lt;br /&gt;
    painter-&amp;gt;drawLine(home, approximate(home, M_PI * now.hour() / 6.0, 0.5));&lt;br /&gt;
    painter-&amp;gt;setPen(QPen(QBrush(Qt::red), 4.0, Qt::SolidLine, Qt::RoundCap ));&lt;br /&gt;
    painter-&amp;gt;drawLine(home, approximate(home, M_PI * now.second() / 30.0, 1.0));&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget;&lt;br /&gt;
&lt;br /&gt;
    // Create and register our paint layer&lt;br /&gt;
    MyPaintLayer* layer = new MyPaintLayer(mapWidget);&lt;br /&gt;
    // Uncomment for older versions of Marble:&lt;br /&gt;
    // mapWidget-&amp;gt;map()-&amp;gt;model()-&amp;gt;addLayer(layer);&lt;br /&gt;
    mapWidget-&amp;gt;addLayer(layer);&lt;br /&gt;
&lt;br /&gt;
    // Install an event handler: Pressing + will change the layer we paint at&lt;br /&gt;
    mapWidget-&amp;gt;installEventFilter(layer);&lt;br /&gt;
&lt;br /&gt;
    // Finish widget creation.&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/bluemarble/bluemarble.dgml&amp;quot;);&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
&lt;br /&gt;
    // Update each second to give the clock second resolution&lt;br /&gt;
    QTimer seconds;&lt;br /&gt;
    seconds.setInterval(1000);&lt;br /&gt;
    QObject::connect(&amp;amp;seconds, SIGNAL(timeout()), mapWidget, SLOT(update()));&lt;br /&gt;
    seconds.start();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the code above as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and you end up with a globe view painting a little different interpretation of a world clock:&lt;br /&gt;
&lt;br /&gt;
[[Image:Marble-paintlayer.png]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/MarbleGeoPainter</id>
		<title>Projects/Marble/MarbleGeoPainter</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/MarbleGeoPainter"/>
				<updated>2013-01-13T17:13:41Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=GeoPainter: Painting onto the map|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/Parse|Tutorial 12 - Opening .kml, .gpx... files]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/LayerInterface|Tutorial 14 - Drawing in Custom Layers]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In the previous tutorial you've seen how easy it is to embed a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html MarbleWidget] into a Qt application: Just create a MarbleWidget, set a map theme on it and ... you're done already.&lt;br /&gt;
&lt;br /&gt;
Next we'll extend that example a bit and write our own little paint method to add some extra content to the globe. To facilitate this, Marble provides a painting hook called [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#47e87a8639f38e9da380923453a6f35f MarbleWidget::customPaint]. It is called in between of the normal paint operations: After the background and tiles are painted, but before the top layers like float items (info boxes).&lt;br /&gt;
&lt;br /&gt;
The customPaint operation is called with a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoPainter.html GeoPainter]: An extended [http://doc.trolltech.com/qpainter.html QPainter] which not only is able to paint at certain screen (pixel) positions, but also at certain geo (lat,lon) positions. We'll make use of that feature now. To keep things simple again, we just add a little 'Hello World' message indicated by a green circle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoPainter.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
class MyMarbleWidget : public MarbleWidget&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    virtual void customPaint(GeoPainter* painter);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void MyMarbleWidget::customPaint(GeoPainter* painter)&lt;br /&gt;
{&lt;br /&gt;
    GeoDataCoordinates home(8.4, 49.0, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    painter-&amp;gt;setPen(Qt::green);&lt;br /&gt;
    painter-&amp;gt;drawEllipse(home, 7, 7);&lt;br /&gt;
    painter-&amp;gt;setPen(Qt::black);&lt;br /&gt;
    painter-&amp;gt;drawText(home, &amp;quot;Hello Marble!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    MyMarbleWidget *mapWidget = new MyMarbleWidget;&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the code above as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and you end up with a globe view similar to this:&lt;br /&gt;
&lt;br /&gt;
[[Image:Marble-geopainter.png]]&lt;br /&gt;
&lt;br /&gt;
There may be situations where MarbleWidget::customPaint() does not suit your needs. This can be the case when you don't want to paint at the very top position (above all other items), or when subclassing MarbleWidget is not possible for some reason. In that case, have a look at the next chapter [[Projects/Marble/LayerInterface|Drawing in Custom Layers]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/Parse</id>
		<title>Projects/Marble/Runners/Parse</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/Parse"/>
				<updated>2013-01-13T17:01:28Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/ReverseGeocoding|Tutorial 11 - Reverse Geocoding]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/MarbleGeoPainter|Tutorial 13 - Painting onto the map]]|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== KML Inspector ==&lt;br /&gt;
As we have seen in the previous tutorial, Marble employs runners to when dealing with .kml (or .gpx, .osm, etc) files. This tutorial shows how to use the &amp;lt;tt&amp;gt;MarbleRunnerManager&amp;lt;/tt&amp;gt; class to open a .kml (or .gpx, ...) file and display its structure in a tree view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QTreeView&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleRunnerManager.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataTreeModel.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
&lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.kml&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    MarbleModel *model = new MarbleModel;&lt;br /&gt;
    MarbleRunnerManager* manager = new MarbleRunnerManager( model-&amp;gt;pluginManager() );&lt;br /&gt;
&lt;br /&gt;
    GeoDataDocument* document = manager-&amp;gt;openFile( inputFile.absoluteFilePath() );&lt;br /&gt;
    if ( document ) {&lt;br /&gt;
        GeoDataTreeModel* treeModel = new GeoDataTreeModel;&lt;br /&gt;
        treeModel-&amp;gt;addDocument( document );&lt;br /&gt;
        QTreeView* treeView = new QTreeView;&lt;br /&gt;
        treeView-&amp;gt;setModel( treeModel );&lt;br /&gt;
        treeView-&amp;gt;show();&lt;br /&gt;
    } else {&lt;br /&gt;
        qDebug() &amp;lt;&amp;lt; &amp;quot;Unable to open &amp;quot; &amp;lt;&amp;lt; inputFile.absoluteFilePath();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.kml&amp;lt;/tt&amp;gt; and you get a tree view of its structure similar to this screenshot (showing the structure of a route calculated with Marble):&lt;br /&gt;
&lt;br /&gt;
[[Image:Marble-kml-inspector.png]]&lt;br /&gt;
&lt;br /&gt;
{{tip|&lt;br /&gt;
Here's a little checklist to tackle some problems that might arise when compiling the code above:&lt;br /&gt;
&lt;br /&gt;
* You need Qt and '''Marble development packages''' (or comparable git installations), version 1.3 (Marble library 0.13), shipped post KDE 4.8&lt;br /&gt;
* If ''Qt headers'' are not installed in '''/usr/include/qt4''' on your system, change the path in the g++ call above accordingly.&lt;br /&gt;
* Likewise, '''add -I /path/to/marble/headers''' if they're not to be found in /usr/include&lt;br /&gt;
}}&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/ReverseGeocoding</id>
		<title>Projects/Marble/Runners/ReverseGeocoding</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/ReverseGeocoding"/>
				<updated>2013-01-13T16:58:19Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Basic Routing|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/Search|Tutorial 10 - Searching]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/Parse|Tutorial 12 - Opening .kml, .gpx... files]]|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Reverse geocoding ==&lt;br /&gt;
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 &amp;lt;tt&amp;gt;MarbleRunnerManager&amp;lt;/tt&amp;gt; class to get a textual description of a given coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleRunnerManager.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPlacemark.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    MarbleModel *model = new MarbleModel;&lt;br /&gt;
&lt;br /&gt;
    MarbleRunnerManager* manager = new MarbleRunnerManager( model-&amp;gt;pluginManager() );&lt;br /&gt;
    manager-&amp;gt;setModel( model );&lt;br /&gt;
&lt;br /&gt;
    GeoDataCoordinates position( -0.15845,  51.52380, 0.0, GeoDataCoordinates::Degree );&lt;br /&gt;
    qDebug() &amp;lt;&amp;lt; position.toString() &amp;lt;&amp;lt; &amp;quot;is&amp;quot; &amp;lt;&amp;lt; manager-&amp;gt;searchReverseGeocoding( position );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and the output looks similar to this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
&amp;quot;  0° 09' 30.4&amp;quot;W,  51° 31' 25.7&amp;quot;N&amp;quot; is &amp;quot;Sherlock Holmes Museum, &amp;quot;221b&amp;quot;, Baker Street, Marylebone, City of Westminster, Greater London, England, NW1 6AX, United Kingdom&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{tip|&lt;br /&gt;
Here's a little checklist to tackle some problems that might arise when compiling the code above:&lt;br /&gt;
&lt;br /&gt;
* You need Qt and '''Marble development packages''' (or comparable git installations), version 1.3 (Marble library 0.13), shipped post KDE 4.8&lt;br /&gt;
* If ''Qt headers'' are not installed in '''/usr/include/qt4''' on your system, change the path in the g++ call above accordingly.&lt;br /&gt;
* Likewise, '''add -I /path/to/marble/headers''' if they're not to be found in /usr/include&lt;br /&gt;
}}&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/Search</id>
		<title>Projects/Marble/Runners/Search</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/Search"/>
				<updated>2013-01-13T16:55:48Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Routing/BasicRouting|Tutorial 9 - Basic Routing]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/ReverseGeocoding|Tutorial 11 - Reverse Geocoding]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Searching for cities, addresses, points of interest ==&lt;br /&gt;
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 &amp;lt;tt&amp;gt;MarbleRunnerManager&amp;lt;/tt&amp;gt; class to search for an arbitrary string (&amp;lt;i&amp;gt;Karlsruhe&amp;lt;/i&amp;gt; in the example below, see [http://userbase.kde.org/Marble/Search Userbase] for more information on search terms).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleRunnerManager.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPlacemark.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    MarbleModel *model = new MarbleModel;&lt;br /&gt;
    &lt;br /&gt;
    MarbleRunnerManager* manager = new MarbleRunnerManager( model-&amp;gt;pluginManager() );&lt;br /&gt;
    manager-&amp;gt;setModel( model );&lt;br /&gt;
    &lt;br /&gt;
    QVector&amp;lt;GeoDataPlacemark*&amp;gt; searchResult = manager-&amp;gt;searchPlacemarks( &amp;quot;Karlsruhe&amp;quot; );&lt;br /&gt;
    foreach( GeoDataPlacemark* placemark, searchResult ) {&lt;br /&gt;
        qDebug() &amp;lt;&amp;lt; &amp;quot;Found &amp;quot; &amp;lt;&amp;lt; placemark-&amp;gt;name() &amp;lt;&amp;lt; &amp;quot;at&amp;quot; &amp;lt;&amp;lt; placemark-&amp;gt;coordinate().toString();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and the output looks similar to this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
Found  &amp;quot;Karlsruhe, Germany&amp;quot; at &amp;quot;  8° 33' 48.7&amp;quot;E,  49° 05' 38.4&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe, McLean&amp;quot; at &amp;quot;100° 36' 58.4&amp;quot;W,  48° 05' 27.7&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe, Karlsruhe, Stadt&amp;quot; at &amp;quot;  8° 24' 16.0&amp;quot;E,  49° 00' 50.6&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe, Remscheid&amp;quot; at &amp;quot;  7° 17' 35.3&amp;quot;E,  51° 09' 09.4&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe, Austria&amp;quot; at &amp;quot; 15° 19' 53.6&amp;quot;E,  47° 21' 33.4&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe, McLean&amp;quot; at &amp;quot;100° 37' 13.5&amp;quot;W,  48° 05' 24.0&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe, Sohland a.d. Spree&amp;quot; at &amp;quot; 14° 27' 36.5&amp;quot;E,  51° 02' 28.5&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Parkstraße, Bad Elster&amp;quot; at &amp;quot; 12° 14' 08.0&amp;quot;E,  50° 16' 57.9&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe (Bruchsal)&amp;quot; at &amp;quot;  8° 33' 48.7&amp;quot;E,  49° 05' 38.4&amp;quot;N&amp;quot; &lt;br /&gt;
Found  &amp;quot;Karlsruhe (Innenstadt-West)&amp;quot; at &amp;quot;  8° 24' 16.0&amp;quot;E,  49° 00' 50.6&amp;quot;N&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{tip|&lt;br /&gt;
Here's a little checklist to tackle some problems that might arise when compiling the code above:&lt;br /&gt;
&lt;br /&gt;
* You need Qt and '''Marble development packages''' (or comparable git installations), version 1.3 (Marble library 0.13), shipped post KDE 4.8&lt;br /&gt;
* If ''Qt headers'' are not installed in '''/usr/include/qt4''' on your system, change the path in the g++ call above accordingly.&lt;br /&gt;
* Likewise, '''add -I /path/to/marble/headers''' if they're not to be found in /usr/include&lt;br /&gt;
}}&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Routing/BasicRouting</id>
		<title>Projects/Marble/Routing/BasicRouting</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Routing/BasicRouting"/>
				<updated>2013-01-13T16:48:13Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Basic Routing|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/OnlineServices|Tutorial 8 - OnlineServices]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/Search|Tutorial 10 - Searching]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Basic Routing ==&lt;br /&gt;
The Marble library 0.13 and later (KDE 4.8, Marble 1.3) has an API to calculate and manage routes. Let's start with a brief overview of the important classes and their interaction. The class &amp;lt;tt&amp;gt;RouteRequest&amp;lt;/tt&amp;gt; holds parameters that are constraints for the route to be calculated: Start and destination, optional via points and further parameters (e.g. transport type). The &amp;lt;tt&amp;gt;RoutingManager&amp;lt;/tt&amp;gt; passes such a request to backends (routing plugins) that calculate possible routes from it. The best route is chosen and displayed in a special layer in the &amp;lt;tt&amp;gt;MarbleWidget&amp;lt;/tt&amp;gt;. Additionally you can access the route data via the &amp;lt;tt&amp;gt;RoutingModel&amp;lt;/tt&amp;gt;. This model can be passed directly to e.g. a QListView to show the turn instructions, but also exposes further data like the waypoints of the route via the &amp;lt;tt&amp;gt;Route&amp;lt;/tt&amp;gt; class. This one consists of a set of &amp;lt;tt&amp;gt;RouteSegment&amp;lt;/tt&amp;gt; instances, each representing a number of waypoints and an optional turn instruction (&amp;lt;tt&amp;gt;Maneuver&amp;lt;/tt&amp;gt;) at the end.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/RouteRequest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/RoutingManager.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
&lt;br /&gt;
    // Create a Marble QWidget without a parent&lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
&lt;br /&gt;
    // Load the OpenStreetMap map&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId( &amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot; );&lt;br /&gt;
    mapWidget-&amp;gt;setProjection( Mercator );&lt;br /&gt;
&lt;br /&gt;
    // Access the shared route request (start, destination and parameters)&lt;br /&gt;
    RoutingManager* manager = mapWidget-&amp;gt;model()-&amp;gt;routingManager();&lt;br /&gt;
    RouteRequest* request = manager-&amp;gt;routeRequest();&lt;br /&gt;
&lt;br /&gt;
    // Use default routing settings for cars&lt;br /&gt;
    request-&amp;gt;setRoutingProfile( manager-&amp;gt;defaultProfile( RoutingProfile::Motorcar ) );&lt;br /&gt;
&lt;br /&gt;
    // Set start and destination&lt;br /&gt;
    request-&amp;gt;append( GeoDataCoordinates( 8.38942, 48.99738, 0.0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    request-&amp;gt;append( GeoDataCoordinates( 8.42002, 49.0058, 0.0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
&lt;br /&gt;
    // Calculate the route&lt;br /&gt;
    manager-&amp;gt;retrieveRoute();&lt;br /&gt;
&lt;br /&gt;
    // Center the map on the route start point and show it&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( request-&amp;gt;at( 0 ) );&lt;br /&gt;
    mapWidget-&amp;gt;setDistance( 0.75 );&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and you end up with a fully usable OpenStreetMap application: &lt;br /&gt;
&lt;br /&gt;
[[Image:Marble-basic-routing.png]]&lt;br /&gt;
&lt;br /&gt;
{{tip|&lt;br /&gt;
Here's a little checklist to tackle some problems that might arise when compiling the code above:&lt;br /&gt;
&lt;br /&gt;
* You need Qt and '''Marble development packages''' (or comparable git installations), version 1.3 (Marble library 0.13), shipped e.g. with KDE 4.8&lt;br /&gt;
* If ''Qt headers'' are not installed in '''/usr/include/qt4''' on your system, change the path in the g++ call above accordingly.&lt;br /&gt;
* Likewise, '''add -I /path/to/marble/headers''' if they're not to be found in /usr/include&lt;br /&gt;
}}&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/OnlineServices</id>
		<title>Projects/Marble/OnlineServices</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/OnlineServices"/>
				<updated>2013-01-13T16:45:29Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Creating your first Marble Online Services Plugin|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/VehicleTracking|Tutorial 7 -Vehicle Tracking]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Routing/BasicRouting|Tutorial 9 - Basic Routing]]|&lt;br /&gt;
&lt;br /&gt;
reading=[[Development/Tutorials/CMake|CMake]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
You will here learn to create your own online service plugins. If you don't know what is meant by online service, you will see these in the Marble menu at &amp;quot;View&amp;quot;-&amp;gt;&amp;quot;Online Services&amp;quot;.&lt;br /&gt;
You'll need KDE 4.3 to build this tutorial.&lt;br /&gt;
If you want to write plugins for Marble, it could be useful to do this in KDE's subversion. Please contact the Marble developers for this (IRC, E-Mail).&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
An online services plugin or data plugin consist of three classes at least. The class to display the information is the Data Item (the base class is AbstractDataPluginItem). It stores the information for single places on the map and displays them.&lt;br /&gt;
&lt;br /&gt;
The Model (base class AbstractDataPluginModel) stores all items. Storing the items will be done by AbstractDataPluginModel itself. Your only job is to get information for new items when the displayed part of the earth changes. This can include downloading so called &amp;quot;Description files&amp;quot; from the servers of an online service and parsing them. These &amp;quot;Description files&amp;quot; contain lists of items in a specific part of the earth (specified by a LatLonAltBox).&lt;br /&gt;
&lt;br /&gt;
The class based on AbstractDataPlugin is the representation class of our plugin. It provides the name and the idea of the plugin. You also have to set your model there.&lt;br /&gt;
&lt;br /&gt;
== Item ==&lt;br /&gt;
We will write our item first as it depends on nothing else. As you should already know the item stores the data and paints it on the screen. One item has an exact position on the globe as longitude, latitude and altitude.&lt;br /&gt;
The item we will write shows a text at the specific position.&lt;br /&gt;
&lt;br /&gt;
We will now look at the header file to see what functions we have to implement.&lt;br /&gt;
'''TutorialItem.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALITEM_H&lt;br /&gt;
#define TUTORIALITEM_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPluginItem.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
class QFont;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
class TutorialItem : public AbstractDataPluginItem&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialItem( QObject *parent );&lt;br /&gt;
 &lt;br /&gt;
    ~TutorialItem();&lt;br /&gt;
 &lt;br /&gt;
    // Returns the item type of the item.&lt;br /&gt;
    QString itemType() const;&lt;br /&gt;
 &lt;br /&gt;
    // Returns true if the item is paintable&lt;br /&gt;
    bool initialized();&lt;br /&gt;
 &lt;br /&gt;
    // Here the item gets painted&lt;br /&gt;
    void paint( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
                const QString&amp;amp; renderPos, GeoSceneLayer * layer = 0 );&lt;br /&gt;
 &lt;br /&gt;
    bool operator&amp;lt;( const AbstractDataPluginItem *other ) const;&lt;br /&gt;
 &lt;br /&gt;
    // The text we want to show on the map&lt;br /&gt;
    QString text() const;&lt;br /&gt;
    void setText( const QString&amp;amp; text );&lt;br /&gt;
 &lt;br /&gt;
 private:&lt;br /&gt;
    QString m_text;&lt;br /&gt;
 &lt;br /&gt;
    static QFont s_font;&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
#endif // TUTORIALITEM_H&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you have probably seen, it will be very easy to implement this as we have only one function (paint()) besides some getters and setters.&lt;br /&gt;
&lt;br /&gt;
Let's have a look at the implementation.&lt;br /&gt;
'''TutorialItem.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialItem.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Marble&lt;br /&gt;
#include &amp;quot;GeoPainter.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ViewportParams.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QFontMetrics&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
// That's the font we will use to paint.&lt;br /&gt;
QFont TutorialItem::s_font = QFont( &amp;quot;Sans Serif&amp;quot;, 8 );&lt;br /&gt;
 &lt;br /&gt;
TutorialItem::TutorialItem( QObject *parent )&lt;br /&gt;
    : AbstractDataPluginItem( parent )&lt;br /&gt;
{&lt;br /&gt;
    // The size of an item without a text is 0&lt;br /&gt;
    setSize( QSize( 0, 0 ) );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
TutorialItem::~TutorialItem()&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialItem::itemType() const&lt;br /&gt;
{&lt;br /&gt;
    // Our itemType:&lt;br /&gt;
    return &amp;quot;tutorialItem&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
bool TutorialItem::initialized()&lt;br /&gt;
{&lt;br /&gt;
    // The item is initialized if it has a text&lt;br /&gt;
    if ( m_text.isEmpty() ) &lt;br /&gt;
        return false;&lt;br /&gt;
    else&lt;br /&gt;
        return true;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
bool TutorialItem::operator&amp;lt;( const AbstractDataPluginItem *other ) const&lt;br /&gt;
{&lt;br /&gt;
    // That's not a very nice priority estimation, you'll hopefully find&lt;br /&gt;
    // a better one for your plugin.&lt;br /&gt;
    return this-&amp;gt;id() &amp;lt; other-&amp;gt;id();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialItem::text() const&lt;br /&gt;
{&lt;br /&gt;
    return m_text;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialItem::setText( const QString&amp;amp; text )&lt;br /&gt;
{&lt;br /&gt;
    // On a text change our size may also change, so we have to set the new&lt;br /&gt;
    // item size. Marble needs to know how large an item is to find the correct&lt;br /&gt;
    // bounding rect. The given position will always be in the middle of the &lt;br /&gt;
    // item for now.&lt;br /&gt;
    QFontMetrics metrics( s_font );&lt;br /&gt;
    setSize( metrics.size( 0, text ) );&lt;br /&gt;
    m_text = text;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialItem::paint( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
                          const QString&amp;amp; renderPos, GeoSceneLayer * layer )&lt;br /&gt;
{&lt;br /&gt;
    Q_UNUSED( renderPos )&lt;br /&gt;
    Q_UNUSED( layer )&lt;br /&gt;
 &lt;br /&gt;
    // Save the old painter state.&lt;br /&gt;
    painter-&amp;gt;save();&lt;br /&gt;
    // We want to paint a black string.&lt;br /&gt;
    painter-&amp;gt;setPen( QPen( QColor( Qt::black ) ) );&lt;br /&gt;
    // We will use our standard font.&lt;br /&gt;
    painter-&amp;gt;setFont( s_font );&lt;br /&gt;
    // Draw the text into the given rect.&lt;br /&gt;
    painter-&amp;gt;drawText( QRect( QPoint( 0, 0 ), size().toSize() ), 0, m_text );&lt;br /&gt;
    // Restore the old painter state.&lt;br /&gt;
    painter-&amp;gt;restore();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
// This is needed for all QObjects (see MOC)&lt;br /&gt;
#include &amp;quot;TutorialItem.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wasn't that easy? Continue with the next section.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
We will continue developing the core component, the model. Let's first look at the header file:&lt;br /&gt;
'''TutorialModel.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALMODEL_H&lt;br /&gt;
#define TUTORIALMODEL_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPluginModel.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble {&lt;br /&gt;
 &lt;br /&gt;
class MarbleDataFacade;&lt;br /&gt;
 &lt;br /&gt;
// The maximum number of items we want to show on the screen.&lt;br /&gt;
const quint32 numberOfItemsOnScreen = 20;&lt;br /&gt;
 &lt;br /&gt;
class TutorialModel : public AbstractDataPluginModel&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialModel( PluginManager *pluginManager,&lt;br /&gt;
                   QObject *parent = 0 );&lt;br /&gt;
    ~TutorialModel();&lt;br /&gt;
 &lt;br /&gt;
 protected:&lt;br /&gt;
    /**&lt;br /&gt;
     * Generates the download url for the description file from the web service depending on&lt;br /&gt;
     * the @p box surrounding the view and the @p number of files to show.&lt;br /&gt;
     **/&lt;br /&gt;
    void getAdditionalItems( const GeoDataLatLonAltBox&amp;amp; box,&lt;br /&gt;
                             MarbleDataFacade *facade,&lt;br /&gt;
                             qint32 number = 10 );&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
#endif // TUTORIALMODEL_H&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You see that we have to implement the function getAdditionalItems(). getAdditionalItems() is called when the viewport has been changed significantly, so new items have to be generated.&lt;br /&gt;
For getAdditionalItems() we will go the easy way for now. We will simply add one item with a static position. That's a very simple method to test your painting code.&lt;br /&gt;
&lt;br /&gt;
'''TutorialModel.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialModel.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Plugin&lt;br /&gt;
#include &amp;quot;TutorialItem.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Marble&lt;br /&gt;
#include &amp;quot;global.h&amp;quot;&lt;br /&gt;
#include &amp;quot;MarbleDataFacade.h&amp;quot;&lt;br /&gt;
#include &amp;quot;GeoDataCoordinates.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QString&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TutorialModel::TutorialModel( PluginManager *pluginManager,&lt;br /&gt;
                              QObject *parent  )&lt;br /&gt;
    : AbstractDataPluginModel( &amp;quot;tutorial&amp;quot;, pluginManager, parent )&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TutorialModel::~TutorialModel() {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void TutorialModel::getAdditionalItems( const GeoDataLatLonAltBox&amp;amp; box,&lt;br /&gt;
                                         MarbleDataFacade *facade,&lt;br /&gt;
                                         qint32 number )&lt;br /&gt;
{&lt;br /&gt;
    // This plugin only supports Tutorial items for earth&lt;br /&gt;
    if( facade-&amp;gt;target() != &amp;quot;earth&amp;quot; ) {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    // We will only create one item in our first tutorial.&lt;br /&gt;
    // Every item has to get an id. We have to check if the item already exists.&lt;br /&gt;
    if ( !itemExists( &amp;quot;tutorial1&amp;quot; ) ) {&lt;br /&gt;
        // If it does not exists, create it&lt;br /&gt;
        GeoDataCoordinates coor( 10.22 * DEG2RAD, 54.4 * DEG2RAD );&lt;br /&gt;
        // The parent of the new item is this object&lt;br /&gt;
        TutorialItem *item = new TutorialItem( this );&lt;br /&gt;
        item-&amp;gt;setCoordinate( coor );&lt;br /&gt;
        item-&amp;gt;setTarget( &amp;quot;earth&amp;quot; );&lt;br /&gt;
        item-&amp;gt;setId( &amp;quot;tutorial1&amp;quot; );&lt;br /&gt;
        // The text we want to show, of course &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
        item-&amp;gt;setText( &amp;quot;Hello Marble!&amp;quot; );&lt;br /&gt;
        // Add the item to the list of items, so it will be displayed.&lt;br /&gt;
        addItemToList( item );&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;TutorialModel.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to download files from a web server to get lists of items, you will want to use '''void downloadDescriptionFile( const QUrl&amp;amp; url )''' and you have to reimplement '''void parseFile( const QByteArray&amp;amp; file )''', which parses the downloaded description file and adds new items to the list.&lt;br /&gt;
&lt;br /&gt;
If you want to download files per item (for example if you want to display images), you can use '''void downloadItemData( const QUrl&amp;amp; url, const QString&amp;amp; type, AbstractDataPluginItem *item )'''. This will also add the items to the list of items. The type is something you have to invent yourself. It has to be unique in your plugin. The function '''void addDownloadedFile( const QString&amp;amp; url, const QString&amp;amp; type )''' of our item is called when the download has been finished. This is what you need to implement.&lt;br /&gt;
&lt;br /&gt;
To see examples of the usage of these functions, look at wikipedia-plugin and photo-plugin.&lt;br /&gt;
&lt;br /&gt;
== Main Plugin Class ==&lt;br /&gt;
Now to the boring part of the tutorial: The main class.&lt;br /&gt;
&lt;br /&gt;
'''TutorialPlugin.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALPLUGIN_H&lt;br /&gt;
#define TUTORIALPLUGIN_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPlugin.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RenderPlugin.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RenderPluginInterface.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;QtGui/QIcon&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble {&lt;br /&gt;
 &lt;br /&gt;
class TutorialPlugin : public AbstractDataPlugin {&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
    Q_INTERFACES( Marble::RenderPluginInterface )&lt;br /&gt;
    MARBLE_PLUGIN( TutorialPlugin )&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialPlugin();&lt;br /&gt;
 &lt;br /&gt;
    virtual void initialize();&lt;br /&gt;
&lt;br /&gt;
    virtual bool isInitialized() const;&lt;br /&gt;
 &lt;br /&gt;
    QString name() const;&lt;br /&gt;
 &lt;br /&gt;
    QString guiString() const;&lt;br /&gt;
 &lt;br /&gt;
    QString description() const;&lt;br /&gt;
 &lt;br /&gt;
    QIcon icon() const;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
    bool m_isInitialized;&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the implementation:&lt;br /&gt;
'''TutorialPlugin.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialPlugin.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;TutorialModel.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
TutorialPlugin::TutorialPlugin()&lt;br /&gt;
    : m_isInitialized( false )&lt;br /&gt;
{&lt;br /&gt;
    setNameId( &amp;quot;tutorial&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
    // Plugin is enabled by default&lt;br /&gt;
    setEnabled( true );&lt;br /&gt;
    // Plugin is invisible by default&lt;br /&gt;
    setVisible( false );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialPlugin::initialize() {&lt;br /&gt;
    setModel( new TutorialModel( pluginManager(), this ) );&lt;br /&gt;
    // Setting the number of items on the screen.&lt;br /&gt;
    setNumberOfItems( numberOfItemsOnScreen );&lt;br /&gt;
&lt;br /&gt;
    m_isInitialized = true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool TutorialPlugin::isInitialized() const {&lt;br /&gt;
    return m_isInitialized;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::name() const {&lt;br /&gt;
    return tr( &amp;quot;Tutorial Items&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::guiString() const {&lt;br /&gt;
    return tr( &amp;quot;&amp;amp;Tutorial&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::description() const {&lt;br /&gt;
    return tr( &amp;quot;Shows tutorial items on the map.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QIcon TutorialPlugin::icon() const {&lt;br /&gt;
    return QIcon();&lt;br /&gt;
}&lt;br /&gt;
// Because we want to create a plugin, we have to do the following line.&lt;br /&gt;
Q_EXPORT_PLUGIN2(TutorialPlugin, Marble::TutorialPlugin)&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;TutorialPlugin.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CMake ==&lt;br /&gt;
You can build the plugin anywhere. This needs the following file:&lt;br /&gt;
'''CMakeLists.txt'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PROJECT( TutorialPlugin )&lt;br /&gt;
&lt;br /&gt;
cmake_minimum_required( VERSION 2.4.8 )&lt;br /&gt;
&lt;br /&gt;
find_package(Qt4 REQUIRED)&lt;br /&gt;
find_package(Marble REQUIRED)&lt;br /&gt;
&lt;br /&gt;
INCLUDE_DIRECTORIES(&lt;br /&gt;
 ${CMAKE_CURRENT_SOURCE_DIR}&lt;br /&gt;
 ${CMAKE_BINARY_DIR}&lt;br /&gt;
 ${QT_INCLUDE_DIR}&lt;br /&gt;
 ${MARBLE_INCLUDE_DIR}&lt;br /&gt;
)&lt;br /&gt;
 &lt;br /&gt;
set( tutorial_SRCS TutorialPlugin.cpp&lt;br /&gt;
                   TutorialModel.cpp&lt;br /&gt;
                   TutorialItem.cpp )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
qt4_automoc( ${tutorial_SRCS} )&lt;br /&gt;
add_library( Tutorial MODULE ${tutorial_SRCS} )&lt;br /&gt;
target_link_libraries( Tutorial ${QT_QTCORE_LIBRARY}&lt;br /&gt;
                                ${QT_QTGUI_LIBRARY}&lt;br /&gt;
                                ${${_target_name}_LIBS}&lt;br /&gt;
                                ${MARBLE_LIBRARIES} )&lt;br /&gt;
install( TARGETS Tutorial DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/kde4/plugins/marble/ )&lt;br /&gt;
&lt;br /&gt;
set_target_properties( ${_target_name} PROPERTIES&lt;br /&gt;
                       INSTALL_RPATH_USE_LINK_PATH TRUE&lt;br /&gt;
                       SKIP_BUILD_RPATH TRUE&lt;br /&gt;
                       BUILD_WITH_INSTALL_RPATH TRUE&lt;br /&gt;
                     )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following commands will build the plugin then.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ../&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use the qt-only version, you'll probably need to change the install path. We are currently working on a solution for that problem.&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/OnlineServices</id>
		<title>Projects/Marble/OnlineServices</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/OnlineServices"/>
				<updated>2013-01-13T16:44:37Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Creating your first Marble Online Services Plugin|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/VehicleTracking|Tutorial 7 -Vehicle Tracking]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Routing/BasicRouting|Tutorial 9 - Searching]]|&lt;br /&gt;
&lt;br /&gt;
reading=[[Development/Tutorials/CMake|CMake]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
You will here learn to create your own online service plugins. If you don't know what is meant by online service, you will see these in the Marble menu at &amp;quot;View&amp;quot;-&amp;gt;&amp;quot;Online Services&amp;quot;.&lt;br /&gt;
You'll need KDE 4.3 to build this tutorial.&lt;br /&gt;
If you want to write plugins for Marble, it could be useful to do this in KDE's subversion. Please contact the Marble developers for this (IRC, E-Mail).&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
An online services plugin or data plugin consist of three classes at least. The class to display the information is the Data Item (the base class is AbstractDataPluginItem). It stores the information for single places on the map and displays them.&lt;br /&gt;
&lt;br /&gt;
The Model (base class AbstractDataPluginModel) stores all items. Storing the items will be done by AbstractDataPluginModel itself. Your only job is to get information for new items when the displayed part of the earth changes. This can include downloading so called &amp;quot;Description files&amp;quot; from the servers of an online service and parsing them. These &amp;quot;Description files&amp;quot; contain lists of items in a specific part of the earth (specified by a LatLonAltBox).&lt;br /&gt;
&lt;br /&gt;
The class based on AbstractDataPlugin is the representation class of our plugin. It provides the name and the idea of the plugin. You also have to set your model there.&lt;br /&gt;
&lt;br /&gt;
== Item ==&lt;br /&gt;
We will write our item first as it depends on nothing else. As you should already know the item stores the data and paints it on the screen. One item has an exact position on the globe as longitude, latitude and altitude.&lt;br /&gt;
The item we will write shows a text at the specific position.&lt;br /&gt;
&lt;br /&gt;
We will now look at the header file to see what functions we have to implement.&lt;br /&gt;
'''TutorialItem.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALITEM_H&lt;br /&gt;
#define TUTORIALITEM_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPluginItem.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
class QFont;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
class TutorialItem : public AbstractDataPluginItem&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialItem( QObject *parent );&lt;br /&gt;
 &lt;br /&gt;
    ~TutorialItem();&lt;br /&gt;
 &lt;br /&gt;
    // Returns the item type of the item.&lt;br /&gt;
    QString itemType() const;&lt;br /&gt;
 &lt;br /&gt;
    // Returns true if the item is paintable&lt;br /&gt;
    bool initialized();&lt;br /&gt;
 &lt;br /&gt;
    // Here the item gets painted&lt;br /&gt;
    void paint( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
                const QString&amp;amp; renderPos, GeoSceneLayer * layer = 0 );&lt;br /&gt;
 &lt;br /&gt;
    bool operator&amp;lt;( const AbstractDataPluginItem *other ) const;&lt;br /&gt;
 &lt;br /&gt;
    // The text we want to show on the map&lt;br /&gt;
    QString text() const;&lt;br /&gt;
    void setText( const QString&amp;amp; text );&lt;br /&gt;
 &lt;br /&gt;
 private:&lt;br /&gt;
    QString m_text;&lt;br /&gt;
 &lt;br /&gt;
    static QFont s_font;&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
#endif // TUTORIALITEM_H&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you have probably seen, it will be very easy to implement this as we have only one function (paint()) besides some getters and setters.&lt;br /&gt;
&lt;br /&gt;
Let's have a look at the implementation.&lt;br /&gt;
'''TutorialItem.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialItem.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Marble&lt;br /&gt;
#include &amp;quot;GeoPainter.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ViewportParams.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QFontMetrics&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
// That's the font we will use to paint.&lt;br /&gt;
QFont TutorialItem::s_font = QFont( &amp;quot;Sans Serif&amp;quot;, 8 );&lt;br /&gt;
 &lt;br /&gt;
TutorialItem::TutorialItem( QObject *parent )&lt;br /&gt;
    : AbstractDataPluginItem( parent )&lt;br /&gt;
{&lt;br /&gt;
    // The size of an item without a text is 0&lt;br /&gt;
    setSize( QSize( 0, 0 ) );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
TutorialItem::~TutorialItem()&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialItem::itemType() const&lt;br /&gt;
{&lt;br /&gt;
    // Our itemType:&lt;br /&gt;
    return &amp;quot;tutorialItem&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
bool TutorialItem::initialized()&lt;br /&gt;
{&lt;br /&gt;
    // The item is initialized if it has a text&lt;br /&gt;
    if ( m_text.isEmpty() ) &lt;br /&gt;
        return false;&lt;br /&gt;
    else&lt;br /&gt;
        return true;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
bool TutorialItem::operator&amp;lt;( const AbstractDataPluginItem *other ) const&lt;br /&gt;
{&lt;br /&gt;
    // That's not a very nice priority estimation, you'll hopefully find&lt;br /&gt;
    // a better one for your plugin.&lt;br /&gt;
    return this-&amp;gt;id() &amp;lt; other-&amp;gt;id();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialItem::text() const&lt;br /&gt;
{&lt;br /&gt;
    return m_text;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialItem::setText( const QString&amp;amp; text )&lt;br /&gt;
{&lt;br /&gt;
    // On a text change our size may also change, so we have to set the new&lt;br /&gt;
    // item size. Marble needs to know how large an item is to find the correct&lt;br /&gt;
    // bounding rect. The given position will always be in the middle of the &lt;br /&gt;
    // item for now.&lt;br /&gt;
    QFontMetrics metrics( s_font );&lt;br /&gt;
    setSize( metrics.size( 0, text ) );&lt;br /&gt;
    m_text = text;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialItem::paint( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
                          const QString&amp;amp; renderPos, GeoSceneLayer * layer )&lt;br /&gt;
{&lt;br /&gt;
    Q_UNUSED( renderPos )&lt;br /&gt;
    Q_UNUSED( layer )&lt;br /&gt;
 &lt;br /&gt;
    // Save the old painter state.&lt;br /&gt;
    painter-&amp;gt;save();&lt;br /&gt;
    // We want to paint a black string.&lt;br /&gt;
    painter-&amp;gt;setPen( QPen( QColor( Qt::black ) ) );&lt;br /&gt;
    // We will use our standard font.&lt;br /&gt;
    painter-&amp;gt;setFont( s_font );&lt;br /&gt;
    // Draw the text into the given rect.&lt;br /&gt;
    painter-&amp;gt;drawText( QRect( QPoint( 0, 0 ), size().toSize() ), 0, m_text );&lt;br /&gt;
    // Restore the old painter state.&lt;br /&gt;
    painter-&amp;gt;restore();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
// This is needed for all QObjects (see MOC)&lt;br /&gt;
#include &amp;quot;TutorialItem.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wasn't that easy? Continue with the next section.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
We will continue developing the core component, the model. Let's first look at the header file:&lt;br /&gt;
'''TutorialModel.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALMODEL_H&lt;br /&gt;
#define TUTORIALMODEL_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPluginModel.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble {&lt;br /&gt;
 &lt;br /&gt;
class MarbleDataFacade;&lt;br /&gt;
 &lt;br /&gt;
// The maximum number of items we want to show on the screen.&lt;br /&gt;
const quint32 numberOfItemsOnScreen = 20;&lt;br /&gt;
 &lt;br /&gt;
class TutorialModel : public AbstractDataPluginModel&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialModel( PluginManager *pluginManager,&lt;br /&gt;
                   QObject *parent = 0 );&lt;br /&gt;
    ~TutorialModel();&lt;br /&gt;
 &lt;br /&gt;
 protected:&lt;br /&gt;
    /**&lt;br /&gt;
     * Generates the download url for the description file from the web service depending on&lt;br /&gt;
     * the @p box surrounding the view and the @p number of files to show.&lt;br /&gt;
     **/&lt;br /&gt;
    void getAdditionalItems( const GeoDataLatLonAltBox&amp;amp; box,&lt;br /&gt;
                             MarbleDataFacade *facade,&lt;br /&gt;
                             qint32 number = 10 );&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
#endif // TUTORIALMODEL_H&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You see that we have to implement the function getAdditionalItems(). getAdditionalItems() is called when the viewport has been changed significantly, so new items have to be generated.&lt;br /&gt;
For getAdditionalItems() we will go the easy way for now. We will simply add one item with a static position. That's a very simple method to test your painting code.&lt;br /&gt;
&lt;br /&gt;
'''TutorialModel.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialModel.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Plugin&lt;br /&gt;
#include &amp;quot;TutorialItem.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Marble&lt;br /&gt;
#include &amp;quot;global.h&amp;quot;&lt;br /&gt;
#include &amp;quot;MarbleDataFacade.h&amp;quot;&lt;br /&gt;
#include &amp;quot;GeoDataCoordinates.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QString&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TutorialModel::TutorialModel( PluginManager *pluginManager,&lt;br /&gt;
                              QObject *parent  )&lt;br /&gt;
    : AbstractDataPluginModel( &amp;quot;tutorial&amp;quot;, pluginManager, parent )&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TutorialModel::~TutorialModel() {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void TutorialModel::getAdditionalItems( const GeoDataLatLonAltBox&amp;amp; box,&lt;br /&gt;
                                         MarbleDataFacade *facade,&lt;br /&gt;
                                         qint32 number )&lt;br /&gt;
{&lt;br /&gt;
    // This plugin only supports Tutorial items for earth&lt;br /&gt;
    if( facade-&amp;gt;target() != &amp;quot;earth&amp;quot; ) {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    // We will only create one item in our first tutorial.&lt;br /&gt;
    // Every item has to get an id. We have to check if the item already exists.&lt;br /&gt;
    if ( !itemExists( &amp;quot;tutorial1&amp;quot; ) ) {&lt;br /&gt;
        // If it does not exists, create it&lt;br /&gt;
        GeoDataCoordinates coor( 10.22 * DEG2RAD, 54.4 * DEG2RAD );&lt;br /&gt;
        // The parent of the new item is this object&lt;br /&gt;
        TutorialItem *item = new TutorialItem( this );&lt;br /&gt;
        item-&amp;gt;setCoordinate( coor );&lt;br /&gt;
        item-&amp;gt;setTarget( &amp;quot;earth&amp;quot; );&lt;br /&gt;
        item-&amp;gt;setId( &amp;quot;tutorial1&amp;quot; );&lt;br /&gt;
        // The text we want to show, of course &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
        item-&amp;gt;setText( &amp;quot;Hello Marble!&amp;quot; );&lt;br /&gt;
        // Add the item to the list of items, so it will be displayed.&lt;br /&gt;
        addItemToList( item );&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;TutorialModel.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to download files from a web server to get lists of items, you will want to use '''void downloadDescriptionFile( const QUrl&amp;amp; url )''' and you have to reimplement '''void parseFile( const QByteArray&amp;amp; file )''', which parses the downloaded description file and adds new items to the list.&lt;br /&gt;
&lt;br /&gt;
If you want to download files per item (for example if you want to display images), you can use '''void downloadItemData( const QUrl&amp;amp; url, const QString&amp;amp; type, AbstractDataPluginItem *item )'''. This will also add the items to the list of items. The type is something you have to invent yourself. It has to be unique in your plugin. The function '''void addDownloadedFile( const QString&amp;amp; url, const QString&amp;amp; type )''' of our item is called when the download has been finished. This is what you need to implement.&lt;br /&gt;
&lt;br /&gt;
To see examples of the usage of these functions, look at wikipedia-plugin and photo-plugin.&lt;br /&gt;
&lt;br /&gt;
== Main Plugin Class ==&lt;br /&gt;
Now to the boring part of the tutorial: The main class.&lt;br /&gt;
&lt;br /&gt;
'''TutorialPlugin.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALPLUGIN_H&lt;br /&gt;
#define TUTORIALPLUGIN_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPlugin.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RenderPlugin.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RenderPluginInterface.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;QtGui/QIcon&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble {&lt;br /&gt;
 &lt;br /&gt;
class TutorialPlugin : public AbstractDataPlugin {&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
    Q_INTERFACES( Marble::RenderPluginInterface )&lt;br /&gt;
    MARBLE_PLUGIN( TutorialPlugin )&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialPlugin();&lt;br /&gt;
 &lt;br /&gt;
    virtual void initialize();&lt;br /&gt;
&lt;br /&gt;
    virtual bool isInitialized() const;&lt;br /&gt;
 &lt;br /&gt;
    QString name() const;&lt;br /&gt;
 &lt;br /&gt;
    QString guiString() const;&lt;br /&gt;
 &lt;br /&gt;
    QString description() const;&lt;br /&gt;
 &lt;br /&gt;
    QIcon icon() const;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
    bool m_isInitialized;&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the implementation:&lt;br /&gt;
'''TutorialPlugin.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialPlugin.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;TutorialModel.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
TutorialPlugin::TutorialPlugin()&lt;br /&gt;
    : m_isInitialized( false )&lt;br /&gt;
{&lt;br /&gt;
    setNameId( &amp;quot;tutorial&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
    // Plugin is enabled by default&lt;br /&gt;
    setEnabled( true );&lt;br /&gt;
    // Plugin is invisible by default&lt;br /&gt;
    setVisible( false );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialPlugin::initialize() {&lt;br /&gt;
    setModel( new TutorialModel( pluginManager(), this ) );&lt;br /&gt;
    // Setting the number of items on the screen.&lt;br /&gt;
    setNumberOfItems( numberOfItemsOnScreen );&lt;br /&gt;
&lt;br /&gt;
    m_isInitialized = true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool TutorialPlugin::isInitialized() const {&lt;br /&gt;
    return m_isInitialized;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::name() const {&lt;br /&gt;
    return tr( &amp;quot;Tutorial Items&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::guiString() const {&lt;br /&gt;
    return tr( &amp;quot;&amp;amp;Tutorial&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::description() const {&lt;br /&gt;
    return tr( &amp;quot;Shows tutorial items on the map.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QIcon TutorialPlugin::icon() const {&lt;br /&gt;
    return QIcon();&lt;br /&gt;
}&lt;br /&gt;
// Because we want to create a plugin, we have to do the following line.&lt;br /&gt;
Q_EXPORT_PLUGIN2(TutorialPlugin, Marble::TutorialPlugin)&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;TutorialPlugin.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CMake ==&lt;br /&gt;
You can build the plugin anywhere. This needs the following file:&lt;br /&gt;
'''CMakeLists.txt'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PROJECT( TutorialPlugin )&lt;br /&gt;
&lt;br /&gt;
cmake_minimum_required( VERSION 2.4.8 )&lt;br /&gt;
&lt;br /&gt;
find_package(Qt4 REQUIRED)&lt;br /&gt;
find_package(Marble REQUIRED)&lt;br /&gt;
&lt;br /&gt;
INCLUDE_DIRECTORIES(&lt;br /&gt;
 ${CMAKE_CURRENT_SOURCE_DIR}&lt;br /&gt;
 ${CMAKE_BINARY_DIR}&lt;br /&gt;
 ${QT_INCLUDE_DIR}&lt;br /&gt;
 ${MARBLE_INCLUDE_DIR}&lt;br /&gt;
)&lt;br /&gt;
 &lt;br /&gt;
set( tutorial_SRCS TutorialPlugin.cpp&lt;br /&gt;
                   TutorialModel.cpp&lt;br /&gt;
                   TutorialItem.cpp )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
qt4_automoc( ${tutorial_SRCS} )&lt;br /&gt;
add_library( Tutorial MODULE ${tutorial_SRCS} )&lt;br /&gt;
target_link_libraries( Tutorial ${QT_QTCORE_LIBRARY}&lt;br /&gt;
                                ${QT_QTGUI_LIBRARY}&lt;br /&gt;
                                ${${_target_name}_LIBS}&lt;br /&gt;
                                ${MARBLE_LIBRARIES} )&lt;br /&gt;
install( TARGETS Tutorial DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/kde4/plugins/marble/ )&lt;br /&gt;
&lt;br /&gt;
set_target_properties( ${_target_name} PROPERTIES&lt;br /&gt;
                       INSTALL_RPATH_USE_LINK_PATH TRUE&lt;br /&gt;
                       SKIP_BUILD_RPATH TRUE&lt;br /&gt;
                       BUILD_WITH_INSTALL_RPATH TRUE&lt;br /&gt;
                     )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following commands will build the plugin then.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ../&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use the qt-only version, you'll probably need to change the install path. We are currently working on a solution for that problem.&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/OnlineServices</id>
		<title>Projects/Marble/OnlineServices</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/OnlineServices"/>
				<updated>2013-01-13T16:21:46Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Creating your first Marble Online Services Plugin|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/VehicleTracking | Tutorial 7 - Vehicle Tracking]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Routing/BasicRouting| Tutorial 9 - Basic Routing| &lt;br /&gt;
&lt;br /&gt;
reading=[[Development/Tutorials/CMake|CMake]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
You will here learn to create your own online service plugins. If you don't know what is meant by online service, you will see these in the Marble menu at &amp;quot;View&amp;quot;-&amp;gt;&amp;quot;Online Services&amp;quot;.&lt;br /&gt;
You'll need KDE 4.3 to build this tutorial.&lt;br /&gt;
If you want to write plugins for Marble, it could be useful to do this in KDE's subversion. Please contact the Marble developers for this (IRC, E-Mail).&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
An online services plugin or data plugin consist of three classes at least. The class to display the information is the Data Item (the base class is AbstractDataPluginItem). It stores the information for single places on the map and displays them.&lt;br /&gt;
&lt;br /&gt;
The Model (base class AbstractDataPluginModel) stores all items. Storing the items will be done by AbstractDataPluginModel itself. Your only job is to get information for new items when the displayed part of the earth changes. This can include downloading so called &amp;quot;Description files&amp;quot; from the servers of an online service and parsing them. These &amp;quot;Description files&amp;quot; contain lists of items in a specific part of the earth (specified by a LatLonAltBox).&lt;br /&gt;
&lt;br /&gt;
The class based on AbstractDataPlugin is the representation class of our plugin. It provides the name and the idea of the plugin. You also have to set your model there.&lt;br /&gt;
&lt;br /&gt;
== Item ==&lt;br /&gt;
We will write our item first as it depends on nothing else. As you should already know the item stores the data and paints it on the screen. One item has an exact position on the globe as longitude, latitude and altitude.&lt;br /&gt;
The item we will write shows a text at the specific position.&lt;br /&gt;
&lt;br /&gt;
We will now look at the header file to see what functions we have to implement.&lt;br /&gt;
'''TutorialItem.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALITEM_H&lt;br /&gt;
#define TUTORIALITEM_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPluginItem.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
class QFont;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
class TutorialItem : public AbstractDataPluginItem&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialItem( QObject *parent );&lt;br /&gt;
 &lt;br /&gt;
    ~TutorialItem();&lt;br /&gt;
 &lt;br /&gt;
    // Returns the item type of the item.&lt;br /&gt;
    QString itemType() const;&lt;br /&gt;
 &lt;br /&gt;
    // Returns true if the item is paintable&lt;br /&gt;
    bool initialized();&lt;br /&gt;
 &lt;br /&gt;
    // Here the item gets painted&lt;br /&gt;
    void paint( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
                const QString&amp;amp; renderPos, GeoSceneLayer * layer = 0 );&lt;br /&gt;
 &lt;br /&gt;
    bool operator&amp;lt;( const AbstractDataPluginItem *other ) const;&lt;br /&gt;
 &lt;br /&gt;
    // The text we want to show on the map&lt;br /&gt;
    QString text() const;&lt;br /&gt;
    void setText( const QString&amp;amp; text );&lt;br /&gt;
 &lt;br /&gt;
 private:&lt;br /&gt;
    QString m_text;&lt;br /&gt;
 &lt;br /&gt;
    static QFont s_font;&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
#endif // TUTORIALITEM_H&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you have probably seen, it will be very easy to implement this as we have only one function (paint()) besides some getters and setters.&lt;br /&gt;
&lt;br /&gt;
Let's have a look at the implementation.&lt;br /&gt;
'''TutorialItem.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialItem.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Marble&lt;br /&gt;
#include &amp;quot;GeoPainter.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ViewportParams.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QFontMetrics&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
// That's the font we will use to paint.&lt;br /&gt;
QFont TutorialItem::s_font = QFont( &amp;quot;Sans Serif&amp;quot;, 8 );&lt;br /&gt;
 &lt;br /&gt;
TutorialItem::TutorialItem( QObject *parent )&lt;br /&gt;
    : AbstractDataPluginItem( parent )&lt;br /&gt;
{&lt;br /&gt;
    // The size of an item without a text is 0&lt;br /&gt;
    setSize( QSize( 0, 0 ) );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
TutorialItem::~TutorialItem()&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialItem::itemType() const&lt;br /&gt;
{&lt;br /&gt;
    // Our itemType:&lt;br /&gt;
    return &amp;quot;tutorialItem&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
bool TutorialItem::initialized()&lt;br /&gt;
{&lt;br /&gt;
    // The item is initialized if it has a text&lt;br /&gt;
    if ( m_text.isEmpty() ) &lt;br /&gt;
        return false;&lt;br /&gt;
    else&lt;br /&gt;
        return true;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
bool TutorialItem::operator&amp;lt;( const AbstractDataPluginItem *other ) const&lt;br /&gt;
{&lt;br /&gt;
    // That's not a very nice priority estimation, you'll hopefully find&lt;br /&gt;
    // a better one for your plugin.&lt;br /&gt;
    return this-&amp;gt;id() &amp;lt; other-&amp;gt;id();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialItem::text() const&lt;br /&gt;
{&lt;br /&gt;
    return m_text;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialItem::setText( const QString&amp;amp; text )&lt;br /&gt;
{&lt;br /&gt;
    // On a text change our size may also change, so we have to set the new&lt;br /&gt;
    // item size. Marble needs to know how large an item is to find the correct&lt;br /&gt;
    // bounding rect. The given position will always be in the middle of the &lt;br /&gt;
    // item for now.&lt;br /&gt;
    QFontMetrics metrics( s_font );&lt;br /&gt;
    setSize( metrics.size( 0, text ) );&lt;br /&gt;
    m_text = text;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialItem::paint( GeoPainter *painter, ViewportParams *viewport,&lt;br /&gt;
                          const QString&amp;amp; renderPos, GeoSceneLayer * layer )&lt;br /&gt;
{&lt;br /&gt;
    Q_UNUSED( renderPos )&lt;br /&gt;
    Q_UNUSED( layer )&lt;br /&gt;
 &lt;br /&gt;
    // Save the old painter state.&lt;br /&gt;
    painter-&amp;gt;save();&lt;br /&gt;
    // We want to paint a black string.&lt;br /&gt;
    painter-&amp;gt;setPen( QPen( QColor( Qt::black ) ) );&lt;br /&gt;
    // We will use our standard font.&lt;br /&gt;
    painter-&amp;gt;setFont( s_font );&lt;br /&gt;
    // Draw the text into the given rect.&lt;br /&gt;
    painter-&amp;gt;drawText( QRect( QPoint( 0, 0 ), size().toSize() ), 0, m_text );&lt;br /&gt;
    // Restore the old painter state.&lt;br /&gt;
    painter-&amp;gt;restore();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
// This is needed for all QObjects (see MOC)&lt;br /&gt;
#include &amp;quot;TutorialItem.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wasn't that easy? Continue with the next section.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
We will continue developing the core component, the model. Let's first look at the header file:&lt;br /&gt;
'''TutorialModel.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALMODEL_H&lt;br /&gt;
#define TUTORIALMODEL_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPluginModel.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble {&lt;br /&gt;
 &lt;br /&gt;
class MarbleDataFacade;&lt;br /&gt;
 &lt;br /&gt;
// The maximum number of items we want to show on the screen.&lt;br /&gt;
const quint32 numberOfItemsOnScreen = 20;&lt;br /&gt;
 &lt;br /&gt;
class TutorialModel : public AbstractDataPluginModel&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialModel( PluginManager *pluginManager,&lt;br /&gt;
                   QObject *parent = 0 );&lt;br /&gt;
    ~TutorialModel();&lt;br /&gt;
 &lt;br /&gt;
 protected:&lt;br /&gt;
    /**&lt;br /&gt;
     * Generates the download url for the description file from the web service depending on&lt;br /&gt;
     * the @p box surrounding the view and the @p number of files to show.&lt;br /&gt;
     **/&lt;br /&gt;
    void getAdditionalItems( const GeoDataLatLonAltBox&amp;amp; box,&lt;br /&gt;
                             MarbleDataFacade *facade,&lt;br /&gt;
                             qint32 number = 10 );&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
#endif // TUTORIALMODEL_H&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You see that we have to implement the function getAdditionalItems(). getAdditionalItems() is called when the viewport has been changed significantly, so new items have to be generated.&lt;br /&gt;
For getAdditionalItems() we will go the easy way for now. We will simply add one item with a static position. That's a very simple method to test your painting code.&lt;br /&gt;
&lt;br /&gt;
'''TutorialModel.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialModel.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Plugin&lt;br /&gt;
#include &amp;quot;TutorialItem.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Marble&lt;br /&gt;
#include &amp;quot;global.h&amp;quot;&lt;br /&gt;
#include &amp;quot;MarbleDataFacade.h&amp;quot;&lt;br /&gt;
#include &amp;quot;GeoDataCoordinates.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QString&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TutorialModel::TutorialModel( PluginManager *pluginManager,&lt;br /&gt;
                              QObject *parent  )&lt;br /&gt;
    : AbstractDataPluginModel( &amp;quot;tutorial&amp;quot;, pluginManager, parent )&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TutorialModel::~TutorialModel() {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void TutorialModel::getAdditionalItems( const GeoDataLatLonAltBox&amp;amp; box,&lt;br /&gt;
                                         MarbleDataFacade *facade,&lt;br /&gt;
                                         qint32 number )&lt;br /&gt;
{&lt;br /&gt;
    // This plugin only supports Tutorial items for earth&lt;br /&gt;
    if( facade-&amp;gt;target() != &amp;quot;earth&amp;quot; ) {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    // We will only create one item in our first tutorial.&lt;br /&gt;
    // Every item has to get an id. We have to check if the item already exists.&lt;br /&gt;
    if ( !itemExists( &amp;quot;tutorial1&amp;quot; ) ) {&lt;br /&gt;
        // If it does not exists, create it&lt;br /&gt;
        GeoDataCoordinates coor( 10.22 * DEG2RAD, 54.4 * DEG2RAD );&lt;br /&gt;
        // The parent of the new item is this object&lt;br /&gt;
        TutorialItem *item = new TutorialItem( this );&lt;br /&gt;
        item-&amp;gt;setCoordinate( coor );&lt;br /&gt;
        item-&amp;gt;setTarget( &amp;quot;earth&amp;quot; );&lt;br /&gt;
        item-&amp;gt;setId( &amp;quot;tutorial1&amp;quot; );&lt;br /&gt;
        // The text we want to show, of course &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
        item-&amp;gt;setText( &amp;quot;Hello Marble!&amp;quot; );&lt;br /&gt;
        // Add the item to the list of items, so it will be displayed.&lt;br /&gt;
        addItemToList( item );&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;TutorialModel.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to download files from a web server to get lists of items, you will want to use '''void downloadDescriptionFile( const QUrl&amp;amp; url )''' and you have to reimplement '''void parseFile( const QByteArray&amp;amp; file )''', which parses the downloaded description file and adds new items to the list.&lt;br /&gt;
&lt;br /&gt;
If you want to download files per item (for example if you want to display images), you can use '''void downloadItemData( const QUrl&amp;amp; url, const QString&amp;amp; type, AbstractDataPluginItem *item )'''. This will also add the items to the list of items. The type is something you have to invent yourself. It has to be unique in your plugin. The function '''void addDownloadedFile( const QString&amp;amp; url, const QString&amp;amp; type )''' of our item is called when the download has been finished. This is what you need to implement.&lt;br /&gt;
&lt;br /&gt;
To see examples of the usage of these functions, look at wikipedia-plugin and photo-plugin.&lt;br /&gt;
&lt;br /&gt;
== Main Plugin Class ==&lt;br /&gt;
Now to the boring part of the tutorial: The main class.&lt;br /&gt;
&lt;br /&gt;
'''TutorialPlugin.h'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef TUTORIALPLUGIN_H&lt;br /&gt;
#define TUTORIALPLUGIN_H&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;AbstractDataPlugin.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RenderPlugin.h&amp;quot;&lt;br /&gt;
#include &amp;quot;RenderPluginInterface.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;QtGui/QIcon&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
namespace Marble {&lt;br /&gt;
 &lt;br /&gt;
class TutorialPlugin : public AbstractDataPlugin {&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
    Q_INTERFACES( Marble::RenderPluginInterface )&lt;br /&gt;
    MARBLE_PLUGIN( TutorialPlugin )&lt;br /&gt;
 &lt;br /&gt;
 public:&lt;br /&gt;
    TutorialPlugin();&lt;br /&gt;
 &lt;br /&gt;
    virtual void initialize();&lt;br /&gt;
&lt;br /&gt;
    virtual bool isInitialized() const;&lt;br /&gt;
 &lt;br /&gt;
    QString name() const;&lt;br /&gt;
 &lt;br /&gt;
    QString guiString() const;&lt;br /&gt;
 &lt;br /&gt;
    QString description() const;&lt;br /&gt;
 &lt;br /&gt;
    QIcon icon() const;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
    bool m_isInitialized;&lt;br /&gt;
};&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the implementation:&lt;br /&gt;
'''TutorialPlugin.cpp'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
// Self&lt;br /&gt;
#include &amp;quot;TutorialPlugin.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;TutorialModel.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Qt&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
TutorialPlugin::TutorialPlugin()&lt;br /&gt;
    : m_isInitialized( false )&lt;br /&gt;
{&lt;br /&gt;
    setNameId( &amp;quot;tutorial&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
    // Plugin is enabled by default&lt;br /&gt;
    setEnabled( true );&lt;br /&gt;
    // Plugin is invisible by default&lt;br /&gt;
    setVisible( false );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void TutorialPlugin::initialize() {&lt;br /&gt;
    setModel( new TutorialModel( pluginManager(), this ) );&lt;br /&gt;
    // Setting the number of items on the screen.&lt;br /&gt;
    setNumberOfItems( numberOfItemsOnScreen );&lt;br /&gt;
&lt;br /&gt;
    m_isInitialized = true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
bool TutorialPlugin::isInitialized() const {&lt;br /&gt;
    return m_isInitialized;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::name() const {&lt;br /&gt;
    return tr( &amp;quot;Tutorial Items&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::guiString() const {&lt;br /&gt;
    return tr( &amp;quot;&amp;amp;Tutorial&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QString TutorialPlugin::description() const {&lt;br /&gt;
    return tr( &amp;quot;Shows tutorial items on the map.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
QIcon TutorialPlugin::icon() const {&lt;br /&gt;
    return QIcon();&lt;br /&gt;
}&lt;br /&gt;
// Because we want to create a plugin, we have to do the following line.&lt;br /&gt;
Q_EXPORT_PLUGIN2(TutorialPlugin, Marble::TutorialPlugin)&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;TutorialPlugin.moc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CMake ==&lt;br /&gt;
You can build the plugin anywhere. This needs the following file:&lt;br /&gt;
'''CMakeLists.txt'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PROJECT( TutorialPlugin )&lt;br /&gt;
&lt;br /&gt;
cmake_minimum_required( VERSION 2.4.8 )&lt;br /&gt;
&lt;br /&gt;
find_package(Qt4 REQUIRED)&lt;br /&gt;
find_package(Marble REQUIRED)&lt;br /&gt;
&lt;br /&gt;
INCLUDE_DIRECTORIES(&lt;br /&gt;
 ${CMAKE_CURRENT_SOURCE_DIR}&lt;br /&gt;
 ${CMAKE_BINARY_DIR}&lt;br /&gt;
 ${QT_INCLUDE_DIR}&lt;br /&gt;
 ${MARBLE_INCLUDE_DIR}&lt;br /&gt;
)&lt;br /&gt;
 &lt;br /&gt;
set( tutorial_SRCS TutorialPlugin.cpp&lt;br /&gt;
                   TutorialModel.cpp&lt;br /&gt;
                   TutorialItem.cpp )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
qt4_automoc( ${tutorial_SRCS} )&lt;br /&gt;
add_library( Tutorial MODULE ${tutorial_SRCS} )&lt;br /&gt;
target_link_libraries( Tutorial ${QT_QTCORE_LIBRARY}&lt;br /&gt;
                                ${QT_QTGUI_LIBRARY}&lt;br /&gt;
                                ${${_target_name}_LIBS}&lt;br /&gt;
                                ${MARBLE_LIBRARIES} )&lt;br /&gt;
install( TARGETS Tutorial DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/kde4/plugins/marble/ )&lt;br /&gt;
&lt;br /&gt;
set_target_properties( ${_target_name} PROPERTIES&lt;br /&gt;
                       INSTALL_RPATH_USE_LINK_PATH TRUE&lt;br /&gt;
                       SKIP_BUILD_RPATH TRUE&lt;br /&gt;
                       BUILD_WITH_INSTALL_RPATH TRUE&lt;br /&gt;
                     )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following commands will build the plugin then.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ../&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use the qt-only version, you'll probably need to change the install path. We are currently working on a solution for that problem.&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/VehicleTracking</id>
		<title>Projects/Marble/Runners/VehicleTracking</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/VehicleTracking"/>
				<updated>2013-01-13T16:15:20Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/DisplayGeoDataPlacemark|Tutorial 6 - Displaying Places the proper way (via GeoDataDocuments)]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/OnlineServices|Tutorial 8 - Creating new online services]]|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We want to present you another C++ example of Marble Runnable usage, here on KDE TechBase. It's about the cars. Imagine that there are two flying cars in the air. They are driving around ukranian city Kiev (EURO-2012). They are driving circles around it with set radius and speed. At the end of tutorial you will have an application with smth like:&lt;br /&gt;
&lt;br /&gt;
[[File:Marble-VehicleTracking-1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's think about implementation a bit:&lt;br /&gt;
&lt;br /&gt;
# Init [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarbleWidget.html MarbleWidget]&lt;br /&gt;
# Implement [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataPlacemark.html placemarks] for cars &amp;quot;Bus&amp;quot; and &amp;quot;Car&amp;quot;&lt;br /&gt;
# Change their [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html coordinates] using trigonometry functions&lt;br /&gt;
# Apply new [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html coordinates] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We need to change coordinates with really small interval (~10 ms). In this way, to not block GUI thread we need to use multi-threading. For that we suggest that model:&lt;br /&gt;
&lt;br /&gt;
# Create [http://qt-project.org/doc/qt-5.0/qtcore/qthread.html QThread] #1&lt;br /&gt;
# Create CarWorker #1 (= worker for cars' coordinates)&lt;br /&gt;
# Move CarWorker #1 into thread #1&lt;br /&gt;
# The same for Car #2 (1-3)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then we will have three threads - GUI, Calculations #1, Calculations #2. To connect calc. threads with GUI we should use Qt S/S (Signal/Slot) connection.&lt;br /&gt;
&lt;br /&gt;
{{Warning|2=Important|1=Use here connection type Qt::BlockingQueuedConnection, another way GUI thread will be blocked}}&lt;br /&gt;
&lt;br /&gt;
Now we have a nice implementation plan. Let's start coding.&lt;br /&gt;
&lt;br /&gt;
# main() creates an object of the Window (our main QWidget-based window) &lt;br /&gt;
# Window creates the [http://api.kde.org/stable/kdeedu-apidocs/marble/html/classMarbleWidget.html MarbleWidget] and sets two GeoDataPlacemarks there&lt;br /&gt;
# main() calls Window::startCars()&lt;br /&gt;
# Window creates two [http://qt-project.org/doc/qt-5.0/qtcore/qthread.html QThreads]&lt;br /&gt;
# Window creates two CarWorkers&lt;br /&gt;
# Window moves car workers into their threads&lt;br /&gt;
# Threads are started&lt;br /&gt;
&lt;br /&gt;
Then each CarWorker creates a [http://qt-project.org/doc/qt-5.0/qtcore/qtimer.html QTimer] with interval x. On timeout() it calls the CarWorker::iterate() - function to calculate new position of placemark and notify Window (another thread) about it.&lt;br /&gt;
&lt;br /&gt;
Everything is going on until the application finishes.&lt;br /&gt;
&lt;br /&gt;
'''The code with comments:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//&lt;br /&gt;
// This file is part of the Marble Virtual Globe.&lt;br /&gt;
//&lt;br /&gt;
// This program is free software licensed under the GNU LGPL. You can&lt;br /&gt;
// find a copy of this license in LICENSE.txt in the top directory of&lt;br /&gt;
// the source code.&lt;br /&gt;
//&lt;br /&gt;
// Copyright 2012 Illya Kovalevskyy &amp;lt;illya.kovalevskyy@gmail.com&amp;gt;&lt;br /&gt;
// Copyright 2012 Torsten Rahn      &amp;lt;tackat@kde.org&amp;gt;&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QThread&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QTimer&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QHash&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/qmath.h&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QVBoxLayout&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleGlobal.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataDocument.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPlacemark.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLineString.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataTreeModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
// CarWorker Class&lt;br /&gt;
class CarWorker : public QObject&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    CarWorker(const GeoDataCoordinates&amp;amp; city, qreal radius, qreal speed);&lt;br /&gt;
&lt;br /&gt;
signals:&lt;br /&gt;
    /// This signal will be emitted when we need to&lt;br /&gt;
    /// move the placemark.&lt;br /&gt;
    void coordinatesChanged(GeoDataCoordinates coord);&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
    void startWork();&lt;br /&gt;
    void finishWork();&lt;br /&gt;
&lt;br /&gt;
private slots:&lt;br /&gt;
    void iterate();&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    QTimer *m_timer;&lt;br /&gt;
    GeoDataCoordinates m_city;&lt;br /&gt;
    qreal m_radius;&lt;br /&gt;
    qreal m_speed;&lt;br /&gt;
    qreal m_alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
CarWorker::CarWorker(const GeoDataCoordinates &amp;amp;city, qreal radius, qreal speed) :&lt;br /&gt;
    QObject(),&lt;br /&gt;
    m_timer(new QTimer(this)),&lt;br /&gt;
    m_city(city),&lt;br /&gt;
    m_radius(radius),&lt;br /&gt;
    m_speed(speed),&lt;br /&gt;
    m_alpha(0.0)&lt;br /&gt;
{}&lt;br /&gt;
&lt;br /&gt;
void CarWorker::startWork()&lt;br /&gt;
{&lt;br /&gt;
    m_timer-&amp;gt;setInterval(0);&lt;br /&gt;
    connect(m_timer, SIGNAL(timeout()), this, SLOT(iterate()));&lt;br /&gt;
    m_timer-&amp;gt;start();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/// Single timer loop iteration:&lt;br /&gt;
/// Calculates new coordinates for the car&lt;br /&gt;
void CarWorker::iterate()&lt;br /&gt;
{&lt;br /&gt;
    /// A bit of math&lt;br /&gt;
    qreal lon = m_city.longitude(GeoDataCoordinates::Degree) + m_radius * qCos(m_alpha * DEG2RAD);&lt;br /&gt;
    qreal lat = m_city.latitude(GeoDataCoordinates::Degree) + m_radius * qSin(m_alpha * DEG2RAD);&lt;br /&gt;
&lt;br /&gt;
    GeoDataCoordinates coord(lon, lat, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    emit coordinatesChanged(coord);&lt;br /&gt;
&lt;br /&gt;
    /// Iteration is finished. We need to increase angle&lt;br /&gt;
    m_alpha += m_speed;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void CarWorker::finishWork()&lt;br /&gt;
{&lt;br /&gt;
    m_timer-&amp;gt;stop();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Window Class&lt;br /&gt;
class Window : public QWidget&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    Window(QWidget *parent = 0);&lt;br /&gt;
    void startCars();&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
    void setCarCoordinates(const GeoDataCoordinates &amp;amp;coord);&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
    MarbleWidget *m_marbleWidget;&lt;br /&gt;
    CarWorker *m_firstWorker;&lt;br /&gt;
    CarWorker *m_secondWorker;&lt;br /&gt;
    GeoDataPlacemark *m_carFirst;&lt;br /&gt;
    GeoDataPlacemark *m_carSecond;&lt;br /&gt;
    QThread *m_threadFirst;&lt;br /&gt;
    QThread *m_threadSecond;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Window::Window(QWidget *parent) :&lt;br /&gt;
    QWidget(parent),&lt;br /&gt;
    m_marbleWidget(new MarbleWidget)&lt;br /&gt;
{&lt;br /&gt;
    QVBoxLayout *layout = new QVBoxLayout(this);&lt;br /&gt;
    layout-&amp;gt;addWidget(m_marbleWidget);&lt;br /&gt;
    setLayout(layout);&lt;br /&gt;
&lt;br /&gt;
    // Load the OpenStreetMap map&lt;br /&gt;
    m_marbleWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
    m_marbleWidget-&amp;gt;setProjection( Mercator );&lt;br /&gt;
    setGeometry(80, 60, 1000, 800);&lt;br /&gt;
    GeoDataCoordinates Kiev(30.523333, 50.45, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    m_marbleWidget-&amp;gt;centerOn(Kiev);&lt;br /&gt;
    m_marbleWidget-&amp;gt;setZoom(2300);&lt;br /&gt;
&lt;br /&gt;
    m_carFirst = new GeoDataPlacemark(&amp;quot;Bus&amp;quot;);&lt;br /&gt;
    m_carSecond = new GeoDataPlacemark(&amp;quot;Car&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    GeoDataDocument *document = new GeoDataDocument;&lt;br /&gt;
&lt;br /&gt;
    document-&amp;gt;append(m_carFirst);&lt;br /&gt;
    document-&amp;gt;append(m_carSecond);&lt;br /&gt;
&lt;br /&gt;
    m_marbleWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;addDocument(document);&lt;br /&gt;
&lt;br /&gt;
    show();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::startCars()&lt;br /&gt;
{&lt;br /&gt;
    GeoDataCoordinates Kiev(30.523333, 50.45, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
&lt;br /&gt;
    m_threadFirst = new QThread;&lt;br /&gt;
    m_firstWorker = new CarWorker(Kiev, (qreal)0.1, (qreal)0.7);&lt;br /&gt;
    m_firstWorker-&amp;gt;moveToThread(m_threadFirst);&lt;br /&gt;
&lt;br /&gt;
    connect(m_firstWorker, SIGNAL(coordinatesChanged(GeoDataCoordinates)),&lt;br /&gt;
            this, SLOT(setCarCoordinates(GeoDataCoordinates)), Qt::BlockingQueuedConnection);&lt;br /&gt;
&lt;br /&gt;
    m_threadSecond = new QThread;&lt;br /&gt;
    m_secondWorker = new CarWorker(Kiev, (qreal)0.2, (qreal)-0.5);&lt;br /&gt;
    m_secondWorker-&amp;gt;moveToThread(m_threadSecond);&lt;br /&gt;
&lt;br /&gt;
    connect(m_secondWorker, SIGNAL(coordinatesChanged(GeoDataCoordinates)),&lt;br /&gt;
            this, SLOT(setCarCoordinates(GeoDataCoordinates)), Qt::BlockingQueuedConnection);&lt;br /&gt;
&lt;br /&gt;
    connect(m_threadFirst, SIGNAL(started()), m_firstWorker, SLOT(startWork()));&lt;br /&gt;
    connect(m_threadFirst, SIGNAL(finished()), m_firstWorker, SLOT(finishWork()));&lt;br /&gt;
&lt;br /&gt;
    connect(m_threadSecond, SIGNAL(started()), m_secondWorker, SLOT(startWork()));&lt;br /&gt;
    connect(m_threadSecond, SIGNAL(finished()), m_secondWorker, SLOT(finishWork()));&lt;br /&gt;
&lt;br /&gt;
    m_threadFirst-&amp;gt;start();&lt;br /&gt;
    m_threadSecond-&amp;gt;start();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::setCarCoordinates(const GeoDataCoordinates &amp;amp;coord)&lt;br /&gt;
{&lt;br /&gt;
    CarWorker *worker = qobject_cast&amp;lt;CarWorker*&amp;gt;(sender());&lt;br /&gt;
    if (worker == m_firstWorker) {&lt;br /&gt;
        m_carFirst-&amp;gt;setCoordinate(coord);&lt;br /&gt;
        m_marbleWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;updateFeature(m_carFirst);&lt;br /&gt;
    } else if (worker == m_secondWorker) {&lt;br /&gt;
        m_carSecond-&amp;gt;setCoordinate(coord);&lt;br /&gt;
        m_marbleWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;updateFeature(m_carSecond);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
&lt;br /&gt;
    Window window;&lt;br /&gt;
    window.startCars();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;vehicletracking.moc&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Find your way and explore the world! ;)'''&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/DisplayGeoDataPlacemark</id>
		<title>Projects/Marble/Runners/DisplayGeoDataPlacemark</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/DisplayGeoDataPlacemark"/>
				<updated>2013-01-13T16:11:56Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/LoadingOSM|Tutorial 5 - Loading OSM files in MarbleWidget]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/VehicleTracking|Tutorial 7 - Vehicle Tracking]]|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we'll show how you can create a nice shiny '''placemark''' with an ''icon'' and associated '''geometries''' (such as ''LineStrings, LinearRings, Polygons or MultiGeometries''). We also cover basic '''styling''' of placemarks and geometries. &lt;br /&gt;
&lt;br /&gt;
[https://developers.google.com/kml/documentation/kmlreference#placemark GeoDataPlacemark] is a class which implements the features of [https://developers.google.com/kml/documentation/kmlreference#placemark KML's Placemark]. Basically, it represents an interest point (a simple point or a more complex geometry) on the map, with some information attached. &lt;br /&gt;
&lt;br /&gt;
In order to add a GeoDataPlacemark to our widget, we will use the [https://developers.google.com/kml/documentation/kmlreference#document GeoDataDocument] class, which is a container for [https://developers.google.com/kml/documentation/kmlreference#feature features] (including placemarks) and [https://developers.google.com/kml/documentation/kmlreference#feature styles]. To make the Document visible, we need to add it to Marble's TreeModel, as shown in the first example below: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QTreeView&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDataStream&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFile&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QIODevice&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataDocument.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPlacemark.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLineString.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataTreeModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv) {&lt;br /&gt;
&lt;br /&gt;
	QApplication app(argc,argv);&lt;br /&gt;
		   &lt;br /&gt;
	// Create a Marble QWidget without a parent&lt;br /&gt;
	MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
				    &lt;br /&gt;
	// Load the OpenStreetMap map&lt;br /&gt;
	mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/plain/plain.dgml&amp;quot;);		 &lt;br /&gt;
&lt;br /&gt;
	GeoDataPlacemark *place = new GeoDataPlacemark( &amp;quot;Bucharest&amp;quot; );&lt;br /&gt;
	place-&amp;gt;setCoordinate( 25.97, 44.43, 0.0, GeoDataCoordinates::Degree );&lt;br /&gt;
	place-&amp;gt;setPopulation( 1877155 );&lt;br /&gt;
	place-&amp;gt;setCountryCode ( &amp;quot;Romania&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	GeoDataDocument *document = new GeoDataDocument;&lt;br /&gt;
	document-&amp;gt;append( place );&lt;br /&gt;
&lt;br /&gt;
	// Add the document to MarbleWidget's tree model&lt;br /&gt;
	mapWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;addDocument( document );&lt;br /&gt;
	&lt;br /&gt;
	mapWidget-&amp;gt;show();&lt;br /&gt;
								  &lt;br /&gt;
	return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble&amp;lt;/tt&amp;gt; and you are going to see the placemark of our newly created Bucharest point. &lt;br /&gt;
&lt;br /&gt;
[[Image:PlacemarkTask_bis.png]]&lt;br /&gt;
&lt;br /&gt;
The data we have set for our city (Population and Country) also appear, when clicking on the placemark. &lt;br /&gt;
&lt;br /&gt;
[[Image:PlacemarkTask2.png]]&lt;br /&gt;
&lt;br /&gt;
As we said earlier in this tutorial, it is possible to add more complex geometry to a placemark, meaning objects belonging to [https://developers.google.com/kml/documentation/kmlreference#geometry GeoDataGeometry] or to one of the classes which inherit it. &lt;br /&gt;
&lt;br /&gt;
[https://developers.google.com/kml/documentation/kmlreference#style Styles] are another important property of placemarks. They are used in order to customize the appearance of the placemark on the map (e.g. by adding an icon). Geometries such as LineStrings, LinearRings or Polygons can be styled as well: You can change properties such as the pen color, the brush color and the line width.  &lt;br /&gt;
&lt;br /&gt;
The next example shows how more complex geometry and styles can be added, by creating Bucharest's city boundary, and by adding an interest point (touristic objective) with a photo replacing the regular  placemark icon. (in order for the example to work properly you will need to download the [http://techbase.kde.org/File:Bucharest_small.jpg icon] and place it in the same folder as the source code)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QTreeView&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/GeoDataDocument.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataCoordinates.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPlacemark.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLineString.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLinearRing.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataTreeModel.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataStyle.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataIconStyle.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataLineStyle.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/GeoDataPolyStyle.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
void addPoints( GeoDataLinearRing &amp;amp;linearRing ) {&lt;br /&gt;
&lt;br /&gt;
	linearRing &amp;lt;&amp;lt; GeoDataCoordinates(25.97226722704463, 44.43497647488007, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.04711276456992, 44.4420741223712, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(25.99712510557899, 44.48015825036597, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.11268978668501, 44.53902366720936, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.12777496065434, 44.48972441010599, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.17769825773425, 44.47685689461117, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.16489863910029, 44.45366647920105, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.23394105442375, 44.43247765101769, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.23388161223319, 44.40720014793351, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.18689640043445, 44.40683215952335, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(26.1462530009004, 44.36252655873379, 0, GeoDataCoordinates::Degree )&lt;br /&gt;
					&amp;lt;&amp;lt; GeoDataCoordinates(25.97226722704463, 44.43497647488007, 0, GeoDataCoordinates::Degree );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void createStyleBucharest( GeoDataStyle &amp;amp;style ) {&lt;br /&gt;
	GeoDataLineStyle lineStyle( QColor( 255, 0, 0, 90 ) );&lt;br /&gt;
	lineStyle.setWidth ( 8 );&lt;br /&gt;
&lt;br /&gt;
	GeoDataPolyStyle polyStyle( QColor( 255, 0, 0, 40 ) );&lt;br /&gt;
	polyStyle.setFill( true );&lt;br /&gt;
&lt;br /&gt;
	style.setLineStyle( lineStyle );&lt;br /&gt;
	style.setPolyStyle( polyStyle );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void createStyleArch( GeoDataStyle &amp;amp;style ) {&lt;br /&gt;
	GeoDataIconStyle iconStyle;&lt;br /&gt;
	iconStyle.setIconPath( &amp;quot;bucharest_small.jpg&amp;quot; );&lt;br /&gt;
	style.setIconStyle( iconStyle );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv) {&lt;br /&gt;
&lt;br /&gt;
	QApplication app(argc,argv);&lt;br /&gt;
		   &lt;br /&gt;
	// Create a Marble QWidget without a parent&lt;br /&gt;
	MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
				    &lt;br /&gt;
	// Load the OpenStreetMap map&lt;br /&gt;
	mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);		 &lt;br /&gt;
&lt;br /&gt;
	//Create the Linear Ring (polygon) representing Bucharest's boundaries and include it in a placemark&lt;br /&gt;
	GeoDataLinearRing Bucharest;&lt;br /&gt;
	addPoints( Bucharest );&lt;br /&gt;
&lt;br /&gt;
	GeoDataPlacemark placemarkBucharest;&lt;br /&gt;
	placemarkBucharest.setGeometry( &amp;amp;Bucharest );&lt;br /&gt;
&lt;br /&gt;
	//Create the placemark representing the Arch of Triumph&lt;br /&gt;
	GeoDataPlacemark placemarkArch( &amp;quot;Arch of Triumph&amp;quot; );&lt;br /&gt;
	placemarkArch.setCoordinate( 26.0783, 44.4671, 0, GeoDataCoordinates::Degree );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	//Add styles (icons, colors, etc.) to the two placemarks&lt;br /&gt;
	GeoDataStyle styleBucharest, styleArch;&lt;br /&gt;
&lt;br /&gt;
	createStyleBucharest( styleBucharest );&lt;br /&gt;
	placemarkBucharest.setStyle( &amp;amp;styleBucharest );&lt;br /&gt;
&lt;br /&gt;
	createStyleArch ( styleArch );&lt;br /&gt;
	placemarkArch.setStyle( &amp;amp;styleArch );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	//Create the document and add the two placemarks (the point representing the Arch of Triumph and the polygon with Bucharest's boundaries)&lt;br /&gt;
	GeoDataDocument *document = new GeoDataDocument;&lt;br /&gt;
	document-&amp;gt;append( &amp;amp;placemarkBucharest );&lt;br /&gt;
	document-&amp;gt;append( &amp;amp;placemarkArch );&lt;br /&gt;
&lt;br /&gt;
	// Add the document to MarbleWidget's tree model&lt;br /&gt;
	mapWidget-&amp;gt;model()-&amp;gt;treeModel()-&amp;gt;addDocument( document );&lt;br /&gt;
&lt;br /&gt;
        // Center the map on Bucharest and set the zoom &lt;br /&gt;
	mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 26.0783, 44.4671, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
	mapWidget-&amp;gt;zoomView( 2400 );&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	mapWidget-&amp;gt;show();&lt;br /&gt;
								  &lt;br /&gt;
	return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the expected outcome after compiling, running and zooming into Bucharest: &lt;br /&gt;
&lt;br /&gt;
[[Image:Bucharest.png]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM</id>
		<title>Projects/Marble/Runners/LoadingOSM</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM"/>
				<updated>2013-01-13T16:05:13Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Loading OSM files in MarbleWidget|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/LoadingKML|Tutorial 4 - Changing basic map properties]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/DisplayGeoDataPlacemark|Tutorial 6 - Displaying places the proper way(via GeoDataDocument)]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Exporting OSM =&lt;br /&gt;
Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org OpenStreetMaps] by clicking the export button as shown below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial.png| 500px| center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Loading OSM files into a Marble Widget =&lt;br /&gt;
&lt;br /&gt;
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 open a .osm file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.osm&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 77.5674, 12.9782, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 3000 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.osm&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your OSM file. For example, download and unpack [http://techbase.kde.org/images.techbase/5/51/Map.tar.gz Map.osm] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bangalore city junction), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble map.osm&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:OsmTutorial1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The placemarks on the map are clickable and trigger a dialog. The screenshot below is of the dialog of Bangalore City Station triggered by clicking it on the map.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial2.png|600px]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM</id>
		<title>Projects/Marble/Runners/LoadingOSM</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM"/>
				<updated>2013-01-13T16:02:22Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Loading OSM files in MarbleWidget|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/Runners/LoadingKML|Tutorial 4 - Changing basic map properties]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/DisplayGeoDataPlacemarks|Tutorial 6 - Displaying places the proper way(via GeoDataDocument)]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Exporting OSM =&lt;br /&gt;
Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org OpenStreetMaps] by clicking the export button as shown below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial.png| 500px| center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Loading OSM files into a Marble Widget =&lt;br /&gt;
&lt;br /&gt;
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 open a .osm file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.osm&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 77.5674, 12.9782, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 3000 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.osm&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your OSM file. For example, download and unpack [http://techbase.kde.org/images.techbase/5/51/Map.tar.gz Map.osm] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bangalore city junction), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble map.osm&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:OsmTutorial1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The placemarks on the map are clickable and trigger a dialog. The screenshot below is of the dialog of Bangalore City Station triggered by clicking it on the map.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial2.png|600px]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingKML</id>
		<title>Projects/Marble/Runners/LoadingKML</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingKML"/>
				<updated>2013-01-13T16:00:03Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/MarbleSignalsSlots|Tutorial 3 - Basic Interactions with MarbleWidget]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/LoadingOSM|Tutorial 5 - Loading OSM files into MarbleWidget]]|}}&lt;br /&gt;
&lt;br /&gt;
== Loading KML files into a Marble Widget ==&lt;br /&gt;
&lt;br /&gt;
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 open a .kml (or .gpx, .osm, ...) file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.kml&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 26.0783, 44.4671, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 2200 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.kml&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your KML file. For example, download and unpack [http://techbase.kde.org/images.techbase/b/bd/Bucharest.kml.gz Bucharest.kml] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bucharest's city boundaries), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble bucharest.kml&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
[[Image:LoadKML.png]]&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
note|&lt;br /&gt;
The same method works for loading other file types too, like OpenStreetMap (.osm), GPX and Shapefiles (.shp). &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingKML</id>
		<title>Projects/Marble/Runners/LoadingKML</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingKML"/>
				<updated>2013-01-13T15:59:33Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Search|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/MarbleSignalSlots|Tutorial 3 - Basic Interactions with MarbleWidget]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/LoadingOSM|Tutorial 5 - Loading OSM files into MarbleWidget]]|}}&lt;br /&gt;
&lt;br /&gt;
== Loading KML files into a Marble Widget ==&lt;br /&gt;
&lt;br /&gt;
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 open a .kml (or .gpx, .osm, ...) file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.kml&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 26.0783, 44.4671, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 2200 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.kml&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your KML file. For example, download and unpack [http://techbase.kde.org/images.techbase/b/bd/Bucharest.kml.gz Bucharest.kml] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bucharest's city boundaries), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble bucharest.kml&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
[[Image:LoadKML.png]]&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
note|&lt;br /&gt;
The same method works for loading other file types too, like OpenStreetMap (.osm), GPX and Shapefiles (.shp). &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Template:TutorialBrowser</id>
		<title>Template:TutorialBrowser</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Template:TutorialBrowser"/>
				<updated>2013-01-13T15:57:22Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;rbroundbox&amp;quot; style=&amp;quot;width:100%;&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;div class=&amp;quot;rbtopwrap&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;rbtop&amp;quot;&amp;gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;{{{name}}}&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;div class=&amp;quot;rbcontent&amp;quot;&amp;gt;&lt;br /&gt;
{|style=&amp;quot;width:100%; background:#dadde0;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| width=10% align=right valign=top | '''Tutorial Series'''&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
| {{{series|n/a}}}&lt;br /&gt;
|-&lt;br /&gt;
| align=right valign=top | '''Previous'''&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
| {{{pre|None}}}&lt;br /&gt;
|-&lt;br /&gt;
| align=right valign=top | '''What's&amp;amp;nbsp;Next'''&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
| {{{next|n/a}}}&lt;br /&gt;
|-&lt;br /&gt;
| align=right valign=top | '''Further&amp;amp;nbsp;Reading'''&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
|{{{reading|n/a}}}&lt;br /&gt;
|}&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;div class=&amp;quot;rbbot&amp;quot;&amp;gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Category:Tutorial]]&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recommended Usage==&lt;br /&gt;
To keep some sort of consistency to our wiki: if you're going to use this template, put it at the very top of the page, above any ==headers== (that will also place it above the page contents section) so readers can find the relevant info as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
Also note that this template will automatically add the page to the [[:Category:Tutorial|tutorial category]] so there's no need to do that yourself.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Function&lt;br /&gt;
|-&lt;br /&gt;
| '''series''' || The name of the tutorial series this belongs to.&lt;br /&gt;
|-&lt;br /&gt;
| '''name''' || Verbose(ish) name of this tutorial. Kind of a super short abstract.&lt;br /&gt;
|-&lt;br /&gt;
| '''pre''' || Previous tutorial (try to order them sensibly and make sure they're links!).&lt;br /&gt;
|-&lt;br /&gt;
| '''next''' || A tutorial or two which logically follow on from this (in the same series). Or a tutorial or two which make sense to move onto next.&lt;br /&gt;
|-&lt;br /&gt;
| '''reading''' || Further reading about the subject matter covered in the tutorial&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Template]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/MarbleSignalsSlots</id>
		<title>Projects/Marble/MarbleSignalsSlots</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/MarbleSignalsSlots"/>
				<updated>2013-01-13T15:56:33Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Basic interaction with MarbleWidget|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/MarbleMarbleWidget|Tutorial 2 - Changing basic map properties]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runners/LoadingKML|Tutorial 4 - Loading KML files into MarbleWidget]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a window with controls ==&lt;br /&gt;
We'd like to add other widgets to our Marble window: A '''zoom slider''' and a '''label''' that shows the current mouse position in '''geodetic''' coordinates: ''longitude'' and ''latitude''.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this we need to create a vertical layout. Once we are done we add the slider and the label that we created to the layout. Also we zoom the globe to the slider's default value using the [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#d49d8ab0be0721c579bb511bdda45829 MarbleWidget::zoomView(int)] method.&lt;br /&gt;
&lt;br /&gt;
We want to center our globe onto South America. So we create a new [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html GeoDataCoordinates] object that takes the longitude and the latitude as a parameter and we call [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#7cda9942ead26d60c89a7b54a073a2fd MarbleWidget::centerOn]. &lt;br /&gt;
&lt;br /&gt;
As you might have realized already GeoDataCoordinates is the geodetic &amp;quot;sister&amp;quot; of [http://doc.trolltech.com/qapplication.html QPoint]. They share a very similar API. Additionally GeoDataCoordinates features a nice set of string conversion methods ([http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html#ce27e6f714e21be067995c2cf96544d6 GeoDataCoordinates::fromString()], [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html#558b72384563190dc2ce119a1f75de86 GeoDataCoordinates::lonToString()] and  [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html#558b72384563190dc2ce119a1f75de86 GeoDataCoordinates::latToString()]). They are used in various places inside Marble such as the signal [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#0869df8f4666014aff93d9ba1c130bc3 MarbleWidget::mouseMoveGeoPosition(const QString&amp;amp;) ].&lt;br /&gt;
&lt;br /&gt;
Finally we connect the [http://doc.trolltech.com/signalsandslots.html signals and slots] that MarbleWidget offers to the signals and slots of the slider and the label:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui/QLayout&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QSlider&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QLabel&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    QWidget *window = new QWidget;&lt;br /&gt;
&lt;br /&gt;
    // Create a Marble QWidget without a parent&lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
&lt;br /&gt;
    // Load the Plain map&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/plain/plain.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Hide the FloatItems: OverviewMap, ScaleBar and Compass&lt;br /&gt;
    mapWidget-&amp;gt;setShowOverviewMap(false);&lt;br /&gt;
    mapWidget-&amp;gt;setShowScaleBar(false);&lt;br /&gt;
    mapWidget-&amp;gt;setShowCompass(false);&lt;br /&gt;
    &lt;br /&gt;
    // Create a horizontal zoom slider and set the default zoom&lt;br /&gt;
    QSlider * zoomSlider = new QSlider(Qt::Horizontal);&lt;br /&gt;
    zoomSlider-&amp;gt;setMinimum( 1000 );&lt;br /&gt;
    zoomSlider-&amp;gt;setMaximum( 2400 );&lt;br /&gt;
    &lt;br /&gt;
    mapWidget-&amp;gt;zoomView( zoomSlider-&amp;gt;value() );&lt;br /&gt;
&lt;br /&gt;
    // Create a label to show the geodetic position&lt;br /&gt;
    QLabel * positionLabel = new QLabel();&lt;br /&gt;
    positionLabel-&amp;gt;setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );&lt;br /&gt;
&lt;br /&gt;
    // Add all widgets to the vertical layout.&lt;br /&gt;
    QVBoxLayout *layout = new QVBoxLayout;&lt;br /&gt;
    layout-&amp;gt;addWidget(mapWidget);&lt;br /&gt;
    layout-&amp;gt;addWidget(zoomSlider);&lt;br /&gt;
    layout-&amp;gt;addWidget(positionLabel);&lt;br /&gt;
&lt;br /&gt;
    // Center the map onto a given position&lt;br /&gt;
    GeoDataCoordinates home(-60.0, -10.0, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    mapWidget-&amp;gt;centerOn(home);&lt;br /&gt;
    &lt;br /&gt;
    // Connect the map widget to the position label.&lt;br /&gt;
    QObject::connect( mapWidget, SIGNAL( mouseMoveGeoPosition( QString ) ),&lt;br /&gt;
                      positionLabel, SLOT( setText( QString ) ) );&lt;br /&gt;
&lt;br /&gt;
    // Connect the zoom slider to the map widget and vice versa.&lt;br /&gt;
    QObject::connect( zoomSlider, SIGNAL( valueChanged(int) ),&lt;br /&gt;
                      mapWidget, SLOT( zoomView(int) ) );&lt;br /&gt;
    QObject::connect( mapWidget, SIGNAL( zoomChanged(int) ),&lt;br /&gt;
                      zoomSlider, SLOT( setValue(int) ) );&lt;br /&gt;
&lt;br /&gt;
    window-&amp;gt;setLayout(layout);&lt;br /&gt;
    window-&amp;gt;resize( 400, 300 );&lt;br /&gt;
&lt;br /&gt;
    window-&amp;gt;show();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the code above as &amp;lt;tt&amp;gt;marble_control.cpp&amp;lt;/tt&amp;gt; and compile it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o marble_control marble_control.cpp -lmarblewidget -lQtGui&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./marble_control&amp;lt;/tt&amp;gt; and you end up with a map application that displays our globe with a zoom slider below: &lt;br /&gt;
&lt;br /&gt;
[[Image:Marble_control.png]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/MarbleSignalsSlots</id>
		<title>Projects/Marble/MarbleSignalsSlots</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/MarbleSignalsSlots"/>
				<updated>2013-01-13T15:54:38Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
&lt;br /&gt;
series=Marble C++ Tutorial|&lt;br /&gt;
&lt;br /&gt;
name=Basic interaction with MarbleWidget|&lt;br /&gt;
&lt;br /&gt;
pre=[[Projects/Marble/MarbleMarbleWidget|Tutorial 2 - Changing basic map properties]]|&lt;br /&gt;
&lt;br /&gt;
next=[[Projects/Marble/Runner/LoadingKML|Tutorial 4 - Loading KML files into MarbleWidget]]| &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a window with controls ==&lt;br /&gt;
We'd like to add other widgets to our Marble window: A '''zoom slider''' and a '''label''' that shows the current mouse position in '''geodetic''' coordinates: ''longitude'' and ''latitude''.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this we need to create a vertical layout. Once we are done we add the slider and the label that we created to the layout. Also we zoom the globe to the slider's default value using the [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#d49d8ab0be0721c579bb511bdda45829 MarbleWidget::zoomView(int)] method.&lt;br /&gt;
&lt;br /&gt;
We want to center our globe onto South America. So we create a new [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html GeoDataCoordinates] object that takes the longitude and the latitude as a parameter and we call [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#7cda9942ead26d60c89a7b54a073a2fd MarbleWidget::centerOn]. &lt;br /&gt;
&lt;br /&gt;
As you might have realized already GeoDataCoordinates is the geodetic &amp;quot;sister&amp;quot; of [http://doc.trolltech.com/qapplication.html QPoint]. They share a very similar API. Additionally GeoDataCoordinates features a nice set of string conversion methods ([http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html#ce27e6f714e21be067995c2cf96544d6 GeoDataCoordinates::fromString()], [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html#558b72384563190dc2ce119a1f75de86 GeoDataCoordinates::lonToString()] and  [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataCoordinates.html#558b72384563190dc2ce119a1f75de86 GeoDataCoordinates::latToString()]). They are used in various places inside Marble such as the signal [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidget.html#0869df8f4666014aff93d9ba1c130bc3 MarbleWidget::mouseMoveGeoPosition(const QString&amp;amp;) ].&lt;br /&gt;
&lt;br /&gt;
Finally we connect the [http://doc.trolltech.com/signalsandslots.html signals and slots] that MarbleWidget offers to the signals and slots of the slider and the label:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui/QLayout&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QSlider&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QLabel&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace Marble;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
    QWidget *window = new QWidget;&lt;br /&gt;
&lt;br /&gt;
    // Create a Marble QWidget without a parent&lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
&lt;br /&gt;
    // Load the Plain map&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/plain/plain.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Hide the FloatItems: OverviewMap, ScaleBar and Compass&lt;br /&gt;
    mapWidget-&amp;gt;setShowOverviewMap(false);&lt;br /&gt;
    mapWidget-&amp;gt;setShowScaleBar(false);&lt;br /&gt;
    mapWidget-&amp;gt;setShowCompass(false);&lt;br /&gt;
    &lt;br /&gt;
    // Create a horizontal zoom slider and set the default zoom&lt;br /&gt;
    QSlider * zoomSlider = new QSlider(Qt::Horizontal);&lt;br /&gt;
    zoomSlider-&amp;gt;setMinimum( 1000 );&lt;br /&gt;
    zoomSlider-&amp;gt;setMaximum( 2400 );&lt;br /&gt;
    &lt;br /&gt;
    mapWidget-&amp;gt;zoomView( zoomSlider-&amp;gt;value() );&lt;br /&gt;
&lt;br /&gt;
    // Create a label to show the geodetic position&lt;br /&gt;
    QLabel * positionLabel = new QLabel();&lt;br /&gt;
    positionLabel-&amp;gt;setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );&lt;br /&gt;
&lt;br /&gt;
    // Add all widgets to the vertical layout.&lt;br /&gt;
    QVBoxLayout *layout = new QVBoxLayout;&lt;br /&gt;
    layout-&amp;gt;addWidget(mapWidget);&lt;br /&gt;
    layout-&amp;gt;addWidget(zoomSlider);&lt;br /&gt;
    layout-&amp;gt;addWidget(positionLabel);&lt;br /&gt;
&lt;br /&gt;
    // Center the map onto a given position&lt;br /&gt;
    GeoDataCoordinates home(-60.0, -10.0, 0.0, GeoDataCoordinates::Degree);&lt;br /&gt;
    mapWidget-&amp;gt;centerOn(home);&lt;br /&gt;
    &lt;br /&gt;
    // Connect the map widget to the position label.&lt;br /&gt;
    QObject::connect( mapWidget, SIGNAL( mouseMoveGeoPosition( QString ) ),&lt;br /&gt;
                      positionLabel, SLOT( setText( QString ) ) );&lt;br /&gt;
&lt;br /&gt;
    // Connect the zoom slider to the map widget and vice versa.&lt;br /&gt;
    QObject::connect( zoomSlider, SIGNAL( valueChanged(int) ),&lt;br /&gt;
                      mapWidget, SLOT( zoomView(int) ) );&lt;br /&gt;
    QObject::connect( mapWidget, SIGNAL( zoomChanged(int) ),&lt;br /&gt;
                      zoomSlider, SLOT( setValue(int) ) );&lt;br /&gt;
&lt;br /&gt;
    window-&amp;gt;setLayout(layout);&lt;br /&gt;
    window-&amp;gt;resize( 400, 300 );&lt;br /&gt;
&lt;br /&gt;
    window-&amp;gt;show();&lt;br /&gt;
&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the code above as &amp;lt;tt&amp;gt;marble_control.cpp&amp;lt;/tt&amp;gt; and compile it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o marble_control marble_control.cpp -lmarblewidget -lQtGui&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./marble_control&amp;lt;/tt&amp;gt; and you end up with a map application that displays our globe with a zoom slider below: &lt;br /&gt;
&lt;br /&gt;
[[Image:Marble_control.png]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM</id>
		<title>Projects/Marble/Runners/LoadingOSM</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM"/>
				<updated>2013-01-08T22:45:24Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: /* Loading OSM files into a Marble Widget */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Exporting OSM =&lt;br /&gt;
Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org OpenStreetMaps] by clicking the export button as shown below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial.png| 500px| center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Loading OSM files into a Marble Widget =&lt;br /&gt;
&lt;br /&gt;
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 open a .osm file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.osm&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 77.5674, 12.9782, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 3000 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.osm&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your OSM file. For example, download and unpack [http://techbase.kde.org/images.techbase/5/51/Map.tar.gz Map.osm] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bangalore city junction), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble map.osm&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:OsmTutorial1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The placemarks on the map are clickable and trigger a dialog. The screenshot below is of the dialog of Bangalore City Station triggered by clicking it on the map.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial2.png|600px]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM</id>
		<title>Projects/Marble/Runners/LoadingOSM</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM"/>
				<updated>2013-01-08T22:40:02Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: /* Loading OSM files into a Marble Widget */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Exporting OSM =&lt;br /&gt;
Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org OpenStreetMaps] by clicking the export button as shown below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial.png| 500px| center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Loading OSM files into a Marble Widget =&lt;br /&gt;
&lt;br /&gt;
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 open a .osm file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.osm&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 77.5674, 12.9782, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 3000 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.osm&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your OSM file. For example, download and unpack [http://techbase.kde.org/images.techbase/5/51/Map.tar.gz Map.osm] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bangalore city junction), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble map.osm&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:OsmTutorial1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The placemarks on the map are clickable and triggers a dialog. The Screenshot below is of the dialog of Bangalore City Station triggered by clicking it on the map.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial2.png|600px]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM</id>
		<title>Projects/Marble/Runners/LoadingOSM</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM"/>
				<updated>2013-01-08T22:36:24Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Exporting OSM =&lt;br /&gt;
Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org OpenStreetMaps] by clicking the export button as shown below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial.png| 500px| center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Loading OSM files into a Marble Widget =&lt;br /&gt;
&lt;br /&gt;
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 open a .osm file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.osm&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 77.5674, 12.9782, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 3000 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.osm&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your OSM file. For example, download and unpack [http://techbase.kde.org/images.techbase/5/51/Map.tar.gz Map.osm] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bangalore city junction), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble map.osm&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:OsmTutorial1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The placemarks on the map are clickable and triggers a dialog. The Screenshot below is of the dialog for Bangalore City Station triggered by clicking it on the map.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial2.png|600px]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM</id>
		<title>Projects/Marble/Runners/LoadingOSM</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM"/>
				<updated>2013-01-08T22:34:35Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: Created page with &amp;quot;= Exporting OSM = Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org Op...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Exporting OSM =&lt;br /&gt;
Osm files can be used for creating small street maps or can be scaled to store streets worldwide. OSM files can be exported from [http://openstreetmap.org OpenStreetMaps] by clicking the export button as shown below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial.png| 500px| center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Loading OSM files into a Marble Widget =&lt;br /&gt;
&lt;br /&gt;
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 open a .osm file and display it into the Marble Widget. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QDebug&amp;gt;&lt;br /&gt;
#include &amp;lt;QtCore/QFileInfo&amp;gt;&lt;br /&gt;
#include &amp;lt;QtGui/QApplication&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;marble/MarbleWidget.h&amp;gt;&lt;br /&gt;
#include &amp;lt;marble/MarbleModel.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
using namespace Marble;&lt;br /&gt;
 &lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc,argv);&lt;br /&gt;
 &lt;br /&gt;
    QFileInfo inputFile( app.arguments().last() );&lt;br /&gt;
    if ( app.arguments().size() &amp;lt; 2 || !inputFile.exists() ) {&lt;br /&gt;
        qWarning() &amp;lt;&amp;lt; &amp;quot;Usage: &amp;quot; &amp;lt;&amp;lt; app.arguments().first() &amp;lt;&amp;lt; &amp;quot;file.osm&amp;quot;;&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    MarbleWidget *mapWidget = new MarbleWidget();&lt;br /&gt;
    mapWidget-&amp;gt;setMapThemeId(&amp;quot;earth/openstreetmap/openstreetmap.dgml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;centerOn( GeoDataCoordinates( 77.5674, 12.9782, 0, GeoDataCoordinates::Degree ) );&lt;br /&gt;
    mapWidget-&amp;gt;zoomView( 3000 );&lt;br /&gt;
&lt;br /&gt;
    mapWidget-&amp;gt;model()-&amp;gt;addGeoDataFile( inputFile.absoluteFilePath() );&lt;br /&gt;
	&lt;br /&gt;
    mapWidget-&amp;gt;show();&lt;br /&gt;
 &lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code above into a text editor. Then save it as &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; and compile it by entering the following command on the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 g++ -I /usr/include/qt4/ -o my_marble my_marble.cpp -lmarblewidget -lQtGui -lQtCore&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If things go fine, execute &amp;lt;tt&amp;gt;./my_marble some-file.osm&amp;lt;/tt&amp;gt; and you get a Marble Widget which displays your OSM file. For example, download and unpack [http://techbase.kde.org/images.techbase/5/51/Map.tar.gz Map.osm] (a [http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoDataLinearRing.html LinearRing] representing Bangalore city junction), place it in the same folder as your &amp;lt;tt&amp;gt;my_marble.cpp&amp;lt;/tt&amp;gt; file and run &amp;lt;tt&amp;gt;./my_marble map.osm&amp;lt;/tt&amp;gt;. The result should be similar to this: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:OsmTutorial1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The placemarks are clickable and triggers a dialog. The Screenshot below is of the dialog for Bangalore City Station triggered by clicking it on the map.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OsmTutorial2.png|600px]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
If you provide maps in your application please check the '''Terms of Use''' of the map material. The map material that is shipped with Marble is licensed ''in the spirit of Free Software''. This usually means at least that the authors should be credited and that the license is mentioned.&lt;br /&gt;
E.g. for ''OpenStreetMap'' the license is [http://creativecommons.org/license/by-sa/2.0 CC-BY-SA]. Other map data shipped with Marble is either public domain or licensed in the spirit of the BSD license.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/File:OsmTutorial2.png</id>
		<title>File:OsmTutorial2.png</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/File:OsmTutorial2.png"/>
				<updated>2013-01-08T22:30:03Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/File:OsmTutorial.png</id>
		<title>File:OsmTutorial.png</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/File:OsmTutorial.png"/>
				<updated>2013-01-08T22:18:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/File:OsmTutorial1.png</id>
		<title>File:OsmTutorial1.png</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/File:OsmTutorial1.png"/>
				<updated>2013-01-08T22:07:15Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/File:Map.tar.gz</id>
		<title>File:Map.tar.gz</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/File:Map.tar.gz"/>
				<updated>2013-01-08T21:07:46Z</updated>
		
		<summary type="html">&lt;p&gt;Mayankmadan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mayankmadan</name></author>	</entry>

	</feed>