KDE 4.7 PyKDE API Reference

- KDE's Python API

# MarbleMap Class Reference

`from PyKDE4.marble import *`

Inherits: QObject
Namespace: Marble

## Detailed Description

A class that can paint a view of the earth.

FIXME: Change this description when we are done.

This class can paint a view of the earth or any other globe, depending on which dataset is used. It can be used to show the globe in a widget like MarbleWidget does, or on any other QPaintDevice.

The projection and other view parameters that control how MarbleMap paints the map is given through the class ViewParams. If the programmer wants to allow the user to control the map, he/she has to provide a way for the user to interact with it. An example of this can be seen in the class MarbleWidgetInputHandler, that lets the user control a MarbleWidget that uses MarbleMap internally.

The MarbleMap needs to be provided with a data model to work. This model is contained in the MarbleModel class. The widget can also construct its own model if none is given to the constructor. This data model contains 3 separate datatypes: tiles which provide the background, vectors which provide things like country borders and coastlines and placemarks which can show points of interest, such as cities, mountain tops or the poles.

See also:
  MarbleWidget

See also:
  MarbleControlBox

See also:
  MarbleModel

## Signals
| framesPerSecond (float fps)
| mouseClickGeoPosition (float lon, float lat, Marble.GeoDataCoordinates.Unit a2)
| mouseMoveGeoPosition (QString a0)
| pluginSettingsChanged ()
| projectionChanged (Marble.Projection a0)
| radiusChanged (int radius)
| renderPluginInitialized (Marble.RenderPlugin renderPlugin)
| repaintNeeded (QRegion dirtyRegion=QRegion())
| themeChanged (QString theme)
| tileLevelChanged (int level)
| visibleLatLonAltBoxChanged (Marble.GeoDataLatLonAltBox visibleLatLonAltBox)
## Methods
| __init__ (self)
| __init__ (self, Marble.MarbleModel model)
| addLayer (self, Marble.LayerInterface layer)
float | centerLatitude (self)
float | centerLongitude (self)
| centerOn (self, float lon, float lat)
| clearVolatileTileCache (self)
| customPaint (self, Marble.GeoPainter painter)
[Marble.AbstractDataPlugin] | dataPlugins (self)
Marble.AngleUnit | defaultAngleUnit (self)
QFont | defaultFont (self)
| downloadRegion (self, QString sourceDir, QVector a1)
Marble.AbstractFloatItem | floatItem (self, QString nameId)
[Marble.AbstractFloatItem] | floatItems (self)
bool | geoCoordinates (self, int x, int y, float lon, float lat, Marble.GeoDataCoordinates.Unit a4=Marble.GeoDataCoordinates.Degree)
int | height (self)
bool | mapCoversViewport (self)
Marble.MapQuality | mapQuality (self)
Marble.MapQuality | mapQuality (self, Marble.ViewContext viewContext)
QString | mapThemeId (self)
int | maximumZoom (self)
int | minimumZoom (self)
Marble.MarbleModel | model (self)
| notifyMouseClick (self, int x, int y)
| paint (self, Marble.GeoPainter painter, QRect dirtyRect)
int | preferredRadiusCeil (self, int radius)
int | preferredRadiusFloor (self, int radius)
Marble.Projection | projection (self)
bool | propertyValue (self, QString name)
int | radius (self)
| reload (self)
| removeLayer (self, Marble.LayerInterface layer)
[Marble.RenderPlugin] | renderPlugins (self)
| rotateBy (self, float deltaLon, float deltaLat)
bool | screenCoordinates (self, float lon, float lat, float x, float y)
| setCenterLatitude (self, float lat)
| setCenterLongitude (self, float lon)
| setDefaultAngleUnit (self, Marble.AngleUnit angleUnit)
| setDefaultFont (self, QFont font)
| setMapQualityForViewContext (self, Marble.MapQuality qualityForViewContext, Marble.ViewContext viewContext)
| setMapThemeId (self, QString maptheme)
| setProjection (self, Marble.Projection projection)
| setPropertyValue (self, QString name, bool value)
| setRadius (self, int radius)
| setShowAtmosphere (self, bool visible)
| setShowBackground (self, bool visible)
| setShowBorders (self, bool visible)
| setShowCities (self, bool visible)
| setShowCityLights (self, bool visible)
| setShowClouds (self, bool visible)
| setShowCompass (self, bool visible)
| setShowCrosshairs (self, bool visible)
| setShowFrameRate (self, bool visible)
| setShowGrid (self, bool visible)
| setShowIceLayer (self, bool visible)
| setShowLakes (self, bool visible)
| setShowOtherPlaces (self, bool visible)
| setShowOverviewMap (self, bool visible)
| setShowPlaces (self, bool visible)
| setShowRelief (self, bool visible)
| setShowRivers (self, bool visible)
| setShowScaleBar (self, bool visible)
| setShowSunInZenith (self, bool visible)
| setShowSunShading (self, bool visible)
| setShowTerrain (self, bool visible)
| setShowTileId (self, bool visible)
| setSize (self, int width, int height)
| setSize (self, QSize size)
| setViewContext (self, Marble.ViewContext viewContext)
| setVolatileTileCacheLimit (self, long kiloBytes)
bool | showAtmosphere (self)
bool | showBackground (self)
bool | showBorders (self)
bool | showCities (self)
bool | showCityLights (self)
bool | showClouds (self)
bool | showCompass (self)
bool | showCrosshairs (self)
bool | showFrameRate (self)
bool | showGrid (self)
bool | showIceLayer (self)
bool | showLakes (self)
bool | showOtherPlaces (self)
bool | showOverviewMap (self)
bool | showPlaces (self)
bool | showRelief (self)
bool | showRivers (self)
bool | showScaleBar (self)
bool | showSunInZenith (self)
bool | showSunShading (self)
bool | showTerrain (self)
QSize | size (self)
int | tileZoomLevel (self)
Marble.ViewContext | viewContext (self)
Marble.ViewportParams | viewport (self)
long | volatileTileCacheLimit (self)
[Marble.AbstractDataPluginItem] | whichItemAt (self, QPoint curpos)
int | width (self)

## Signal Documentation

framesPerSecond | ( | float | fps
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("framesPerSecond(qreal)"), target_slot)`

mouseClickGeoPosition | ( | float | lon,
|  | float | lat,
|  | Marble.GeoDataCoordinates.Unit | a2
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("mouseClickGeoPosition(qreal, qreal, Marble::GeoDataCoordinates::Unit)"), target_slot)`

mouseMoveGeoPosition | ( | QString | a0
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("mouseMoveGeoPosition(const QString&)"), target_slot)`

pluginSettingsChanged | ( |  | ) |

This signal is emit when the settings of a plugin changed.

Signal syntax:
  `QObject.connect(source, SIGNAL("pluginSettingsChanged()"), target_slot)`

projectionChanged | ( | Marble.Projection | a0
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("projectionChanged(Marble::Projection)"), target_slot)`

radiusChanged | ( | int | radius
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("radiusChanged(int)"), target_slot)`

renderPluginInitialized | ( | Marble.RenderPlugin | renderPlugin
| ) |  |  |

Signal that a render item has been initialized

Signal syntax:
  `QObject.connect(source, SIGNAL("renderPluginInitialized(Marble::RenderPlugin*)"), target_slot)`

repaintNeeded | ( | QRegion | dirtyRegion=QRegion()
| ) |  |  |

This signal is emitted when the repaint of the view was requested. If available with the dirtyRegion which is the region the view will change in. If dirtyRegion.isEmpty() returns true, the whole viewport has to be repainted.

Signal syntax:
  `QObject.connect(source, SIGNAL("repaintNeeded(const QRegion&)"), target_slot)`

themeChanged | ( | QString | theme
| ) |  |  |

Signal that the theme has changed

Parameters:

  | theme | Name of the new theme.

Signal syntax:
  `QObject.connect(source, SIGNAL("themeChanged(const QString&)"), target_slot)`

tileLevelChanged | ( | int | level
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("tileLevelChanged(int)"), target_slot)`

visibleLatLonAltBoxChanged | ( | Marble.GeoDataLatLonAltBox | visibleLatLonAltBox
| ) |  |  |

This signal is emitted when the visible region of the map changes. This typically happens when the user moves the map around or zooms.

Signal syntax:
  `QObject.connect(source, SIGNAL("visibleLatLonAltBoxChanged(const Marble::GeoDataLatLonAltBox&)"), target_slot)`

## Method Documentation

__init__ | ( |  | self ) |

Construct a new MarbleMap.

This constructor should be used when you will only use one MarbleMap. The widget will create its own MarbleModel when created.

__init__ | ( | self, |
|  | Marble.MarbleModel | model
| ) |  |  |

Construct a new MarbleMap.

Parameters:

  | model | the data model for the widget.

This constructor should be used when you plan to use more than one MarbleMap for the same MarbleModel (not yet supported, but will be soon).

addLayer | ( | self, |
|  | Marble.LayerInterface | layer
| ) |  |  |

Add a layer to be included in rendering.

float centerLatitude | ( |  | self ) |

Return the latitude of the center point.

Returns:
  The latitude of the center point in degree.

float centerLongitude | ( |  | self ) |

Return the longitude of the center point.

Returns:
  The longitude of the center point in degree.

centerOn | ( | self, |
|  | float | lon,
|  | float | lat
| ) |  |  |

Center the view on a geographical point

Parameters:

  |  | lat an angle parallel to the latitude lines +90(N) - -90(S)
  |  | lon an angle parallel to the longitude lines +180(W) - -180(E)

clearVolatileTileCache | ( |  | self ) |

customPaint | ( | self, |
|  | Marble.GeoPainter | painter
| ) |  |  |

Enables custom drawing onto the MarbleMap straight after the globe and before all other layers have been rendered.

Parameters:

  | painter |

Deprecated:
  implement LayerInterface and add it using addLayer()

[Marble.AbstractDataPlugin] dataPlugins | ( |  | self ) |

Returns a list of all DataPlugins on the layer

Returns:
  the list of DataPlugins

Marble.AngleUnit defaultAngleUnit | ( |  | self ) |

QFont defaultFont | ( |  | self ) |

downloadRegion | ( | self, |
|  | QString | sourceDir,
|  | QVector | a1
| ) |  |  |

Marble.AbstractFloatItem floatItem | ( | self, |
|  | QString | nameId
| ) |  |  |

Returns a list of all FloatItems in the model

Returns:
  the list of the floatItems

[Marble.AbstractFloatItem] floatItems | ( |  | self ) |

bool geoCoordinates | ( | self, |
|  | int | x,
|  | int | y,
|  | float | lon,
|  | float | lat,
|  | Marble.GeoDataCoordinates.Unit | a4=Marble.GeoDataCoordinates.Degree
| ) |  |  |

Get the earth coordinates corresponding to a pixel in the map.

Parameters:

  | x | the x coordinate of the pixel
  | y | the y coordinate of the pixel
  | lon | the longitude angle is returned through this parameter
  | lat | the latitude angle is returned through this parameter

Returns:
  true if the pixel (x, y) is within the globe

false if the pixel (x, y) is outside the globe, i.e. in space.

int height | ( |  | self ) |

bool mapCoversViewport | ( |  | self ) |

Marble.MapQuality mapQuality | ( |  | self ) |

Return the current map quality.

Marble.MapQuality mapQuality | ( | self, |
|  | Marble.ViewContext | viewContext
| ) |  |  |

Return the current map quality.

QString mapThemeId | ( |  | self ) |

Get the ID of the current map theme To ensure that a unique identifier is being used the theme does NOT get represented by its name but the by relative location of the file that specifies the theme:

Example: maptheme = "earth/bluemarble/bluemarble.dgml"

int maximumZoom | ( |  | self ) |

return the minimum zoom value for the current map theme.

int minimumZoom | ( |  | self ) |

return the minimum zoom value for the current map theme.

Marble.MarbleModel model | ( |  | self ) |

Return the model that this view shows.

notifyMouseClick | ( | self, |
|  | int | x,
|  | int | y
| ) |  |  |

used to notify about the position of the mouse click

paint | ( | self, |
|  | Marble.GeoPainter | painter,
|  | QRect | dirtyRect
| ) |  |  |

Paint the map using a give painter.

Parameters:

  | painter | The painter to use.
  | dirtyRect | the rectangle that actually needs repainting.

int preferredRadiusCeil | ( | self, |
|  | int | radius
| ) |  |  |

int preferredRadiusFloor | ( | self, |
|  | int | radius
| ) |  |  |

Marble.Projection projection | ( |  | self ) |

Get the Projection used for the map

Returns:
  Spherical a Globe

Returns:
  Equirectangular a flat map

Returns:
  Mercator another flat map

bool propertyValue | ( | self, |
|  | QString | name
| ) |  |  |

Return the property value by name.

Returns:
  The property value (usually: visibility).

int radius | ( |  | self ) |

Return the radius of the globe in pixels.

reload | ( |  | self ) |

Reload the currently displayed map by reloading texture tiles from the Internet. In the future this should be extended to all kinds of data which is used in the map.

removeLayer | ( | self, |
|  | Marble.LayerInterface | layer
| ) |  |  |

Remove a layer from being included in rendering.

[Marble.RenderPlugin] renderPlugins | ( |  | self ) |

Returns a list of all RenderPlugins in the model, this includes float items

Returns:
  the list of RenderPlugins

rotateBy | ( | self, |
|  | float | deltaLon,
|  | float | deltaLat
| ) |  |  |

Rotate the view by the two angles phi and theta.

Parameters:

  |  | deltaLon an angle that specifies the change in terms of longitude
  |  | deltaLat an angle that specifies the change in terms of latitude

This function rotates the view by two angles, deltaLon ("theta") and deltaLat ("phi"). If we start at (0, 0), the result will be the exact equivalent of (lon, lat), otherwise the resulting angle will be the sum of the previous position and the two offsets.

bool screenCoordinates | ( | self, |
|  | float | lon,
|  | float | lat,
|  | float | x,
|  | float | y
| ) |  |  |

Get the screen coordinates corresponding to geographical coordinates in the map.

Parameters:

  | lon | the lon coordinate of the requested pixel position
  | lat | the lat coordinate of the requested pixel position
  | x | the x coordinate of the pixel is returned through this parameter
  | y | the y coordinate of the pixel is returned through this parameter

Returns:
  true if the geographical coordinates are visible on the screen

false if the geographical coordinates are not visible on the screen

setCenterLatitude | ( | self, |
|  | float | lat
| ) |  |  |

Set the latitude for the center point

Parameters:

  |  | lat the new value for the latitude in degree

setCenterLongitude | ( | self, |
|  | float | lon
| ) |  |  |

Set the longitude for the center point

Parameters:

  |  | lon the new value for the longitude in degree

setDefaultAngleUnit | ( | self, |
|  | Marble.AngleUnit | angleUnit
| ) |  |  |

setDefaultFont | ( | self, |
|  | QFont | font
| ) |  |  |

setMapQualityForViewContext | ( | self, |
|  | Marble.MapQuality | qualityForViewContext,
|  | Marble.ViewContext | viewContext
| ) |  |  |

setMapThemeId | ( | self, |
|  | QString | maptheme
| ) |  |  |

Set a new map theme

Parameters:

  | maptheme | The ID of the new maptheme. To ensure that a unique identifier is being used the theme does NOT get represented by its name but the by relative location of the file that specifies the theme:

Example: maptheme = "earth/bluemarble/bluemarble.dgml"

setProjection | ( | self, |
|  | Marble.Projection | projection
| ) |  |  |

Set the Projection used for the map

Parameters:

  |  | projection projection type (e.g. Spherical, Equirectangular, Mercator)

setPropertyValue | ( | self, |
|  | QString | name,
|  | bool | value
| ) |  |  |

Sets the value of a map theme property

Parameters:

  |  | value value of the property (usually: visibility)

Later on we might add a "setPropertyType and a QVariant if needed.

setRadius | ( | self, |
|  | int | radius
| ) |  |  |

Set the radius of the globe in pixels.

Parameters:

  |  | radius The new globe radius value in pixels.

setShowAtmosphere | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the atmospheric glow is visible

Parameters:

  |  | visible visibility of the atmospheric glow

setShowBackground | ( | self, |
|  | bool | visible
| ) |  |  |

setShowBorders | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the borders visible

Parameters:

  |  | visible visibility of the borders

setShowCities | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the city place mark overlay is visible

Parameters:

  |  | visible visibility of the city place marks

setShowCityLights | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether city lights instead of night shadow are visible.

Parameters:

  |  | visible visibility of city lights

setShowClouds | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the cloud cover is visible

Parameters:

  |  | visible visibility of the cloud cover

setShowCompass | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the compass overlay is visible

Parameters:

  |  | visible visibility of the compass

setShowCrosshairs | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the crosshairs are visible

Parameters:

  |  | visible visibility of the crosshairs

setShowFrameRate | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the frame rate gets shown

Parameters:

  | visible | visibility of the frame rate

setShowGrid | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the coordinate grid overlay is visible

Parameters:

  |  | visible visibility of the coordinate grid

setShowIceLayer | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the ice layer is visible

Parameters:

  |  | visible visibility of the ice layer

setShowLakes | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the lakes are visible

Parameters:

  |  | visible visibility of the lakes

setShowOtherPlaces | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the other places overlay is visible

Parameters:

  |  | visible visibility of other places

setShowOverviewMap | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the overview map overlay is visible

Parameters:

  |  | visible visibility of the overview map

setShowPlaces | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the place mark overlay is visible

Parameters:

  |  | visible visibility of the place marks

setShowRelief | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the relief is visible

Parameters:

  |  | visible visibility of the relief

setShowRivers | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the rivers are visible

Parameters:

  |  | visible visibility of the rivers

setShowScaleBar | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the scale bar overlay is visible

Parameters:

  |  | visible visibility of the scale bar

setShowSunInZenith | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the sun is visible in the zenith.

Parameters:

  | visible | visibility of the sun in the zenith

setShowSunShading | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the night shadow is visible.

Parameters:

  |  | visibile visibility of shadow

setShowTerrain | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the terrain place mark overlay is visible

Parameters:

  |  | visible visibility of the terrain place marks

setShowTileId | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the is tile is visible NOTE: This is part of the transitional debug API and might be subject to changes until Marble 0.8

Parameters:

  | visible | visibility of the tile

setSize | ( | self, |
|  | int | width,
|  | int | height
| ) |  |  |

setSize | ( | self, |
|  | QSize | size
| ) |  |  |

setViewContext | ( | self, |
|  | Marble.ViewContext | viewContext
| ) |  |  |

setVolatileTileCacheLimit | ( | self, |
|  | long | kiloBytes
| ) |  |  |

Set the limit of the volatile (in RAM) tile cache.

Parameters:

  |  | bytes The limit in kilobytes.

bool showAtmosphere | ( |  | self ) |

Return whether the atmospheric glow is visible.

Returns:
  The cloud cover visibility.

bool showBackground | ( |  | self ) |

bool showBorders | ( |  | self ) |

Return whether the borders are visible.

Returns:
  The border visibility.

bool showCities | ( |  | self ) |

Return whether the city place marks are visible.

Returns:
  The city place mark visibility.

bool showCityLights | ( |  | self ) |

Return whether the city lights are shown instead of the night shadow.

Returns:
  visibility of city lights

bool showClouds | ( |  | self ) |

Return whether the cloud cover is visible.

Returns:
  The cloud cover visibility.

bool showCompass | ( |  | self ) |

Return whether the compass bar is visible.

Returns:
  The compass visibility.

bool showCrosshairs | ( |  | self ) |

Return whether the crosshairs are visible.

Returns:
  The crosshairs' visibility.

bool showFrameRate | ( |  | self ) |

Return whether the frame rate gets displayed.

Returns:
  the frame rates visibility

bool showGrid | ( |  | self ) |

Return whether the coordinate grid is visible.

Returns:
  The coordinate grid visibility.

bool showIceLayer | ( |  | self ) |

Return whether the ice layer is visible.

Returns:
  The ice layer visibility.

bool showLakes | ( |  | self ) |

Return whether the lakes are visible.

Returns:
  The lakes' visibility.

bool showOtherPlaces | ( |  | self ) |

Return whether other places are visible.

Returns:
  The visibility of other places.

bool showOverviewMap | ( |  | self ) |

Return whether the overview map is visible.

Returns:
  The overview map visibility.

bool showPlaces | ( |  | self ) |

Return whether the place marks are visible.

Returns:
  The place mark visibility.

bool showRelief | ( |  | self ) |

Return whether the relief is visible.

Returns:
  The relief visibility.

bool showRivers | ( |  | self ) |

Return whether the rivers are visible.

Returns:
  The rivers' visibility.

bool showScaleBar | ( |  | self ) |

Return whether the scale bar is visible.

Returns:
  The scale bar visibility.

bool showSunInZenith | ( |  | self ) |

Return whether the sun is shown in the zenith.

Returns:
  visibility of sun in the zenith

bool showSunShading | ( |  | self ) |

Return whether the night shadow is visible.

Returns:
  visibility of night shadow

bool showTerrain | ( |  | self ) |

Return whether the terrain place marks are visible.

Returns:
  The terrain place mark visibility.

QSize size | ( |  | self ) |

int tileZoomLevel | ( |  | self ) |

Marble.ViewContext viewContext | ( |  | self ) |

Marble.ViewportParams viewport | ( |  | self ) |

long volatileTileCacheLimit | ( |  | self ) |

Returns the limit in kilobytes of the volatile (in RAM) tile cache.

Returns:
  the limit of volatile tile cache in kilobytes.

[Marble.AbstractDataPluginItem] whichItemAt | ( | self, |
|  | QPoint | curpos
| ) |  |  |

Returns all widgets of dataPlugins on the position curpos

int width | ( |  | self ) |