KDE 4.2 PyKDE API Reference for Marble

- 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 ()
| regionChanged (BoundingBox rect)
| themeChanged (QString mapTheme)
| timeout ()
## Methods
| __init__ (self, QObject parent)
| __init__ (self, Marble.MarbleModel a0)
| addPlaceMarkData (self, QString data)
| addPlaceMarkFile (self, QString filename)
| clearPersistentTileCache (self)
| clearVolatileTileCache (self)
| creatingTilesStart (self, Marble.TileCreator a0, QString name, QString description)
ExtDateTime | dateTime (self)
HttpDownloadManager | downloadManager (self)
FileViewModel | fileViewModel (self)
[Marble::MarbleAbstractFloatIte] | 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)
float | planetRadius (self)
| regionChanged (self, BoundingBox rect)
[Marble::MarbleRenderPlugi] | 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)
| timeout (self)
| update (self)
VectorComposer | vectorComposer (self)
quint64 | volatileTileCacheLimit (self)
QVector | whichFeatureAt (self, QPoint a0)

## Method Documentation

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

Construct a new MarbleModel.

Parameters:

  | parent | the parent widget

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

addPlaceMarkData | ( | self, |
|  | QString | 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)`

ExtDateTime dateTime | ( |  | self ) |

HttpDownloadManager downloadManager | ( |  | self ) |

Return the downloadmanager to load missing tiles

Returns:
  the HttpDownloadManager instance.

FileViewModel fileViewModel | ( |  | self ) |

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

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

float planetRadius | ( |  | self ) |

regionChanged | ( | self, |
|  | BoundingBox | rect
| ) |  |  |

Signal that a region of the earth has changed

Parameters:

  | rect | the region that changed.

This is currently used only for gpx files, but will likely be used for more things in the future.

Signal syntax:
  `QObject.connect(source, SIGNAL("regionChanged(BoundingBox&)"), target_slot)`

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

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
  | parent | the parent widget
  | 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. This is what the parent parameter is used for.

NOTE: Both the parent and 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:

  | name | the identifier of the new map theme.

See also:
  mapTheme

See also:
  setMapTheme

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

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 whichFeatureAt | ( | self, |
|  | QPoint | a0
| ) |  |  |