Shumate.DataSource¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c/en |
max-zoom-level |
||
r/w/c/en |
min-zoom-level |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when data is received for any tile. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Shumate.DataSource(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
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:
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:
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:
x (
int
) – the X coordinate to fetchy (
int
) – the Y coordinate to fetchzoom_level (
int
) – the Z coordinate to fetchcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to execute upon completion
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
) – aGio.AsyncResult
provided to callback- Raises:
- Returns:
The requested data, or
None
if an error occurred- Return type:
GLib.Bytes
orNone
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 requesty (
int
) – Y coordinate to requestzoom_level (
int
) – zoom level to requestcancellable (
Gio.Cancellable
orNone
) – for cancelling the request
- Returns:
a [class`DataSourceRequest`] object for tracking the request.
- Return type:
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:
x (
int
) – the X coordinate to fetchy (
int
) – the Y coordinate to fetchzoom_level (
int
) – the Z coordinate to fetchcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to execute upon completion
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
) – aGio.AsyncResult
provided to callback- Returns:
The requested data, or
None
if an error occurred- Return type:
GLib.Bytes
orNone
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 requesty (
int
) – Y coordinate to requestzoom_level (
int
) – zoom level to requestcancellable (
Gio.Cancellable
orNone
) – for cancelling the request
- Returns:
a [class`DataSourceRequest`] object for tracking the request.
- Return type:
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:
- Parameters:
data_source (
Shumate.DataSource
) – The object which received the signalx (
int
) – the X coordinate of the tiley (
int
) – the Y coordinate of the tilezoom_level (
int
) – the zoom level of the tilebytes (
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:
- Default Value:
30
- Flags:
The maximum zoom level
New in version 1.1.