Shumate.Map

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Shumate.Map Shumate.Map Gtk.Widget->Shumate.Map

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

class

new_simple ()

add_layer (layer)

center_on (latitude, longitude)

get_animate_zoom ()

get_go_to_duration ()

get_state ()

get_viewport ()

get_zoom_on_double_click ()

go_to (latitude, longitude)

go_to_full (latitude, longitude, zoom_level)

go_to_full_with_duration (latitude, longitude, zoom_level, duration_ms)

insert_layer_above (layer, next_sibling)

insert_layer_behind (layer, next_sibling)

remove_layer (layer)

set_animate_zoom (value)

set_go_to_duration (duration)

set_map_source (map_source)

set_zoom_on_double_click (value)

stop_go_to ()

zoom_in ()

zoom_out ()

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

animate-zoom

bool

r/w

Animate zoom change when zooming in/out

go-to-duration

int

r/w

The duration of an animation when going to a location

state

Shumate.State

r

View’s global state

viewport

Shumate.Viewport

r

Viewport

zoom-on-double-click

bool

r/w

Zoom in and recenter on double click on the map

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

animation-completed

The Shumate.Map ::animation-completed signal is emitted when any animation in the view ends.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Shumate.Map(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Shumate.MapClass

The Map widget is a [class`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 [class`Shumate`.SimpleMap] for a ready-to-use widget.

By default, a [class`Shumate`.Viewport] is created and can be accessed with [method`Shumate`.Map.get_viewport].

Unless created with [ctor`Shumate`.Map.new_simple], the widget doesn’t hold any layer and won’t show anything. A [class`Shumate`.Layer] can be added or removed using the [method`Shumate`.Map.add_layer] or [method`Shumate`.Map.remove_layer] methods.

classmethod new()
Returns:

a new Shumate.Map ready to be used as a Gtk.Widget.

Return type:

Shumate.Map

Creates an instance of Shumate.Map.

classmethod new_simple()
Return type:

Shumate.Map

add_layer(layer)
Parameters:

layer (Shumate.Layer) – a Shumate.Layer

Adds a new layer to the view

center_on(latitude, longitude)
Parameters:
  • latitude (float) – the longitude to center the map at

  • longitude (float) – the longitude to center the map at

Centers the map on these coordinates.

get_animate_zoom()
Returns:

True if the view animates zooms, False otherwise.

Return type:

bool

Checks whether the view animates zoom level changes.

get_go_to_duration()
Returns:

the animation duration when calling [method`Map`.go_to], in milliseconds.

Return type:

int

Get the ‘go-to-duration’ property.

get_state()
Returns:

the state.

Return type:

Shumate.State

Gets the view’s state.

get_viewport()
Returns:

the Shumate.Viewport

Return type:

Shumate.Viewport

Get the Shumate.Viewport used by this view.

get_zoom_on_double_click()
Returns:

True if the view zooms on double click, False otherwise.

Return type:

bool

Checks whether the view zooms on double click.

go_to(latitude, longitude)
Parameters:
  • latitude (float) – the longitude to center the map at

  • longitude (float) – the longitude to center the map at

Move from the current position to these coordinates. All tiles in the intermediate view WILL be loaded!

go_to_full(latitude, longitude, zoom_level)
Parameters:
  • latitude (float) – the longitude to center the map at

  • longitude (float) – the longitude to center the map at

  • zoom_level (float) – the zoom level to end at

Move from the current position to these coordinates and zoom to the given zoom level. All tiles in the intermediate view WILL be loaded!

go_to_full_with_duration(latitude, longitude, zoom_level, duration_ms)
Parameters:
  • latitude (float) – the longitude to center the map at

  • longitude (float) – the longitude to center the map at

  • zoom_level (float) – the zoom level to end at

  • duration_ms (int) – animation duration in milliseconds

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 [property`Map`:py:data::go-to-duration<Shumate.Map.props.go_to_duration>]. All tiles in the intermediate view WILL be loaded!

insert_layer_above(layer, next_sibling)
Parameters:

Adds layer to self above next_sibling or, if next_sibling is None, at the bottom of the layer list.

insert_layer_behind(layer, next_sibling)
Parameters:

Adds layer to self behind next_sibling or, if next_sibling is None, at the top of the layer list.

remove_layer(layer)
Parameters:

layer (Shumate.Layer) – a Shumate.Layer

Removes the given layer from the view

set_animate_zoom(value)
Parameters:

value (bool) – a bool

Should the view animate zoom level changes.

set_go_to_duration(duration)
Parameters:

duration (int) – the animation duration, in milliseconds

Set the duration of the transition of [method`Map`.go_to].

set_map_source(map_source)
Parameters:

map_source (Shumate.MapSource) – a Shumate.MapSource

Changes the currently used map source. 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.

set_zoom_on_double_click(value)
Parameters:

value (bool) – a bool

Should the view zoom in and recenter when the user double click on the map.

stop_go_to()

Stop the go to animation. The view will stay where it was when the animation was stopped.

zoom_in()

Zooms the map in. If [property`Map`:py:data::animate-zoom<Shumate.Map.props.animate_zoom>] is TRUE, the change will be animated.

zoom_out()

Zooms the map out. If [property`Map`:py:data::animate-zoom<Shumate.Map.props.animate_zoom>] is TRUE, the change will be animated.

Signal Details

Shumate.Map.signals.animation_completed(map)
Signal Name:

animation-completed

Flags:

RUN_LAST, DETAILED

Parameters:

map (Shumate.Map) – The object which received the signal

The Shumate.Map ::animation-completed signal is emitted when any animation in the view ends. This is a detailed signal. For example, if you want to be signaled only for go-to animation, you should connect to “animation-completed::go-to”. And for zoom, connect to “animation-completed::zoom”.

Property Details

Shumate.Map.props.animate_zoom
Name:

animate-zoom

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Animate zoom change when zooming in/out.

Shumate.Map.props.go_to_duration
Name:

go-to-duration

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The duration of an animation when going to a location, in milliseconds. A value of 0 means that the duration is calculated automatically for you.

Please note that animation of #shumate_map_ensure_visible also involves a ‘go-to’ animation.

Shumate.Map.props.state
Name:

state

Type:

Shumate.State

Default Value:

Shumate.State.NONE

Flags:

READABLE

The view’s global state. Useful to inform using if the view is busy loading tiles or not.

Shumate.Map.props.viewport
Name:

viewport

Type:

Shumate.Viewport

Default Value:

None

Flags:

READABLE

The viewport, which contains information about the center, rotation, zoom, etc. of the map.

Shumate.Map.props.zoom_on_double_click
Name:

zoom-on-double-click

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Should the view zoom in and recenter when the user double click on the map.