:right-sidebar: True
VectorRenderer
===================================================================
.. currentmodule:: gi.repository.Shumate
.. class:: VectorRenderer(**properties: ~typing.Any)
:no-contents-entry:
Superclasses: :class:`~gi.repository.Shumate.MapSource`, :class:`~gi.repository.GObject.Object`
Implemented Interfaces: :class:`~gi.repository.Gio.Initable`
:Constructors:
::
VectorRenderer(**properties)
new(id:str, style_json:str) -> Shumate.VectorRenderer
Constructors
------------
.. rst-class:: interim-class
.. class:: VectorRenderer
:no-index:
.. classmethod:: new(id: str, style_json: str) -> ~gi.repository.Shumate.VectorRenderer
Creates a new :obj:`~gi.repository.Shumate.VectorRenderer` from the given JSON style.
The stylesheet should contain a list of tile sources. Tiles will be
downloaded using :obj:`~gi.repository.Shumate.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.
:param id: an ID for the map source
:param style_json: a vector style
Methods
-------
.. rst-class:: interim-class
.. class:: VectorRenderer
:no-index:
.. method:: get_sprite_sheet() -> ~gi.repository.Shumate.VectorSpriteSheet
Gets the sprite sheet used to render icons and textures.
.. versionadded:: 1.1
.. method:: is_supported() -> bool
Checks whether libshumate was compiled with vector tile support. If it was
not, vector renderers cannot be created or used.
.. method:: set_data_source(name: str, data_source: ~gi.repository.Shumate.DataSource) -> None
Adds a data source to the renderer.
Currently, :obj:`~gi.repository.Shumate.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.
.. versionadded:: 1.2
:param name: the name of the data source
:param data_source: a :obj:`~gi.repository.Shumate.DataSource`
.. method:: set_sprite_sheet(sprites: ~gi.repository.Shumate.VectorSpriteSheet) -> None
Sets the sprite sheet used to render icons and textures.
.. versionadded:: 1.1
:param sprites: a :obj:`~gi.repository.Shumate.VectorSpriteSheet`
.. method:: set_sprite_sheet_data(sprites_pixbuf: ~gi.repository.GdkPixbuf.Pixbuf, sprites_json: str) -> bool
Sets the sprite sheet used by the style JSON to render icons and textures.
The existing :obj:`~gi.repository.Shumate.VectorRenderer.props.sprite_sheet` property will be replaced
with a new instance of :obj:`~gi.repository.Shumate.VectorSpriteSheet`.
.. deprecated:: 1.1
Use the methods of :obj:`~gi.repository.Shumate.VectorRenderer.props.sprite_sheet` instead.
:param sprites_pixbuf: a :obj:`~gi.repository.GdkPixbuf.Pixbuf`
:param sprites_json: a JSON string
Properties
----------
.. rst-class:: interim-class
.. class:: VectorRenderer
:no-index:
.. attribute:: props.sprite_sheet
:type: ~gi.repository.Shumate.VectorSpriteSheet
The sprite sheet used to render icons and textures.
.. versionadded:: 1.1
.. attribute:: props.style_json
:type: str
A map style, in `Mapbox Style Specification `_
format.
Note that not all features of the specification are supported.