![]() |
![]() |
![]() |
libchamplain Reference Manual | ![]() |
---|---|---|---|---|
ChamplainViewChamplainView — A ClutterActor to display maps |
#include <champlain/champlainview.h> enum ChamplainMapSource; enum ChamplainViewMode; ChamplainView; ClutterActor* champlain_view_new (ChamplainViewMode mode); void champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude); void champlain_view_zoom_in (ChamplainView *champlainView); void champlain_view_zoom_out (ChamplainView *champlainView);
GObject +----GInitiallyUnowned +----ClutterActor +----ClutterGroup +----ChamplainView
"decel-rate" gdouble : Read / Write "keep-center-on-resize" gboolean : Read / Write "latitude" gfloat : Read / Write "longitude" gfloat : Read / Write "map-source" gint : Read / Write "offline" gboolean : Read / Write "show-license" gboolean : Read / Write "zoom-level" gint : Read / Write
The ChamplainView is a ClutterActor to display maps. It supports two modes of scrolling:
Push: the normal behavior where the maps doesn'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 (if not in offline mode).
typedef enum { CHAMPLAIN_MAP_SOURCE_DEBUG, CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP, CHAMPLAIN_MAP_SOURCE_OPENARIALMAP, CHAMPLAIN_MAP_SOURCE_MAPSFORFREE_RELIEF, CHAMPLAIN_MAP_SOURCE_COUNT } ChamplainMapSource;
Type of scrolling.
typedef enum { CHAMPLAIN_VIEW_MODE_PUSH, CHAMPLAIN_VIEW_MODE_KINETIC } ChamplainViewMode;
Type of scrolling.
ClutterActor* champlain_view_new (ChamplainViewMode mode);
|
a ChamplainViewMode, the scrolling mode Returns a new ChamplainView ready to be used as a ClutterActor. |
Returns : |
Since 0.1
void champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude);
Centers the map on these coordinates.
|
a ChamplainView |
|
the longitude to center the map at |
|
the longitude to center the map at |
Since 0.1
void champlain_view_zoom_in (ChamplainView *champlainView);
Zoom in the map by one level.
|
Since 0.1
void champlain_view_zoom_out (ChamplainView *champlainView);
Zoom out the map by one level.
|
Since 0.1
"decel-rate"
property"decel-rate" gdouble : Read / Write
The deceleration rate for the kinetic mode.
Allowed values: [1,2]
Default value: 1.1
Since 0.2
"keep-center-on-resize"
property"keep-center-on-resize" gboolean : Read / Write
Keep the current centered position when resizing the view.
Default value: TRUE
Since 0.2.7
"latitude"
property"latitude" gfloat : Read / Write
The latitude coordonate of the map
Allowed values: [-90,90]
Default value: 0
Since 0.1
"longitude"
property"longitude" gfloat : Read / Write
The longitude coordonate of the map
Allowed values: [-180,180]
Default value: 0
Since 0.1
"map-source"
property"map-source" gint : Read / Write
The ChamplainMapSource being displayed
Allowed values: [0,4]
Default value: 1
Since 0.2
"offline"
property"offline" gboolean : Read / Write
If true, will fetch tiles from the Internet, otherwise, will only use cached content.
Default value: FALSE
Since 0.2
"show-license"
property"show-license" gboolean : Read / Write
Show the license on the map view. The license information should always be available in a way or another in your application. You can have it in About, or on the map.
Default value: TRUE
Since 0.2.8
"zoom-level"
property"zoom-level" gint : Read / Write
The level of zoom of the content.
Allowed values: [0,20]
Default value: 3
Since 0.1