Shumate.VectorRenderer¶
- Subclasses:
None
Methods¶
- Inherited:
Shumate.MapSource (26), GObject.Object (37), Gio.Initable (2)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
sprite-sheet |
||
r/w/co/en |
Style JSON |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Shumate.VectorRenderer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A [class`MapSource`] that renders tiles from a given vector data source.
- classmethod is_supported()¶
-
Checks whether libshumate was compiled with vector tile support. Previous versions of libshumate had a build-time option to disable vector tiles, but as of 1.6 they are always enabled.
- classmethod new(id, style_json)¶
- Parameters:
- Raises:
- Returns:
a newly constructed [class`VectorRenderer`], or
Noneif error is set- Return type:
Creates a new [class`VectorRenderer`] from the given JSON style.
The stylesheet should contain a list of tile sources. Tiles will be downloaded using [class`TileDownloader`]s.
See the MapLibre Style Specification for details on style_json, but be aware that libshumate does not support every feature of the specification.
- get_global_state(key)¶
-
Gets a global state value.
If the value has not been set with [method`VectorRenderer`.set_global_state], the default defined in the style will be returned, or
Noneif no default is defined. Note that an explicitly set null value will return a [struct`VectorValue`] of type null, while an undefined value will returnNone.New in version 1.6.
- get_sprite_sheet()¶
- Returns:
the [class`VectorSpriteSheet`]
- Return type:
Gets the sprite sheet used to render icons and textures.
New in version 1.1.
- reset_global_state(key)¶
- Parameters:
key (
str) – the state key
Resets a global state value to the default defined in the style, or to null if no default is defined.
New in version 1.6.
- set_data_source(name, data_source)¶
- Parameters:
name (
str) – the name of the data sourcedata_source (
Shumate.DataSource) – a [class`DataSource`]
Adds a data source to the renderer.
Currently, [class`VectorRenderer`] only supports one data source and throws an error if the style does not contain exactly one data source. However, support for multiple sources may be added in the future, so this method accepts a name parameter. If the name does not match the one expected by the style, this method will have no effect.
New in version 1.2.
- set_global_state(key, value)¶
- Parameters:
key (
str) – the state keyvalue (
Shumate.VectorValue) – the state value
Sets a global state value.
Global state can be accessed in the stylesheet through the “global-state” expression operator. This allows styles to provide options that can be configured without changing the style JSON.
Previously rendered tiles are not affected by changes to global state and must be re-rendered.
New in version 1.6.
- set_sprite_sheet(sprites)¶
- Parameters:
sprites (
Shumate.VectorSpriteSheet) – a [class`VectorSpriteSheet`]
Sets the sprite sheet used to render icons and textures.
New in version 1.1.
- set_sprite_sheet_data(sprites_pixbuf, sprites_json)¶
- Parameters:
sprites_pixbuf (
GdkPixbuf.Pixbuf) – a [class`GdkPixbuf`.Pixbuf]sprites_json (
str) – a JSON string
- Raises:
- Returns:
whether the sprite sheet was loaded successfully
- Return type:
Sets the sprite sheet used by the style JSON to render icons and textures.
The existing [property`VectorRenderer`:py:data::sprite-sheet<Shumate.VectorRenderer.props.sprite_sheet>] property will be replaced with a new instance of [class`VectorSpriteSheet`].
Deprecated since version 1.1: Use the methods of [property`VectorRenderer`:sprite-sheet] instead.
Property Details¶
- Shumate.VectorRenderer.props.sprite_sheet¶
- Name:
sprite-sheet- Type:
- Default Value:
- Flags:
The sprite sheet used to render icons and textures.
New in version 1.1.
- Shumate.VectorRenderer.props.style_json¶
- Name:
style-json- Type:
- Default Value:
- Flags:
A map style, in Mapbox Style Specification format.
Note that not all features of the specification are supported.