Difference between revisions of "Development/Tutorials/MarbleWidget"

Jump to: navigation, search
(added line to explain the setting of the default theme.)
m (Text replace - "</code>" to "</syntaxhighlight>")
 
(One intermediate revision by one user not shown)
Line 8: Line 8:
 
To be able to #include and to link Marble in your project, you have to add the Marble headers and library in your CMakeLists.txt file:
 
To be able to #include and to link Marble in your project, you have to add the Marble headers and library in your CMakeLists.txt file:
  
<code>
+
<syntaxhighlight lang="text">
 
INCLUDE_DIRECTORIES(
 
INCLUDE_DIRECTORIES(
 
...yourDirectories
 
...yourDirectories
Line 14: Line 14:
  
 
TARGET_LINK_LIBRARIES(yourProject ${QT_LIBRARIES}; marblewidget)
 
TARGET_LINK_LIBRARIES(yourProject ${QT_LIBRARIES}; marblewidget)
</code>
+
</syntaxhighlight>
  
 
To actually use the widget, it's quite easy. I had a pointer
 
To actually use the widget, it's quite easy. I had a pointer
<code>
+
<syntaxhighlight lang="text">
 
MarbleWidget *mwidget;
 
MarbleWidget *mwidget;
</code>
+
</syntaxhighlight>
 
and used it like any other widget, e.g:
 
and used it like any other widget, e.g:
<code>
+
<syntaxhighlight lang="text">
 
mwidget->show();
 
mwidget->show();
 
mwidget->moveLeft();
 
mwidget->moveLeft();
</code>
+
</syntaxhighlight>
  
 
You can get the default theme (map) up and running as a widget with the following:
 
You can get the default theme (map) up and running as a widget with the following:
<code>
+
<syntaxhighlight lang="text">
 
mwidget = new MarbleWidget;
 
mwidget = new MarbleWidget;
 
mwidget->setMapThemeId("earth/srtm/srtm.dgml");
 
mwidget->setMapThemeId("earth/srtm/srtm.dgml");
</code>
+
</syntaxhighlight>
 
For a screenshot of what I did, see http://www.kdedevelopers.org/node/3206 (it's the one with the satellites) - thanks tackat.
 
For a screenshot of what I did, see http://www.kdedevelopers.org/node/3206 (it's the one with the satellites) - thanks tackat.
 
If you want to have to source of my project or want further information, drop a line and I'll gladly try to help: claudiu dot covaci at gmail dot com
 
If you want to have to source of my project or want further information, drop a line and I'll gladly try to help: claudiu dot covaci at gmail dot com
  
 
Have fun!
 
Have fun!

Latest revision as of 21:53, 29 June 2011

Using MarbleWidget in your project.

This is a small HOWTO describing how I used Marble in my university project. Some facts: - The build environment I used was CMake - I used the latest Marble SVN version (because it had the latest features)

To be able to #include and to link Marble in your project, you have to add the Marble headers and library in your CMakeLists.txt file:

INCLUDE_DIRECTORIES(
...yourDirectories
/usr/local/include/marble) #or whatever the path to your Marble installation(!)
 
TARGET_LINK_LIBRARIES(yourProject ${QT_LIBRARIES}; marblewidget)

To actually use the widget, it's quite easy. I had a pointer

MarbleWidget *mwidget;

and used it like any other widget, e.g:

mwidget->show();
mwidget->moveLeft();

You can get the default theme (map) up and running as a widget with the following:

mwidget = new MarbleWidget;
mwidget->setMapThemeId("earth/srtm/srtm.dgml");

For a screenshot of what I did, see http://www.kdedevelopers.org/node/3206 (it's the one with the satellites) - thanks tackat. If you want to have to source of my project or want further information, drop a line and I'll gladly try to help: claudiu dot covaci at gmail dot com

Have fun!


This page was last modified on 29 June 2011, at 21:53. This page has been accessed 7,849 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal