Shumate.DataSource

g GObject.Object GObject.Object Shumate.DataSource Shumate.DataSource GObject.Object->Shumate.DataSource

Subclasses:

Shumate.TileDownloader

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_max_zoom_level ()

get_min_zoom_level ()

get_tile_data_async (x, y, zoom_level, cancellable, callback, *user_data)

get_tile_data_finish (result)

set_max_zoom_level (zoom_level)

set_min_zoom_level (zoom_level)

start_request (x, y, zoom_level, cancellable)

Virtual Methods

Inherited:

GObject.Object (7)

do_get_tile_data_async (x, y, zoom_level, cancellable, callback, *user_data)

do_get_tile_data_finish (result)

do_start_request (x, y, zoom_level, cancellable)

Properties

Name

Type

Flags

Short Description

max-zoom-level

int

r/w/c/en

max-zoom-level

min-zoom-level

int

r/w/c/en

min-zoom-level

Signals

Inherited:

GObject.Object (1)

Name

Short Description

received-data

Emitted when data is received for any tile. deprecated

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Shumate.DataSource(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

Shumate.DataSourceClass

The base class used to retrieve tiles as [struct`GLib`.Bytes].

get_max_zoom_level()
Returns:

the maximum zoom level this data source supports

Return type:

int

Gets the data source’s maximum zoom level.

New in version 1.1.

get_min_zoom_level()
Returns:

the minimum zoom level this data source supports

Return type:

int

Gets the data source’s minimum zoom level.

New in version 1.1.

get_tile_data_async(x, y, zoom_level, cancellable, callback, *user_data)
Parameters:

Gets the data for the tile at the given coordinates.

Some data sources may return data multiple times. For example, [class`TileDownloader`] may return data from a cache, then return updated data from the network. [signal`ShumateDataSource`:py:func:::received-data<Shumate.DataSource.signals.received_data>] is emitted each time data is received, then callback is called after the last update.

get_tile_data_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult provided to callback

Raises:

GLib.Error

Returns:

The requested data, or None if an error occurred

Return type:

GLib.Bytes or None

Gets the final result of a request started with Shumate.DataSource.get_tile_data_async().

set_max_zoom_level(zoom_level)
Parameters:

zoom_level (int) – the maximum zoom level

Sets the data source’s maximum zoom level.

New in version 1.1.

set_min_zoom_level(zoom_level)
Parameters:

zoom_level (int) – the minimum zoom level

Sets the data source’s minimum zoom level.

New in version 1.1.

start_request(x, y, zoom_level, cancellable)
Parameters:
  • x (int) – X coordinate to request

  • y (int) – Y coordinate to request

  • zoom_level (int) – zoom level to request

  • cancellable (Gio.Cancellable or None) – for cancelling the request

Returns:

a [class`DataSourceRequest`] object for tracking the request.

Return type:

Shumate.DataSourceRequest

Begins a request for a tile.

New in version 1.1.

do_get_tile_data_async(x, y, zoom_level, cancellable, callback, *user_data) virtual
Parameters:

Gets the data for the tile at the given coordinates.

Some data sources may return data multiple times. For example, [class`TileDownloader`] may return data from a cache, then return updated data from the network. [signal`ShumateDataSource`:py:func:::received-data<Shumate.DataSource.signals.received_data>] is emitted each time data is received, then callback is called after the last update.

do_get_tile_data_finish(result) virtual
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult provided to callback

Returns:

The requested data, or None if an error occurred

Return type:

GLib.Bytes or None

Gets the final result of a request started with Shumate.DataSource.get_tile_data_async().

do_start_request(x, y, zoom_level, cancellable) virtual
Parameters:
  • x (int) – X coordinate to request

  • y (int) – Y coordinate to request

  • zoom_level (int) – zoom level to request

  • cancellable (Gio.Cancellable or None) – for cancelling the request

Returns:

a [class`DataSourceRequest`] object for tracking the request.

Return type:

Shumate.DataSourceRequest

Begins a request for a tile.

New in version 1.1.

Signal Details

Shumate.DataSource.signals.received_data(data_source, x, y, zoom_level, bytes)
Signal Name:

received-data

Flags:

RUN_LAST, DEPRECATED

Parameters:
  • data_source (Shumate.DataSource) – The object which received the signal

  • x (int) – the X coordinate of the tile

  • y (int) – the Y coordinate of the tile

  • zoom_level (int) – the zoom level of the tile

  • bytes (GLib.Bytes) – the received data

Emitted when data is received for any tile. This includes any intermediate steps, such as data from the file cache, as well as the final result.

Deprecated since version 1.1: Use [method`DataSource`.start_request] and connect to the notify signals of the resulting [class`DataSourceRequest`].

Property Details

Shumate.DataSource.props.max_zoom_level
Name:

max-zoom-level

Type:

int

Default Value:

30

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The maximum zoom level

New in version 1.1.

Shumate.DataSource.props.min_zoom_level
Name:

min-zoom-level

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The minimum zoom level

New in version 1.1.