KDE 4.4 PyKDE API Reference

- KDE's Python API

# MarbleModel Class Reference

`from PyKDE4.marble import *`

Inherits: QObject
Namespace: Marble.MarbleModel

## 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)
| downloadTile (QUrl sourceUrl, QString destinationFileName, QString id)
| modelChanged ()
| pluginSettingsChanged ()
| renderPluginInitialized (Marble.RenderPlugin renderPlugin)
| repaintNeeded (QRegion dirtyRegion=QRegion())
| themeChanged (QString mapTheme)
| timeout ()

## Methods

| __init__ (self, QObject parent)
| 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)
| downloadTile (self, QUrl sourceUrl, QString destinationFileName, QString id)
[Marble::AbstractFloatIte] | floatItems (self)
QString | mapThemeId (self)
| modelChanged (self)
| openGpxFile (self, QString filename)
| paintGlobe (self, Marble.GeoPainter painter, int width, int height, Marble.ViewParams viewParams, bool redrawBackground, QRect dirtyRect)
QAbstractItemModel | placemarkModel (self)
QItemSelectionModel | placemarkSelectionModel (self)
Marble.Planet | planet (self)
QString | planetName (self)
float | planetRadius (self)
| pluginSettingsChanged (self)
| reloadMap (self)
| removePlacemarkKey (self, QString key)
| renderPluginInitialized (self, Marble.RenderPlugin renderPlugin)
[Marble::RenderPlugi] | renderPlugins (self)
| repaintNeeded (self, QRegion dirtyRegion=QRegion())
| setShowGps (self, bool visible)
| setVolatileTileCacheLimit (self, quint64 kiloBytes)
| setupTextureMapper (self, Marble.Projection projection)
| setupVectorComposer (self)
bool | showGps (self)
| startPolling (self, int time=1000)
| stopPolling (self)
Marble.SunLocator | sunLocator (self)
| themeChanged (self, QString mapTheme)
int | tileZoomLevel (self)
| timeout (self)
| update (self)
quint64 | volatileTileCacheLimit (self)
QVector<QModelIndex> | whichFeatureAt (self, QPoint a0)
[Marble::AbstractDataPluginIte] | whichItemAt (self, QPoint curpos)

## Method Documentation

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

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(Marble::TileCreator*, const const QString&, const const QString&)"), target_slot)`

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

Returns a list of all DataPlugins on the layer

Returns:
  the list of DataPlugins

downloadTile | ( | self, |
|  | QUrl | sourceUrl,
|  | QString | destinationFileName,
|  | QString | id
| ) |  |  |

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

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

Returns a list of all FloatItems in the model

Returns:
  the list of the floatItems

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)`

openGpxFile | ( | self, |
|  | QString | filename
| ) |  |  |

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.

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 ) |

pluginSettingsChanged | ( |  | self ) |

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

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

reloadMap | ( |  | self ) |

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

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

Signal that a render item has been initialized

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

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

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

Returns:
  the list of RenderPlugins

repaintNeeded | ( | self, |
|  | 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(QRegion)"), target_slot)`

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)

setupVectorComposer | ( |  | self ) |

Setup the Vector Composer

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 ) |

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

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