Top |
ChamplainViewChamplainView — A ClutterActor to display maps |
gboolean | animate-zoom | Read / Write |
ClutterActor * | background-pattern | Read / Write |
gdouble | deceleration | Read / Write |
guint | goto-animation-duration | Read / Write |
ClutterAnimationMode | goto-animation-mode | Read / Write |
gboolean | horizontal-wrap | Read / Write |
gboolean | keep-center-on-resize | Read / Write |
gboolean | kinetic-mode | Read / Write |
gdouble | latitude | Read / Write |
gdouble | longitude | Read / Write |
ChamplainMapSource * | map-source | Read / Write |
guint | max-zoom-level | Read / Write |
guint | min-zoom-level | Read / Write |
ChamplainState | state | Read |
ChamplainBoundingBox * | world | Read / Write |
guint | zoom-level | Read / Write |
gboolean | zoom-on-double-click | Read / Write |
ChamplainView implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.
The ChamplainView is a ClutterActor to display maps. It supports two modes of scrolling:
Push: the normal behavior where the maps don't move after the user stopped scrolling;
Kinetic: the iPhone-like behavior where the maps decelerate after the user stopped scrolling.
You can use the same ChamplainView to display many types of maps. In Champlain they are called map sources. You can change the map-source property at anytime to replace the current displayed map.
The maps are downloaded from Internet from open maps sources (like OpenStreetMap). Maps are divided in tiles for each zoom level. When a tile is requested, ChamplainView will first check if it is in cache (in the user's cache dir under champlain). If an error occurs during download, an error tile will be displayed.
The button-press-event and button-release-event signals are emitted each
time a mouse button is pressed and released on the view
.
ClutterActor *
champlain_view_new (void
);
Creates an instance of ChamplainView.
Since: 0.4
void champlain_view_center_on (ChamplainView *view
,gdouble latitude
,gdouble longitude
);
Centers the map on these coordinates.
view |
||
latitude |
the longitude to center the map at |
|
longitude |
the longitude to center the map at |
Since: 0.1
void champlain_view_go_to (ChamplainView *view
,gdouble latitude
,gdouble longitude
);
Move from the current position to these coordinates. All tiles in the intermediate view WILL be loaded!
view |
||
latitude |
the longitude to center the map at |
|
longitude |
the longitude to center the map at |
Since: 0.4
void
champlain_view_stop_go_to (ChamplainView *view
);
Stop the go to animation. The view will stay where it was when the animation was stopped.
Since: 0.4
gdouble
champlain_view_get_center_latitude (ChamplainView *view
);
Gets the latitude of the view's center.
Since: 0.10
gdouble
champlain_view_get_center_longitude (ChamplainView *view
);
Gets the longitude of the view's center.
Since: 0.10
void
champlain_view_zoom_in (ChamplainView *view
);
Zoom in the map by one level.
Since: 0.1
void
champlain_view_zoom_out (ChamplainView *view
);
Zoom out the map by one level.
Since: 0.1
void champlain_view_set_zoom_level (ChamplainView *view
,guint zoom_level
);
Changes the current level of zoom
Since: 0.4
void champlain_view_set_min_zoom_level (ChamplainView *view
,guint zoom_level
);
Changes the lowest allowed level of zoom
Since: 0.4
void champlain_view_set_max_zoom_level (ChamplainView *view
,guint zoom_level
);
Changes the highest allowed level of zoom
Since: 0.4
void champlain_view_ensure_visible (ChamplainView *view
,ChamplainBoundingBox *bbox
,gboolean animate
);
Changes the map's zoom level and center to make sure the given area is visible
view |
||
bbox |
bounding box of the area that should be visible |
|
animate |
TRUE to perform animation, FALSE otherwise |
Since: 0.10
void champlain_view_ensure_layers_visible (ChamplainView *view
,gboolean animate
);
Changes the map's zoom level and center to make sure that the bounding boxes of all inserted layers are visible.
Since: 0.10
void champlain_view_set_map_source (ChamplainView *view
,ChamplainMapSource *map_source
);
Changes the currently used map source.
will be called on
the previous one.g_object_unref()
As a side effect, changing the primary map source will also clear all secondary map sources.
Since: 0.4
void champlain_view_add_overlay_source (ChamplainView *view
,ChamplainMapSource *map_source
,guint8 opacity
);
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.
Since: 0.12.5
void champlain_view_remove_overlay_source (ChamplainView *view
,ChamplainMapSource *map_source
);
Removes an overlay source from ChamplainView.
Since: 0.12.5
GList *
champlain_view_get_overlay_sources (ChamplainView *view
);
Gets a list of overlay sources.
Since: 0.12.5
void champlain_view_set_deceleration (ChamplainView *view
,gdouble rate
);
The deceleration rate for the kinetic mode.
Since: 0.4
void champlain_view_set_kinetic_mode (ChamplainView *view
,gboolean kinetic
);
Determines the way the view reacts to scroll events.
Since: 0.10
void champlain_view_set_keep_center_on_resize (ChamplainView *view
,gboolean value
);
Keep the current centered position when resizing the view.
Since: 0.4
void champlain_view_set_zoom_on_double_click (ChamplainView *view
,gboolean value
);
Should the view zoom in and recenter when the user double click on the map.
Since: 0.4
void champlain_view_set_animate_zoom (ChamplainView *view
,gboolean value
);
Should the view animate zoom level changes.
Since: 0.12
void champlain_view_set_background_pattern (ChamplainView *view
,ClutterContent *background
);
Sets the background texture displayed behind the map. Setting the background pattern affects performence slightly - use reasonably large patterns for better performance.
Since: 0.12.4
void champlain_view_set_world (ChamplainView *view
,ChamplainBoundingBox *bbox
);
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.
Since: 0.12.11
void champlain_view_set_horizontal_wrap (ChamplainView *view
,gboolean wrap
);
Sets the value of the “horizontal-wrap” property.
void champlain_view_add_layer (ChamplainView *view
,ChamplainLayer *layer
);
Adds a new layer to the view
Since: 0.2
void champlain_view_remove_layer (ChamplainView *view
,ChamplainLayer *layer
);
Removes the given layer from the view
Since: 0.4.1
cairo_surface_t * champlain_view_to_surface (ChamplainView *view
,gboolean include_layers
);
Will generate a cairo_surface_t that represents the current view
of the map. Without any markers or layers. If the current ChamplainRenderer
used does not support this, this function will return NULL
.
If include_layers
is set to TRUE
all layers that implement
ChamplainExportable will be included in the surface.
The ChamplainView also need to be in CHAMPLAIN_STATE_DONE state.
a cairo_surface_t or NULL
on failure. Free with
cairo_surface_destroy()
when done.
[transfer full]
guint
champlain_view_get_zoom_level (ChamplainView *view
);
Gets the view's current zoom level.
Since: 0.4
guint
champlain_view_get_min_zoom_level (ChamplainView *view
);
Gets the view's minimal allowed zoom level.
Since: 0.4
guint
champlain_view_get_max_zoom_level (ChamplainView *view
);
Gets the view's maximum allowed zoom level.
Since: 0.4
ChamplainMapSource *
champlain_view_get_map_source (ChamplainView *view
);
Gets the view's current map source.
the view's current map source. If you need to keep a reference to the
map source then you have to call
. g_object_ref()
[transfer none]
Since: 0.4
gdouble
champlain_view_get_deceleration (ChamplainView *view
);
Gets the view's deceleration rate.
Since: 0.4
gboolean
champlain_view_get_kinetic_mode (ChamplainView *view
);
Gets the view's scroll mode behaviour.
Since: 0.10
gboolean
champlain_view_get_keep_center_on_resize
(ChamplainView *view
);
Checks whether to keep the center on resize
Since: 0.4
gboolean
champlain_view_get_zoom_on_double_click
(ChamplainView *view
);
Checks whether the view zooms on double click.
Since: 0.4
gboolean
champlain_view_get_animate_zoom (ChamplainView *view
);
Checks whether the view animates zoom level changes.
Since: 0.12
ChamplainState
champlain_view_get_state (ChamplainView *view
);
Gets the view's state.
Since: 0.10
ClutterContent *
champlain_view_get_background_pattern (ChamplainView *view
);
Gets the current background texture displayed behind the map.
Since: 0.12.4
ChamplainBoundingBox *
champlain_view_get_world (ChamplainView *view
);
Get the bounding box that represents the extent of the world.
Since: 0.12.11
gboolean
champlain_view_get_horizontal_wrap (ChamplainView *view
);
Returns the value of the “horizontal-wrap” property.
void
champlain_view_reload_tiles (ChamplainView *view
);
Reloads all visible tiles.
Since: 0.8
gdouble champlain_view_x_to_longitude (ChamplainView *view
,gdouble x
);
Converts the view's x coordinate to longitude.
Since: 0.10
gdouble champlain_view_y_to_latitude (ChamplainView *view
,gdouble y
);
Converts the view's y coordinate to latitude.
Since: 0.10
gdouble champlain_view_longitude_to_x (ChamplainView *view
,gdouble longitude
);
Converts the longitude to view's x coordinate.
Since: 0.10
gdouble champlain_view_latitude_to_y (ChamplainView *view
,gdouble latitude
);
Converts the latitude to view's y coordinate.
Since: 0.10
void champlain_view_get_viewport_anchor (ChamplainView *view
,gint *anchor_x
,gint *anchor_y
);
Gets the x and y coordinate of the viewport anchor in respect to the layer origin.
view |
||
anchor_x |
the x coordinate of the viewport anchor. |
[out] |
anchor_y |
the y coordinate of the viewport anchor. |
[out] |
Since: 0.12.14
void champlain_view_get_viewport_origin (ChamplainView *view
,gint *x
,gint *y
);
Gets the x and y coordinate of the viewport in respect to the layer origin.
Since: 0.10
void champlain_view_bin_layout_add (ChamplainView *view
,ClutterActor *child
,ClutterBinAlignment x_align
,ClutterBinAlignment y_align
);
champlain_view_bin_layout_add
has been deprecated since version 0.12.4 and should not be used in newly-written code.
Use ClutterActorAlign and the ClutterActor API instead.
This function inserts a custom actor to the undrelying ClutterBinLayout
manager. The inserted actors appear on top of the map. See clutter_bin_layout_add()
for reference.
Since: 0.10
ChamplainLicense *
champlain_view_get_license_actor (ChamplainView *view
);
Returns the ChamplainLicense actor which is inserted by default into the layout manager. It can be manipulated using standard ClutterActor methods (hidden and so on).
Since: 0.10
ChamplainBoundingBox *
champlain_view_get_bounding_box (ChamplainView *view
);
Gets the bounding box for view view
at current zoom-level.
Since: 0.12.4
ChamplainBoundingBox * champlain_view_get_bounding_box_for_zoom_level (ChamplainView *view
,guint zoom_level
);
Gets the bounding box for view view
at zoom_level
.
Since: 0.12.6
struct ChamplainView;
The ChamplainView structure contains only private data and should be accessed using the provided API
Since: 0.1
“animate-zoom”
property“animate-zoom” gboolean
Animate zoom change when zooming in/out.
Owner: ChamplainView
Flags: Read / Write
Default value: TRUE
Since: 0.12
“background-pattern”
property“background-pattern” ClutterActor *
The pattern displayed in the background of the map.
Owner: ChamplainView
Flags: Read / Write
Since: 0.12.4
“deceleration”
property“deceleration” gdouble
The deceleration rate for the kinetic mode. The default value is 1.1.
Owner: ChamplainView
Flags: Read / Write
Allowed values: [1.0001,2]
Default value: 1.1
Since: 0.10
“goto-animation-duration”
property“goto-animation-duration” guint
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.
Owner: ChamplainView
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 0
“goto-animation-mode”
property“goto-animation-mode” ClutterAnimationMode
The mode of animation when going to a location.
Please note that animation of champlain_view_ensure_visible also involves a 'goto' animation.
Owner: ChamplainView
Flags: Read / Write
Default value: CLUTTER_EASE_IN_OUT_CIRC
“horizontal-wrap”
property“horizontal-wrap” gboolean
Determines whether the view should wrap horizontally.
Owner: ChamplainView
Flags: Read / Write
Default value: FALSE
“keep-center-on-resize”
property“keep-center-on-resize” gboolean
Keep the current centered position when resizing the view.
Owner: ChamplainView
Flags: Read / Write
Default value: TRUE
Since: 0.2.7
“kinetic-mode”
property“kinetic-mode” gboolean
Determines whether the view should use kinetic mode.
Owner: ChamplainView
Flags: Read / Write
Default value: FALSE
Since: 0.10
“latitude”
property“latitude” gdouble
The latitude coordonate of the map
Owner: ChamplainView
Flags: Read / Write
Allowed values: [-90,90]
Default value: 0
Since: 0.1
“longitude”
property“longitude” gdouble
The longitude coordonate of the map
Owner: ChamplainView
Flags: Read / Write
Allowed values: [-180,180]
Default value: 0
Since: 0.1
“map-source”
property“map-source” ChamplainMapSource *
The ChamplainMapSource being displayed
Owner: ChamplainView
Flags: Read / Write
Since: 0.2
“max-zoom-level”
property“max-zoom-level” guint
The highest allowed level of zoom of the content.
Owner: ChamplainView
Flags: Read / Write
Allowed values: <= 20
Default value: 20
Since: 0.4
“min-zoom-level”
property“min-zoom-level” guint
The lowest allowed level of zoom of the content.
Owner: ChamplainView
Flags: Read / Write
Allowed values: <= 20
Default value: 0
Since: 0.4
“state”
property“state” ChamplainState
The view's global state. Useful to inform using if the view is busy loading tiles or not.
Owner: ChamplainView
Flags: Read
Default value: CHAMPLAIN_STATE_NONE
Since: 0.4
“world”
property“world” ChamplainBoundingBox *
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.
Owner: ChamplainView
Flags: Read / Write
Since: 0.12.11
“zoom-level”
property“zoom-level” guint
The level of zoom of the content.
Owner: ChamplainView
Flags: Read / Write
Allowed values: <= 20
Default value: 3
Since: 0.1
“zoom-on-double-click”
property“zoom-on-double-click” gboolean
Should the view zoom in and recenter when the user double click on the map.
Owner: ChamplainView
Flags: Read / Write
Default value: TRUE
Since: 0.4
“animation-completed”
signalvoid user_function (ChamplainView *champlainview, gpointer user_data)
The “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".
Flags: Has Details
Since: 0.4
“layer-relocated”
signalvoid user_function (ChamplainView *champlainview, gpointer user_data)
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.
Flags: Run Last
Since: 0.10