Map
Map
#
Bases: ConstrainedControl
An interactive map control that allows displaying various layers.
animation_curve: ft.AnimationCurve = ft.AnimationCurve.FAST_OUT_SLOWIN
class-attribute
instance-attribute
#
The default animation curve to be used for map-animations
when calling instance methods like zoom_in()
, rotate_from()
, move_to()
etc.
Defaults to AnimationCurve.FAST_OUT_SLOWIN
.
animation_duration: ft.DurationValue = field(default_factory=lambda: ft.Duration(milliseconds=500))
class-attribute
instance-attribute
#
The default animation duration to be used for map-animations
when calling instance methods like zoom_in()
, rotate_from()
, move_to()
etc.
Defaults to Duration(milliseconds=500)
.
bgcolor: ft.ColorValue = ft.Colors.GREY_300
class-attribute
instance-attribute
#
The background color of this control.
Defaults to ft.Colors.GREY_300
.
initial_camera_fit: Optional[CameraFit] = None
class-attribute
instance-attribute
#
Defines the visible bounds when the map is first loaded.
Takes precedence over initial_center
/initial_zoom
.
initial_center: MapLatitudeLongitude = field(default_factory=lambda: MapLatitudeLongitude(latitude=50.5, longitude=30.51))
class-attribute
instance-attribute
#
The initial center of the map.
Value is of type MapLatitudeLongitude
.
Defaults to MapLatitudeLongitude(latitude=50.5, longitude=30.51)
.
initial_rotation: ft.Number = 0.0
class-attribute
instance-attribute
#
The rotation (in degrees) when the map is first loaded.
Defaults to 0.0
.
initial_zoom: ft.Number = 13.0
class-attribute
instance-attribute
#
The zoom when the map is first loaded. If initial_camera_fit is defined this has no effect.
Defaults to 13.0
.
interaction_configuration: InteractionConfiguration = field(default_factory=lambda: InteractionConfiguration())
class-attribute
instance-attribute
#
The interaction configuration.
Defaults to InteractionConfiguration()
.
keep_alive: bool = False
class-attribute
instance-attribute
#
Whether to enable the built in keep-alive functionality.
If the map is within a complex layout, such as a ListView
,
the map will reset to it's inital position after it appears back into view.
To ensure this doesn't happen, enable this flag to prevent it from rebuilding.
Defaults to False
.
layers: List[MapLayer]
instance-attribute
#
A list of layers to be displayed (stack-like) on the map.
Value is of type MapLayer
.
max_zoom: ft.OptionalNumber = None
class-attribute
instance-attribute
#
The maximum (highest) zoom level of every layer. Each layer can specify additional zoom level restrictions.
min_zoom: ft.OptionalNumber = None
class-attribute
instance-attribute
#
The minimum (smallest) zoom level of every layer. Each layer can specify additional zoom level restrictions.
on_event: ft.OptionalEventCallable[MapEvent] = None
class-attribute
instance-attribute
#
Fires when any map events occurs.
Event handler argument is of type MapEvent
.
on_hover: ft.OptionalEventCallable[MapHoverEvent] = None
class-attribute
instance-attribute
#
Fires when a hover event occurs.
Event handler argument is of type MapHoverEvent
.
on_init: ft.OptionalControlEventCallable = None
class-attribute
instance-attribute
#
Fires when the map is initialized.
on_long_press: ft.OptionalEventCallable[MapTapEvent] = None
class-attribute
instance-attribute
#
Fires when a long press event occurs.
Event handler argument is of type MapTapEvent
.
on_pointer_cancel: ft.OptionalEventCallable[MapPointerEvent] = None
class-attribute
instance-attribute
#
Fires when a pointer cancel event occurs.
Event handler argument is of type MapPointerEvent
.
on_pointer_down: ft.OptionalEventCallable[MapPointerEvent] = None
class-attribute
instance-attribute
#
Fires when a pointer down event occurs.
Event handler argument is of type MapPointerEvent
.
on_pointer_up: ft.OptionalEventCallable[MapPointerEvent] = None
class-attribute
instance-attribute
#
Fires when a pointer up event occurs.
Event handler argument is of type MapPointerEvent
.
on_position_change: ft.OptionalEventCallable[MapPositionChangeEvent] = None
class-attribute
instance-attribute
#
Fires when the map position changes.
Event handler argument is of type MapPositionChangeEvent
.
on_secondary_tap: ft.OptionalEventCallable[MapTapEvent] = None
class-attribute
instance-attribute
#
Fires when a secondary tap event occurs.
Event handler argument is of type MapTapEvent
.
on_tap: ft.OptionalEventCallable[MapTapEvent] = None
class-attribute
instance-attribute
#
Fires when a tap event occurs.
Event handler argument is of type MapTapEvent
.
center_on(point: Optional[MapLatitudeLongitude], zoom: ft.OptionalNumber, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
#
Centers the map on the given point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
point
|
Optional[MapLatitudeLongitude]
|
The point on which to center the map. |
required |
zoom
|
OptionalNumber
|
The zoom level to be applied. |
required |
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
center_on_async(point: MapLatitudeLongitude, zoom: ft.OptionalNumber, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
async
#
Centers the map on the given point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
point
|
MapLatitudeLongitude
|
The point on which to center the map. |
required |
zoom
|
OptionalNumber
|
The zoom level to be applied. |
required |
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
move_to(destination: Optional[MapLatitudeLongitude] = None, zoom: ft.OptionalNumber = None, rotation: ft.OptionalNumber = None, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, offset: ft.OffsetValue = ft.Offset(0, 0), cancel_ongoing_animations: bool = False) -> None
#
Moves to a specific location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
Optional[MapLatitudeLongitude]
|
The destination point to move to. |
None
|
zoom
|
OptionalNumber
|
The zoom level to be applied. If provided, must be greater than or equal to 0.0. |
None
|
rotation
|
OptionalNumber
|
Rotation (in degrees) to be applied. |
None
|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
offset
|
OffsetValue
|
The offset to be used. Only works when |
Offset(0, 0)
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
move_to_async(destination: Optional[MapLatitudeLongitude] = None, zoom: ft.OptionalNumber = None, rotation: ft.OptionalNumber = None, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, offset: ft.OffsetValue = ft.Offset(0, 0), cancel_ongoing_animations: bool = False) -> None
async
#
Moves to a specific location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destination
|
Optional[MapLatitudeLongitude]
|
The destination point to move to. |
None
|
zoom
|
OptionalNumber
|
The zoom level to be applied. If provided, must be greater than or equal to 0.0. |
None
|
rotation
|
OptionalNumber
|
Rotation (in degrees) to be applied. |
None
|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
offset
|
OffsetValue
|
The offset to be used. Only works when |
Offset(0, 0)
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
reset_rotation(animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.DurationValue = None, cancel_ongoing_animations: bool = False) -> None
#
Resets the map's rotation to 0 degrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
DurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
reset_rotation_async(animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
async
#
Resets the map's rotation to 0 degrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
rotate_from(degree: ft.Number, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
#
Applies a rotation of degree
to the current rotation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
degree
|
Number
|
The number of degrees to increment to the current rotation. |
required |
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
rotate_from_async(degree: ft.Number, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
async
#
Applies a rotation of degree
to the current rotation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
degree
|
Number
|
The number of degrees to increment to the current rotation. |
required |
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
zoom_in(animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
#
Zooms in by one zoom-level from the current one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
zoom_in_async(animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
async
#
Zooms in by one zoom-level from the current one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
zoom_out(animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
#
Zooms out by one zoom-level from the current one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
zoom_out_async(animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
async
#
Zooms out by one zoom-level from the current one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
zoom_to(zoom: ft.Number, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
#
Zoom the map to a specific zoom level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zoom
|
Number
|
The zoom level to zoom to. |
required |
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|
zoom_to_async(zoom: ft.Number, animation_curve: ft.OptionalAnimationCurve = None, animation_duration: ft.OptionalDurationValue = None, cancel_ongoing_animations: bool = False) -> None
async
#
Zoom the map to a specific zoom level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zoom
|
Number
|
The zoom level to zoom to. |
required |
animation_curve
|
OptionalAnimationCurve
|
The curve of the animation. If None (the default), |
None
|
animation_duration
|
OptionalDurationValue
|
The duration of the animation. If None (the default), |
None
|
cancel_ongoing_animations
|
bool
|
Whether to cancel/stop all ongoing map-animations before starting this new one. |
False
|