[Marble-devel] Beginner questions
Dennis Nienhüser
earthwings at gentoo.org
Sun Nov 18 20:23:34 UTC 2012
Hi Amadeus,
On 18.11.2012 13:49, Hein, Amadeus wrote:
> Hello marble-devs!
>
> I'm in a small team developing a (hobby) game where we need to display
> a world globe. Marble is a little (OK, /a lot/) more advanced than we
> need - but I think it looks great, and seems to be fairly easy to use.
> I compiled it for Windows (QT) and linked to it in our C++ project,
> and it already looks nice!
>
Sounds great :-)
Feel free to add it to our little gallery at [1].
> I want to investigate a few points that you hopefully can help me with
> (as a newbie at Marble).
>
> 1. I want to have next to no "Marble functionality" left on the map.
> I've created a new map that only shows the globe (with no
> data/landmarks etc). Now I also want to get rid of the menu that
> displays when you left click for a while (co-ordinates appear and
> you can select to copy them or display their details). Furthermore
> I would like to override the right click menu (add Measure Point,
> etc) with my own functionality - how would I do that?
>
Use something like
marbleWidget->inputHandler()->setMouseButtonPopupEnabled(
Qt::LeftButton, false );
marbleWidget->inputHandler()->setMouseButtonPopupEnabled(
Qt::RightButton, true );
Then add your own context menu.
> 1. My MarbleWidget is looking for map data in my appData folder
> (.marble). I would like to redirect it to look at our own folder
> where we store the rest of the game data. How can I do that?
>
Call MarbleDirs::setMarbleDataPath at an early point, see e.g.
src/QtMainWindow.cpp for an example where that is used.
> 1. Is it possible to set the maximum zoom so that you cannot zoom too
> close to the map? We plan to just use one map skin, and it looks
> pixely when you get too close. On a similar note - can I also set
> the minimum zoom, so you won't get too far away, also?
>
You can set it in the .dgml file that describes the map theme:
<zoom>
<minimum> 900 </minimum>
<maximum> 3500 </maximum>
</zoom>
It's also possible to change that after the .dgml files are loaded if
that is needed for some reason. Note that implementation wise the
min/max zoom restriction is enforced in the user interface (e.g. in the
navigation tab or via the mouse wheel), but the methods in the code (at
least some) let you override it.
> 1. Is there any examples on how to draw a point on the map (for
> example a city) and catching an event when the user clicks on it
> to display something?
>
The routing layer (src/lib/routing/RoutingLayer.cpp) does that for
example. Basically add a new Layer (derive from LayerInterface, see
examples/cpp/custom-layers/), paint the circle using GeoPainter and take
a note where it is displayed on the screen, intercept events and react
to them when they happen on top of the painted region.
We plan to simplify that vastly, but it's not done yet.
> 1.
>
> I hope this is the right place for these questions.
> Thank you in advance for your time, and for this awesome project!
>
Sure is :-)
Regards,
Dennis
[1] http://techbase.kde.org/Projects/Marble/MarbleUsedBy
> Cheers,
> Amadeus
>
More information about the Marble-devel
mailing list