Champlain.View¶
- Subclasses:
None
Methods¶
- Inherited:
Clutter.Actor (238), GObject.Object (37), Clutter.Animatable (5), Clutter.Container (17), Clutter.Scriptable (4)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Animate zoom change when zooming in/out |
||
r/w |
The tile’s background pattern |
||
r/w |
Rate at which the view will decelerate in kinetic mode. |
||
r/w |
The duration of an animation when going to a location |
||
r/w |
The mode of animation when going to a location |
||
r/w |
Determines whether the view should wrap horizontally. |
||
r/w |
Keep the current centered position upon resizing |
||
r/w |
Determines whether the view should use kinetic mode. |
||
r/w |
The latitude coordonate of the map |
||
r/w |
The longitude coordonate of the map |
||
r/w |
The map source being displayed |
||
r/w |
The highest allowed level of zoom |
||
r/w |
The lowest allowed level of zoom |
||
r |
View’s global state |
||
r/w |
The bounding box to limit the |
||
r/w |
The level of zoom of the map |
||
r/w |
Zoom in and recenter on double click on the map |
Signals¶
- Inherited:
Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)
Name |
Short Description |
---|---|
The |
|
Indicates that the layers have been “relocated”. |
Fields¶
- Inherited:
Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Champlain.View(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Champlain.View
structure contains only private data and should be accessed using the provided APINew in version 0.1.
- classmethod new()¶
- Returns:
a new
Champlain.View
ready to be used as aClutter.Actor
.- Return type:
Creates an instance of
Champlain.View
.New in version 0.4.
- add_layer(layer)¶
- Parameters:
layer (
Champlain.Layer
) – aChamplain.Layer
Adds a new layer to the view
New in version 0.2.
- add_overlay_source(map_source, opacity)¶
- Parameters:
map_source (
Champlain.MapSource
) – aChamplain.MapSource
opacity (
int
) – opacity to use
Adds a new overlay map source to render tiles with the supplied opacity on top of the ordinary map source. Multiple overlay sources can be added.
New in version 0.12.5.
- bin_layout_add(child, x_align, y_align)¶
- Parameters:
child (
Clutter.Actor
) – The child to be insertedx_align (
Clutter.BinAlignment
) – x alignmenty_align (
Clutter.BinAlignment
) – y alignment
This function inserts a custom actor to the undrelying
Clutter.BinLayout
manager. The inserted actors appear on top of the map. SeeClutter.BinLayout.add
() for reference.New in version 0.10.
Deprecated since version 0.12.4: Use
Clutter.ActorAlign
and theClutter.Actor
API instead.
- center_on(latitude, longitude)¶
- Parameters:
Centers the map on these coordinates.
New in version 0.1.
- ensure_layers_visible(animate)¶
-
Changes the map’s zoom level and center to make sure that the bounding boxes of all inserted layers are visible.
New in version 0.10.
- ensure_visible(bbox, animate)¶
- Parameters:
bbox (
Champlain.BoundingBox
) – bounding box of the area that should be visible
Changes the map’s zoom level and center to make sure the given area is visible
New in version 0.10.
- get_animate_zoom()¶
-
Checks whether the view animates zoom level changes.
New in version 0.12.
- get_background_pattern()¶
- Returns:
The texture.
- Return type:
Gets the current background texture displayed behind the map.
New in version 0.12.4.
- get_bounding_box()¶
- Returns:
the bounding box
- Return type:
Gets the bounding box for view self at current zoom-level.
New in version 0.12.4.
- get_bounding_box_for_zoom_level(zoom_level)¶
- Parameters:
zoom_level (
int
) – the level of zoom, aint
between 1 and 20- Returns:
the bounding box for the view at zoom_level.
- Return type:
Gets the bounding box for view self at zoom_level.
New in version 0.12.6.
- get_center_latitude()¶
- Returns:
the latitude.
- Return type:
Gets the latitude of the view’s center.
New in version 0.10.
- get_center_longitude()¶
- Returns:
the longitude.
- Return type:
Gets the longitude of the view’s center.
New in version 0.10.
- get_deceleration()¶
- Returns:
the view’s deceleration rate.
- Return type:
Gets the view’s deceleration rate.
New in version 0.4.
- get_horizontal_wrap()¶
- Returns:
True
ifChamplain.View
:horizontal-wrap
is set.- Return type:
Returns the value of the
Champlain.View
:horizontal-wrap
property.
- get_keep_center_on_resize()¶
-
Checks whether to keep the center on resize
New in version 0.4.
- get_kinetic_mode()¶
-
Gets the view’s scroll mode behaviour.
New in version 0.10.
- get_license_actor()¶
- Returns:
the license actor
- Return type:
Returns the
Champlain.License
actor which is inserted by default into the layout manager. It can be manipulated using standardClutter.Actor
methods (hidden and so on).New in version 0.10.
- get_map_source()¶
- Returns:
the view’s current map source. If you need to keep a reference to the map source then you have to call
GObject.Object.ref
().- Return type:
Gets the view’s current map source.
New in version 0.4.
- get_max_zoom_level()¶
- Returns:
the view’s maximum allowed zoom level.
- Return type:
Gets the view’s maximum allowed zoom level.
New in version 0.4.
- get_min_zoom_level()¶
- Returns:
the view’s minimal allowed zoom level.
- Return type:
Gets the view’s minimal allowed zoom level.
New in version 0.4.
- get_overlay_sources()¶
- Returns:
the list
- Return type:
Gets a list of overlay sources.
New in version 0.12.5.
- get_state()¶
- Returns:
the state.
- Return type:
Gets the view’s state.
New in version 0.10.
- get_viewport_anchor()¶
- Returns:
- anchor_x:
the x coordinate of the viewport anchor
- anchor_y:
the y coordinate of the viewport anchor
- Return type:
Gets the x and y coordinate of the viewport anchor in respect to the layer origin.
New in version 0.12.14.
- get_viewport_origin()¶
- Returns:
- x:
the x coordinate of the viewport
- y:
the y coordinate of the viewport
- Return type:
Gets the x and y coordinate of the viewport in respect to the layer origin.
New in version 0.10.
- get_world()¶
- Returns:
a
Champlain.BoundingBox
that represents the current world- Return type:
Get the bounding box that represents the extent of the world.
New in version 0.12.11.
- get_zoom_level()¶
- Returns:
the view’s current zoom level.
- Return type:
Gets the view’s current zoom level.
New in version 0.4.
- get_zoom_on_double_click()¶
-
Checks whether the view zooms on double click.
New in version 0.4.
- go_to(latitude, longitude)¶
- Parameters:
Move from the current position to these coordinates. All tiles in the intermediate view WILL be loaded!
New in version 0.4.
- latitude_to_y(latitude)¶
-
Converts the latitude to view’s y coordinate.
New in version 0.10.
- longitude_to_x(longitude)¶
-
Converts the longitude to view’s x coordinate.
New in version 0.10.
- reload_tiles()¶
Reloads all visible tiles.
New in version 0.8.
- remove_layer(layer)¶
- Parameters:
layer (
Champlain.Layer
) – aChamplain.Layer
Removes the given layer from the view
New in version 0.4.1.
- remove_overlay_source(map_source)¶
- Parameters:
map_source (
Champlain.MapSource
) – aChamplain.MapSource
Removes an overlay source from
Champlain.View
.New in version 0.12.5.
- set_animate_zoom(value)¶
-
Should the view animate zoom level changes.
New in version 0.12.
- set_background_pattern(background)¶
- Parameters:
background (
Clutter.Content
) – The background texture
Sets the background texture displayed behind the map. Setting the background pattern affects performence slightly - use reasonably large patterns for better performance.
New in version 0.12.4.
- set_deceleration(rate)¶
-
The deceleration rate for the kinetic mode.
New in version 0.4.
- set_horizontal_wrap(wrap)¶
-
Sets the value of the
Champlain.View
:horizontal-wrap
property.
- set_keep_center_on_resize(value)¶
-
Keep the current centered position when resizing the view.
New in version 0.4.
- set_kinetic_mode(kinetic)¶
-
Determines the way the view reacts to scroll events.
New in version 0.10.
- set_map_source(map_source)¶
- Parameters:
map_source (
Champlain.MapSource
) – aChamplain.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.
New in version 0.4.
- set_max_zoom_level(zoom_level)¶
- Parameters:
zoom_level (
int
) – the level of zoom
Changes the highest allowed level of zoom
New in version 0.4.
- set_min_zoom_level(zoom_level)¶
- Parameters:
zoom_level (
int
) – the level of zoom
Changes the lowest allowed level of zoom
New in version 0.4.
- set_world(bbox)¶
- Parameters:
bbox (
Champlain.BoundingBox
) – theChamplain.BoundingBox
of the world
Set a bounding box to limit the world to. No tiles will be loaded outside of this bounding box. It will not be possible to scroll outside of this bounding box.
New in version 0.12.11.
- set_zoom_level(zoom_level)¶
-
Changes the current level of zoom
New in version 0.4.
- set_zoom_on_double_click(value)¶
-
Should the view zoom in and recenter when the user double click on the map.
New in version 0.4.
- stop_go_to()¶
Stop the go to animation. The view will stay where it was when the animation was stopped.
New in version 0.4.
- to_surface(include_layers)¶
- Parameters:
include_layers (
bool
) – Set toTrue
if you want to include layers- Returns:
a
cairo.Surface
orNone
on failure. Free with cairo_surface_destroy() when done.- Return type:
Will generate a
cairo.Surface
that represents the current view of the map. Without any markers or layers. If the currentChamplain.Renderer
used does not support this, this function will returnNone
.If include_layers is set to
True
all layers that implementChamplain.Exportable
will be included in the surface.The
Champlain.View
also need to be inChamplain.State.DONE
state.
- x_to_longitude(x)¶
-
Converts the view’s x coordinate to longitude.
New in version 0.10.
- y_to_latitude(y)¶
-
Converts the view’s y coordinate to latitude.
New in version 0.10.
- zoom_in()¶
Zoom in the map by one level.
New in version 0.1.
- zoom_out()¶
Zoom out the map by one level.
New in version 0.1.
Signal Details¶
- Champlain.View.signals.animation_completed(view)¶
- Signal Name:
animation-completed
- Flags:
- Parameters:
view (
Champlain.View
) – The object which received the signal
The
Champlain.View
::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”.New in version 0.4.
- Champlain.View.signals.layer_relocated(view)¶
- Signal Name:
layer-relocated
- Flags:
- Parameters:
view (
Champlain.View
) – The object which received the signal
Indicates that the layers have been “relocated”. In practice this means that every layer should connect to this signal and redraw itself when the signal is emitted. Layer relocation happens when zooming in/out and when panning for more than MAX_INT pixels.
New in version 0.10.
Property Details¶
- Champlain.View.props.animate_zoom¶
-
Animate zoom change when zooming in/out.
New in version 0.12.
- Champlain.View.props.background_pattern¶
- Name:
background-pattern
- Type:
- Default Value:
- Flags:
The pattern displayed in the background of the map.
New in version 0.12.4.
- Champlain.View.props.deceleration¶
-
The deceleration rate for the kinetic mode. The default value is 1.1.
New in version 0.10.
- Champlain.View.props.goto_animation_duration¶
-
The duration of an animation when going to a location. A value of 0 means that the duration is calculated automatically for you.
Please note that animation of
Champlain.View.ensure_visible
also involves a ‘goto’ animation.
- Champlain.View.props.goto_animation_mode¶
- Name:
goto-animation-mode
- Type:
- Default Value:
- Flags:
The mode of animation when going to a location.
Please note that animation of
Champlain.View.ensure_visible
also involves a ‘goto’ animation.
- Champlain.View.props.horizontal_wrap¶
-
Determines whether the view should wrap horizontally.
- Champlain.View.props.keep_center_on_resize¶
-
Keep the current centered position when resizing the view.
New in version 0.2.7.
- Champlain.View.props.kinetic_mode¶
-
Determines whether the view should use kinetic mode.
New in version 0.10.
- Champlain.View.props.latitude¶
-
The latitude coordonate of the map
New in version 0.1.
- Champlain.View.props.longitude¶
-
The longitude coordonate of the map
New in version 0.1.
- Champlain.View.props.map_source¶
- Name:
map-source
- Type:
- Default Value:
- Flags:
The
Champlain.MapSource
being displayedNew in version 0.2.
- Champlain.View.props.max_zoom_level¶
-
The highest allowed level of zoom of the content.
New in version 0.4.
- Champlain.View.props.min_zoom_level¶
-
The lowest allowed level of zoom of the content.
New in version 0.4.
- Champlain.View.props.state¶
- Name:
state
- Type:
- Default Value:
- Flags:
The view’s global state. Useful to inform using if the view is busy loading tiles or not.
New in version 0.4.
- Champlain.View.props.world¶
- Name:
world
- Type:
- Default Value:
- Flags:
Set a bounding box to limit the world to. No tiles will be loaded outside of this bounding box. It will not be possible to scroll outside of this bounding box.
Default world is the actual world.
New in version 0.12.11.
- Champlain.View.props.zoom_level¶
-
The level of zoom of the content.
New in version 0.1.