ChamplainView

ChamplainView — A ClutterActor to display maps

Synopsis


#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);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----ClutterActor
               +----ClutterGroup
                     +----ChamplainView

Implemented Interfaces

ChamplainView implements ClutterScriptable and ClutterContainer.

Properties

  "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

Description

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).

Details

enum ChamplainMapSource

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.

CHAMPLAIN_MAP_SOURCE_DEBUG

Debug map, untested as of 0.2

CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP

Open Street Map - Mapnick tiles

CHAMPLAIN_MAP_SOURCE_OPENARIALMAP

Open Arial Map

CHAMPLAIN_MAP_SOURCE_MAPSFORFREE_RELIEF

Maps for free - Relief tiles

CHAMPLAIN_MAP_SOURCE_COUNT


enum ChamplainViewMode

typedef enum {
  CHAMPLAIN_VIEW_MODE_PUSH,
  CHAMPLAIN_VIEW_MODE_KINETIC
} ChamplainViewMode;

Type of scrolling.

CHAMPLAIN_VIEW_MODE_PUSH

Non-kinetic scrolling

CHAMPLAIN_VIEW_MODE_KINETIC

Kinetic scrolling

ChamplainView

typedef struct _ChamplainView ChamplainView;


champlain_view_new ()

ClutterActor *      champlain_view_new                  (ChamplainViewMode mode);

mode :

a ChamplainViewMode, the scrolling mode Returns a new ChamplainView ready to be used as a ClutterActor.

Returns :

Since 0.1


champlain_view_center_on ()

void                champlain_view_center_on            (ChamplainView *view,
                                                         gdouble latitude,
                                                         gdouble longitude);

Centers the map on these coordinates.

view :

a ChamplainView

latitude :

the longitude to center the map at

longitude :

the longitude to center the map at

Since 0.1


champlain_view_zoom_in ()

void                champlain_view_zoom_in              (ChamplainView *champlainView);

Zoom in the map by one level.

champlainView :

Since 0.1


champlain_view_zoom_out ()

void                champlain_view_zoom_out             (ChamplainView *champlainView);

Zoom out the map by one level.

champlainView :

Since 0.1

Property Details

The "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


The "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


The "latitude" property

  "latitude"                 gfloat                : Read / Write

The latitude coordonate of the map

Allowed values: [-90,90]

Default value: 0

Since 0.1


The "longitude" property

  "longitude"                gfloat                : Read / Write

The longitude coordonate of the map

Allowed values: [-180,180]

Default value: 0

Since 0.1


The "map-source" property

  "map-source"               gint                  : Read / Write

The ChamplainMapSource being displayed

Allowed values: [0,4]

Default value: 1

Since 0.2


The "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


The "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


The "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