:right-sidebar: True Map =================================================================== .. currentmodule:: gi.repository.Shumate .. class:: Map(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` The Map widget is a :obj:`~gi.repository.Gtk.Widget` that show and allows interaction with the user. This is the base widget and doesn't have advanced features. You can check the :obj:`~gi.repository.Shumate.SimpleMap` for a ready-to-use widget. By default, a :obj:`~gi.repository.Shumate.Viewport` is created and can be accessed with :obj:`~gi.repository.Shumate.Map.get_viewport`\. Unless created with :obj:`~gi.repository.Shumate.Map.new_simple`\, the widget doesn't hold any layer and won't show anything. A :obj:`~gi.repository.Shumate.Layer` can be added or removed using the :obj:`~gi.repository.Shumate.Map.add_layer` or :obj:`~gi.repository.Shumate.Map.remove_layer` methods. Constructors ------------ .. rst-class:: interim-class .. class:: Map :no-index: .. classmethod:: new() -> ~gi.repository.Shumate.Map Creates an instance of :obj:`~gi.repository.Shumate.Map`\. .. classmethod:: new_simple() -> ~gi.repository.Shumate.Map Methods ------- .. rst-class:: interim-class .. class:: Map :no-index: .. method:: add_layer(layer: ~gi.repository.Shumate.Layer) -> None Adds a new layer to the view :param layer: a :obj:`~gi.repository.Shumate.Layer` .. method:: center_on(latitude: float, longitude: float) -> None Centers the map on these coordinates. :param latitude: the longitude to center the map at :param longitude: the longitude to center the map at .. method:: get_animate_zoom() -> bool Checks whether the view animates zoom level changes. .. method:: get_go_to_duration() -> int Get the 'go-to-duration' property. .. method:: get_state() -> ~gi.repository.Shumate.State Gets the view's state. .. method:: get_viewport() -> ~gi.repository.Shumate.Viewport Get the :obj:`~gi.repository.Shumate.Viewport` used by this view. .. method:: get_zoom_on_double_click() -> bool Checks whether the view zooms on double click. .. method:: go_to(latitude: float, longitude: float) -> None Move from the current position to these coordinates. All tiles in the intermediate view WILL be loaded! :param latitude: the longitude to center the map at :param longitude: the longitude to center the map at .. method:: go_to_full(latitude: float, longitude: float, zoom_level: float) -> None Move from the current position to these coordinates and zoom to the given zoom level. All tiles in the intermediate view WILL be loaded! :param latitude: the longitude to center the map at :param longitude: the longitude to center the map at :param zoom_level: the zoom level to end at .. method:: go_to_full_with_duration(latitude: float, longitude: float, zoom_level: float, duration_ms: int) -> None Move from the current position to these coordinates and zoom to the given zoom level. The given duration is used instead of the map's default :obj:`~gi.repository.Shumate.Map.props.go_to_duration`\. All tiles in the intermediate view WILL be loaded! :param latitude: the longitude to center the map at :param longitude: the longitude to center the map at :param zoom_level: the zoom level to end at :param duration_ms: animation duration in milliseconds .. method:: insert_layer_above(layer: ~gi.repository.Shumate.Layer, next_sibling: ~gi.repository.Shumate.Layer | None = None) -> None Adds ``layer`` to ``self`` above ``next_sibling`` or, if ``next_sibling`` is :const:`None`, at the bottom of the layer list. :param layer: a :obj:`~gi.repository.Shumate.Layer` :param next_sibling: a :obj:`~gi.repository.Shumate.Layer` that is a child of ``self``\, or :const:`None` .. method:: insert_layer_behind(layer: ~gi.repository.Shumate.Layer, next_sibling: ~gi.repository.Shumate.Layer | None = None) -> None Adds ``layer`` to ``self`` behind ``next_sibling`` or, if ``next_sibling`` is :const:`None`, at the top of the layer list. :param layer: a :obj:`~gi.repository.Shumate.Layer` :param next_sibling: a :obj:`~gi.repository.Shumate.Layer` that is a child of ``self``\, or :const:`None` .. method:: remove_layer(layer: ~gi.repository.Shumate.Layer) -> None Removes the given layer from the view :param layer: a :obj:`~gi.repository.Shumate.Layer` .. method:: set_animate_zoom(value: bool) -> None Should the view animate zoom level changes. :param value: a :obj:`~gi.repository.gboolean` .. method:: set_go_to_duration(duration: int) -> None Set the duration of the transition of :obj:`~gi.repository.Map.go_to`\. :param duration: the animation duration, in milliseconds .. method:: set_map_source(map_source: ~gi.repository.Shumate.MapSource) -> None Changes the currently used map source. #:func:`~gi.repository.GObject.GObject.Object.unref` will be called on the previous one. As a side effect, changing the primary map source will also clear all secondary map sources. :param map_source: a :obj:`~gi.repository.Shumate.MapSource` .. method:: set_zoom_on_double_click(value: bool) -> None Should the view zoom in and recenter when the user double click on the map. :param value: a :obj:`~gi.repository.gboolean` .. method:: stop_go_to() -> None Stop the go to animation. The view will stay where it was when the animation was stopped. .. method:: zoom_in() -> None Zooms the map in. If :obj:`~gi.repository.Shumate.Map.props.animate_zoom` is ``TRUE``\, the change will be animated. .. method:: zoom_out() -> None Zooms the map out. If :obj:`~gi.repository.Shumate.Map.props.animate_zoom` is ``TRUE``\, the change will be animated. Properties ---------- .. rst-class:: interim-class .. class:: Map :no-index: .. attribute:: props.animate_zoom :type: bool The type of the None singleton. .. attribute:: props.go_to_duration :type: int The type of the None singleton. .. attribute:: props.state :type: ~gi.repository.Shumate.State The type of the None singleton. .. attribute:: props.viewport :type: ~gi.repository.Shumate.Viewport The type of the None singleton. .. attribute:: props.zoom_on_double_click :type: bool The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: Map.signals :no-index: .. method:: animation_completed() -> None The type of the None singleton.