KDE 4.3 PyKDE API Reference

- KDE's Python API

# MarbleModel Class Reference

`from PyKDE4.marble import *`

Inherits: QObject
Namespace: Marble

## Detailed Description

The data model (not based on QAbstractModel) for a MarbleWidget.

This class provides a data storage and indexer that can be displayed in a MarbleWidget. It contains 3 different 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.

The tiles provide the background of the image and can be for instance height and depth fields, magnetic strength, topographic data or anything else that is area based.

The vectors provide things like country borders and coastlines. They are stored in separate files and can be added or removed at anytime.

The placemarks contain points of interest, such as cities, mountain tops or the poles. These are sorted by size (for cities) and category (capitals, other important cities, less important cities, etc) and are displayed with different color or shape like square or round.

See also:
  MarbleWidget

## Signals

| creatingTilesStart (Marble.TileCreator a0, QString name, QString description)
| modelChanged ()
| themeChanged (QString mapTheme)
| timeout ()

## Methods

| __init__ (self, QObject parent)
| __init__ (self, Marble.MarbleModel a0)
| addPlacemarkData (self, QString data, QString key="data")
| addPlacemarkFile (self, QString filename)
| clearPersistentTileCache (self)
| clearVolatileTileCache (self)
| creatingTilesStart (self, Marble.TileCreator a0, QString name, QString description)
[Marble::AbstractDataPlugi] | dataPlugins (self)
ExtDateTime | dateTime (self)
HttpDownloadManager | downloadManager (self)
FileViewModel | fileViewModel (self)
[Marble::AbstractFloatIte] | floatItems (self)
QAbstractItemModel | geometryModel (self)
GpsLayer | gpsLayer (self)
GpxFileModel | gpxFileModel (self)
MergedLayerDecorator | layerDecorator (self)
Marble.GeoSceneDocument | mapTheme (self)
QString | mapThemeId (self)
| modelChanged (self)
| paintGlobe (self, Marble.GeoPainter painter, int width, int height, Marble.ViewParams viewParams, bool redrawBackground, QRect dirtyRect)
| paintTile (self, TextureTile tile, int x, int y, int level, Marble.GeoSceneTexture textureLayer, bool requestTileUpdate)
PlacemarkLayout | placemarkLayout (self)
QAbstractItemModel | placemarkModel (self)
QItemSelectionModel | placemarkSelectionModel (self)
Marble.Planet | planet (self)
QString | planetName (self)
float | planetRadius (self)
| removePlacemarkKey (self, QString key)
[Marble::RenderPlugi] | renderPlugins (self)
| setDownloadManager (self, HttpDownloadManager downloadManager)
| setMapTheme (self, Marble.GeoSceneDocument mapTheme, Marble.Projection currentProjection)
| setShowGps (self, bool visible)
| setVolatileTileCacheLimit (self, quint64 kiloBytes)
| setupTextureMapper (self, Marble.Projection projection)
bool | showGps (self)
| startPolling (self, int time=1000)
| stopPolling (self)
Marble.SunLocator | sunLocator (self)
TextureColorizer | textureColorizer (self)
AbstractScanlineTextureMapper | textureMapper (self)
| themeChanged (self, QString mapTheme)
int | tileZoomLevel (self)
| timeout (self)
| update (self)
VectorComposer | vectorComposer (self)
quint64 | volatileTileCacheLimit (self)
QVector<QModelIndex> | whichFeatureAt (self, QPoint a0)
[Marble::AbstractDataPluginIte] | whichItemAt (self, QPoint curpos)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent
| ) |  |  |

Construct a new MarbleModel.

Parameters:

  | parent | the parent widget

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

addPlacemarkData | ( | self, |
|  | QString | data,
|  | QString | key="data"
| ) |  |  |

addPlacemarkFile | ( | self, |
|  | QString | filename
| ) |  |  |

clearPersistentTileCache | ( |  | self ) |

clearVolatileTileCache | ( |  | self ) |

creatingTilesStart | ( | self, |
|  | Marble.TileCreator | a0,
|  | QString | name,
|  | QString | description
| ) |  |  |

Signal that the MarbleModel has started to create a new set of tiles. @param

See also:
  zoomView()

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

[Marble::AbstractDataPlugi] dataPlugins | ( |  | self ) |

Returns a list of all DataPlugins on the layer

Returns:
  the list of DataPlugins

ExtDateTime dateTime | ( |  | self ) |

HttpDownloadManager downloadManager | ( |  | self ) |

Return the downloadmanager to load missing tiles

Returns:
  the HttpDownloadManager instance.

FileViewModel fileViewModel | ( |  | self ) |

[Marble::AbstractFloatIte] floatItems | ( |  | self ) |

Returns a list of all FloatItems in the model

Returns:
  the list of the floatItems

QAbstractItemModel geometryModel | ( |  | self ) |

GpsLayer gpsLayer | ( |  | self ) |

GpxFileModel gpxFileModel | ( |  | self ) |

MergedLayerDecorator layerDecorator | ( |  | self ) |

Marble.GeoSceneDocument mapTheme | ( |  | self ) |

QString mapThemeId | ( |  | self ) |

Return the name of the current map theme.

Returns:
  the identifier of the current 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"

modelChanged | ( |  | self ) |

Signal that the MarbleModel has changed in general

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

paintGlobe | ( | self, |
|  | Marble.GeoPainter | painter,
|  | int | width,
|  | int | height,
|  | Marble.ViewParams | viewParams,
|  | bool | redrawBackground,
|  | QRect | dirtyRect
| ) |  |  |

Paint the model into the view

Parameters:

  | painter | the QPainter used to paint the view
  | width | the width of the widget
  | height | the height of the widget
  | viewParams | the view parameters controlling the paint process
  | redrawBackground | a boolean controlling if the background should be redrawn in addition to the globe itself
  | dirtyRect | the rectangle of the widget that needs redrawing.

The model has the responsibility to actually paint into the MarbleWidget. This function is called by MarbleWidget when it receives a paintEvent and should repaint whole or part of the widget's contents based on the parameters.

NOTE: This function will probably move to MarbleWidget in KDE 4.1, making the MarbleModel/MarbleWidget pair truly follow the Model/View paradigm.

paintTile | ( | self, |
|  | TextureTile | tile,
|  | int | x,
|  | int | y,
|  | int | level,
|  | Marble.GeoSceneTexture | textureLayer,
|  | bool | requestTileUpdate
| ) |  |  |

PlacemarkLayout placemarkLayout | ( |  | self ) |

QAbstractItemModel placemarkModel | ( |  | self ) |

Return the list of Placemarks as a QAbstractItemModel *

Returns:
  a list of all Placemarks in the MarbleModel.

QItemSelectionModel placemarkSelectionModel | ( |  | self ) |

Marble.Planet planet | ( |  | self ) |

Returns the planet object for the current map.

Returns:
  the planet object for the current map

QString planetName | ( |  | self ) |

float planetRadius | ( |  | self ) |

removePlacemarkKey | ( | self, |
|  | QString | key
| ) |  |  |

[Marble::RenderPlugi] renderPlugins | ( |  | self ) |

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

Returns:
  the list of RenderPlugins

setDownloadManager | ( | self, |
|  | HttpDownloadManager | downloadManager
| ) |  |  |

Set the downloadmanager to load missing tiles

Parameters:

  | downloadManager | the HttpDownloadManager instance

This function sets the downloadmanager to load tiles that are missing locally. The desctruction of the instance will be handled by MarbleModel.

setMapTheme | ( | self, |
|  | Marble.GeoSceneDocument | mapTheme,
|  | Marble.Projection | currentProjection
| ) |  |  |

Set a new map theme to use.

Parameters:

  | selectedMap | the identifier of the selected map theme
  | currentProjection | the current projection

This function sets the map theme, i.e. combination of tile set and color scheme to use. If the map theme is not previously used, some basic tiles are created and a progress dialog is shown.

NOTE: The currentProjection parameters will disappear soon.

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"

setShowGps | ( | self, |
|  | bool | visible
| ) |  |  |

Set whether the Gps Data is visible.

Parameters:

  | visible | visibility of the Gps Data.

setVolatileTileCacheLimit | ( | self, |
|  | quint64 | kiloBytes
| ) |  |  |

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

Parameters:

  | kilobytes | The limit in kilobytes.

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

Set the Projection used for the map

Parameters:

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

bool showGps | ( |  | self ) |

Return whether the Gps Data is visible.

Returns:
  The Gps Data visibility.

startPolling | ( | self, |
|  | int | time=1000
| ) |  |  |

Start the model's timer polling

Parameters:

  | time | the amount of milliseconds between each poll

This is default behaviour so does not need to be started unless it was previously stopped

stopPolling | ( |  | self ) |

stop the model from polling

Marble.SunLocator sunLocator | ( |  | self ) |

TextureColorizer textureColorizer | ( |  | self ) |

Returns the map's TextureColorizer

Warning:
  The TextureColorizer pointer may be null since it is only initialized if the map theme requires it. Check for this possibility.

Returns:
  A pointer to the TextureColorizer

AbstractScanlineTextureMapper textureMapper | ( |  | self ) |

themeChanged | ( | self, |
|  | QString | mapTheme
| ) |  |  |

Signal that the map theme has changed, and to which theme.

Parameters:

  | mapTheme | the identifier of the new map theme.

See also:
  mapTheme

See also:
  setMapTheme

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

int tileZoomLevel | ( |  | self ) |

Return the current tile zoom level. For example for OpenStreetMap possible values are 1..18, for BlueMarble 0..6.

timeout | ( |  | self ) |

Signal that a timer has gone off.

This is currently used only for GPS things right now, but will likely be used for more things in the future.

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

update | ( |  | self ) |

Update the model

VectorComposer vectorComposer | ( |  | self ) |

quint64 volatileTileCacheLimit | ( |  | self ) |

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

Returns:
  the cache limit in kilobytes

QVector<QModelIndex> whichFeatureAt | ( | self, |
|  | QPoint | a0
| ) |  |  |

[Marble::AbstractDataPluginIte] whichItemAt | ( | self, |
|  | QPoint | curpos
| ) |  |  |

Returns all widgets of dataPlugins on the position curpos