Top |
ChamplainViewChamplainView — A ClutterActor to display maps |
Functions
Properties
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 | 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 |
guint | zoom-level | Read / Write |
gboolean | zoom-on-double-click | Read / Write |
Implemented Interfaces
ChamplainView implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.
Description
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
.
Functions
champlain_view_new ()
ClutterActor *
champlain_view_new (void
);
Creates an instance of ChamplainView.
Since 0.4
champlain_view_center_on ()
void champlain_view_center_on (ChamplainView *view
,gdouble latitude
,gdouble longitude
);
Centers the map on these coordinates.
Parameters
view |
||
latitude |
the longitude to center the map at |
|
longitude |
the longitude to center the map at |
Since 0.1
champlain_view_go_to ()
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!
Parameters
view |
||
latitude |
the longitude to center the map at |
|
longitude |
the longitude to center the map at |
Since 0.4
champlain_view_stop_go_to ()
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
champlain_view_zoom_in ()
void
champlain_view_zoom_in (ChamplainView *view
);
Zoom in the map by one level.
Since 0.1
champlain_view_zoom_out ()
void
champlain_view_zoom_out (ChamplainView *view
);
Zoom out the map by one level.
Since 0.1
champlain_view_set_zoom_level ()
void champlain_view_set_zoom_level (ChamplainView *view
,guint zoom_level
);
Changes the current level of zoom
Since 0.4
champlain_view_set_min_zoom_level ()
void champlain_view_set_min_zoom_level (ChamplainView *view
,guint zoom_level
);
Changes the lowest allowed level of zoom
Since 0.4
champlain_view_set_max_zoom_level ()
void champlain_view_set_max_zoom_level (ChamplainView *view
,guint zoom_level
);
Changes the highest allowed level of zoom
Since 0.4
champlain_view_ensure_visible ()
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
Parameters
view |
||
bbox |
bounding box of the area that should be visible |
|
animate |
TRUE to perform animation, FALSE otherwise |
Since 0.10
champlain_view_ensure_layers_visible ()
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
champlain_view_set_map_source ()
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
champlain_view_add_overlay_source ()
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
champlain_view_remove_overlay_source ()
void champlain_view_remove_overlay_source (ChamplainView *view
,ChamplainMapSource *map_source
);
Removes an overlay source from ChamplainView.
Since 0.12.5
champlain_view_get_overlay_sources ()
GList *
champlain_view_get_overlay_sources (ChamplainView *view
);
Gets a list of overlay sources.
Since 0.12.5
champlain_view_set_deceleration ()
void champlain_view_set_deceleration (ChamplainView *view
,gdouble rate
);
The deceleration rate for the kinetic mode.
Since 0.4
champlain_view_set_kinetic_mode ()
void champlain_view_set_kinetic_mode (ChamplainView *view
,gboolean kinetic
);
Determines the way the view reacts to scroll events.
Since 0.10
champlain_view_set_keep_center_on_resize ()
void champlain_view_set_keep_center_on_resize (ChamplainView *view
,gboolean value
);
Keep the current centered position when resizing the view.
Since 0.4
champlain_view_set_zoom_on_double_click ()
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
champlain_view_set_animate_zoom ()
void champlain_view_set_animate_zoom (ChamplainView *view
,gboolean value
);
Should the view animate zoom level changes.
Since 0.12
champlain_view_set_background_pattern ()
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
champlain_view_add_layer ()
void champlain_view_add_layer (ChamplainView *view
,ChamplainLayer *layer
);
Adds a new layer to the view
Since 0.2
champlain_view_remove_layer ()
void champlain_view_remove_layer (ChamplainView *view
,ChamplainLayer *layer
);
Removes the given layer from the view
Since 0.4.1
champlain_view_get_zoom_level ()
guint
champlain_view_get_zoom_level (ChamplainView *view
);
Gets the view's current zoom level.
Since 0.4
champlain_view_get_min_zoom_level ()
guint
champlain_view_get_min_zoom_level (ChamplainView *view
);
Gets the view's minimal allowed zoom level.
Since 0.4
champlain_view_get_max_zoom_level ()
guint
champlain_view_get_max_zoom_level (ChamplainView *view
);
Gets the view's maximum allowed zoom level.
Since 0.4
champlain_view_get_map_source ()
ChamplainMapSource *
champlain_view_get_map_source (ChamplainView *view
);
Gets the view's current 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
. g_object_ref()
[transfer none]
Since 0.4
champlain_view_get_deceleration ()
gdouble
champlain_view_get_deceleration (ChamplainView *view
);
Gets the view's deceleration rate.
Since 0.4
champlain_view_get_kinetic_mode ()
gboolean
champlain_view_get_kinetic_mode (ChamplainView *view
);
Gets the view's scroll mode behaviour.
Since 0.10
champlain_view_get_keep_center_on_resize ()
gboolean
champlain_view_get_keep_center_on_resize
(ChamplainView *view
);
Checks whether to keep the center on resize
Since 0.4
champlain_view_get_zoom_on_double_click ()
gboolean
champlain_view_get_zoom_on_double_click
(ChamplainView *view
);
Checks whether the view zooms on double click.
Since 0.4
champlain_view_get_animate_zoom ()
gboolean
champlain_view_get_animate_zoom (ChamplainView *view
);
Checks whether the view animates zoom level changes.
Since 0.12
champlain_view_get_background_pattern ()
ClutterContent *
champlain_view_get_background_pattern (ChamplainView *view
);
Gets the current background texture displayed behind the map.
Since 0.12.4
champlain_view_reload_tiles ()
void
champlain_view_reload_tiles (ChamplainView *view
);
Reloads all visible tiles.
Since 0.8
champlain_view_x_to_longitude ()
gdouble champlain_view_x_to_longitude (ChamplainView *view
,gdouble x
);
Converts the view's x coordinate to longitude.
Since 0.10
champlain_view_y_to_latitude ()
gdouble champlain_view_y_to_latitude (ChamplainView *view
,gdouble y
);
Converts the view's y coordinate to latitude.
Since 0.10
champlain_view_longitude_to_x ()
gdouble champlain_view_longitude_to_x (ChamplainView *view
,gdouble longitude
);
Converts the longitude to view's x coordinate.
Since 0.10
champlain_view_latitude_to_y ()
gdouble champlain_view_latitude_to_y (ChamplainView *view
,gdouble latitude
);
Converts the latitude to view's y coordinate.
Since 0.10
champlain_view_get_viewport_origin ()
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
champlain_view_bin_layout_add ()
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
champlain_view_get_license_actor ()
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
champlain_view_get_center_latitude ()
gdouble
champlain_view_get_center_latitude (ChamplainView *view
);
Gets the latitude of the view's center.
Since 0.10
champlain_view_get_center_longitude ()
gdouble
champlain_view_get_center_longitude (ChamplainView *view
);
Gets the longitude of the view's center.
Since 0.10
champlain_view_get_bounding_box ()
ChamplainBoundingBox *
champlain_view_get_bounding_box (ChamplainView *view
);
Gets the bounding box for view view
at current zoom-level.
Since 0.12.4
champlain_view_get_bounding_box_for_zoom_level ()
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
champlain_view_get_state ()
ChamplainState
champlain_view_get_state (ChamplainView *view
);
Gets the view's state.
Since 0.10
Types and Values
struct ChamplainView
struct ChamplainView;
The ChamplainView structure contains only private data and should be accessed using the provided API
Since 0.1
Property Details
The “animate-zoom”
property
“animate-zoom” gboolean
Animate zoom change when zooming in/out.
Flags: Read / Write
Default value: TRUE
Since 0.12
The “background-pattern”
property
“background-pattern” ClutterActor *
The pattern displayed in the background of the map.
Flags: Read / Write
Since 0.12.4
The “deceleration”
property
“deceleration” gdouble
The deceleration rate for the kinetic mode. The default value is 1.1.
Flags: Read / Write
Allowed values: [1.0001,2]
Default value: 1.1
Since 0.10
The “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.
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 0
The “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.
Flags: Read / Write
Default value: CLUTTER_EASE_IN_OUT_CIRC
The “keep-center-on-resize”
property
“keep-center-on-resize” gboolean
Keep the current centered position when resizing the view.
Flags: Read / Write
Default value: TRUE
Since 0.2.7
The “kinetic-mode”
property
“kinetic-mode” gboolean
Determines whether the view should use kinetic mode.
Flags: Read / Write
Default value: FALSE
Since 0.10
The “latitude”
property
“latitude” gdouble
The latitude coordonate of the map
Flags: Read / Write
Allowed values: [-90,90]
Default value: 0
Since 0.1
The “longitude”
property
“longitude” gdouble
The longitude coordonate of the map
Flags: Read / Write
Allowed values: [-180,180]
Default value: 0
Since 0.1
The “map-source”
property
“map-source” ChamplainMapSource *
The ChamplainMapSource being displayed
Flags: Read / Write
Since 0.2
The “max-zoom-level”
property
“max-zoom-level” guint
The highest allowed level of zoom of the content.
Flags: Read / Write
Allowed values: <= 20
Default value: 20
Since 0.4
The “min-zoom-level”
property
“min-zoom-level” guint
The lowest allowed level of zoom of the content.
Flags: Read / Write
Allowed values: <= 20
Default value: 0
Since 0.4
The “state”
property
“state” ChamplainState
The view's global state. Useful to inform using if the view is busy loading tiles or not.
Flags: Read
Default value: CHAMPLAIN_STATE_NONE
Since 0.4
The “zoom-level”
property
“zoom-level” guint
The level of zoom of the content.
Flags: Read / Write
Allowed values: <= 20
Default value: 3
Since 0.1
The “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.
Flags: Read / Write
Default value: TRUE
Since 0.4
Signal Details
The “animation-completed”
signal
void user_function (ChamplainView *arg0, 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".
Flags: Has Details
Since 0.4
The “layer-relocated”
signal
void user_function (ChamplainView *arg0, 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