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 fetch
- y ( - int) – the Y coordinate to fetch
- zoom_level ( - int) – the Z coordinate to fetch
- cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable
- callback ( - Gio.AsyncReadyCallbackor- None) – a- Gio.AsyncReadyCallbackto 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) – a- Gio.AsyncResultprovided to callback
- Raises:
- Returns:
- The requested data, or - Noneif an error occurred
- Return type:
- GLib.Bytesor- 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.Cancellableor- None) – 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 fetch
- y ( - int) – the Y coordinate to fetch
- zoom_level ( - int) – the Z coordinate to fetch
- cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable
- callback ( - Gio.AsyncReadyCallbackor- None) – a- Gio.AsyncReadyCallbackto 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) – a- Gio.AsyncResultprovided to callback
- Returns:
- The requested data, or - Noneif an error occurred
- Return type:
- GLib.Bytesor- 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.Cancellableor- None) – 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 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:
- Default Value:
- 30
- Flags:
 - The maximum zoom level - New in version 1.1.