: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` A :obj:`~gi.repository.Shumate.MapSource` that renders tiles from a given vector data source. 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_global_state(key: str) -> ~gi.repository.Shumate.VectorValue Gets a global state value. If the value has not been set with :obj:`~gi.repository.VectorRenderer.set_global_state`\, the default defined in the style will be returned, or :const:`None` if no default is defined. Note that an explicitly set null value will return a :obj:`~gi.repository.Shumate.VectorValue` of type null, while an undefined value will return :const:`None`. .. versionadded:: 1.6 :param key: the state key .. method:: get_sprite_sheet() -> ~gi.repository.Shumate.VectorSpriteSheet Gets the sprite sheet used to render icons and textures. .. versionadded:: 1.1 .. classmethod:: is_supported() -> bool 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. .. method:: reset_global_state(key: str) -> None Resets a global state value to the default defined in the style, or to null if no default is defined. .. versionadded:: 1.6 :param key: the state key .. 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_global_state(key: str, value: ~gi.repository.Shumate.VectorValue) -> None 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. .. versionadded:: 1.6 :param key: the state key :param value: the state value .. 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.