:right-sidebar: True Viewport =================================================================== .. currentmodule:: gi.repository.Shumate .. class:: Viewport(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Shumate.Location` The object holding the coordinate, zoom-level, and rotation state of the current view. As the object implements :obj:`~gi.repository.Shumate.Location`\, the latitude and longitude are accessible via the interface methods. Constructors ------------ .. rst-class:: interim-class .. class:: Viewport :no-index: .. classmethod:: new() -> ~gi.repository.Shumate.Viewport Creates a new :obj:`~gi.repository.Shumate.Viewport` Methods ------- .. rst-class:: interim-class .. class:: Viewport :no-index: .. method:: get_max_zoom_level() -> int Get the maximal zoom level .. method:: get_min_zoom_level() -> int Get the minimal zoom level .. method:: get_reference_map_source() -> ~gi.repository.Shumate.MapSource | None Get the reference map source .. method:: get_rotation() -> float Gets the current rotation .. method:: get_zoom_level() -> float Get the current zoom level .. method:: location_to_widget_coords(widget: ~gi.repository.Gtk.Widget, latitude: float, longitude: float) -> ~typing.Tuple[float, float] Gets the position on ``widget`` that correspond to the given latitude and longitude. :param widget: a :obj:`~gi.repository.Gtk.Widget` that uses ``self`` as viewport :param latitude: the latitude :param longitude: the longitude .. method:: set_max_zoom_level(max_zoom_level: int) -> None Set the maximal zoom level :param max_zoom_level: the maximal zoom level .. method:: set_min_zoom_level(min_zoom_level: int) -> None Set the minimal zoom level :param min_zoom_level: the minimal zoom level .. method:: set_reference_map_source(map_source: ~gi.repository.Shumate.MapSource | None = None) -> None Set the reference map source :param map_source: a :obj:`~gi.repository.Shumate.MapSource` or :const:`None` to set none. .. method:: set_rotation(rotation: float) -> None Sets the rotation :param rotation: the rotation .. method:: set_zoom_level(zoom_level: float) -> None Set the zoom level :param zoom_level: the zoom level .. method:: widget_coords_to_location(widget: ~gi.repository.Gtk.Widget, x: float, y: float) -> ~typing.Tuple[float, float] Gets the latitude and longitude corresponding to a position on ``widget``\. :param widget: a :obj:`~gi.repository.Gtk.Widget` that uses ``self`` as viewport :param x: the x coordinate :param y: the y coordinate Properties ---------- .. rst-class:: interim-class .. class:: Viewport :no-index: .. attribute:: props.max_zoom_level :type: int The type of the None singleton. .. attribute:: props.min_zoom_level :type: int The type of the None singleton. .. attribute:: props.reference_map_source :type: ~gi.repository.Shumate.MapSource The type of the None singleton. .. attribute:: props.rotation :type: float The type of the None singleton. .. attribute:: props.zoom_level :type: float The type of the None singleton.