ChamplainView

ChamplainView — A widget to display maps

Synopsis


#include <champlain/champlainview.h>

enum                ChamplainMapSource;
enum                ChamplainViewMode;
                    ChamplainView;
GtkWidget*          champlain_view_new                  (ChamplainViewMode mode);
void                champlain_view_center_on            (ChamplainView *view,
                                                         gdouble longitude,
                                                         gdouble latitude);
void                champlain_view_zoom_in              (ChamplainView *champlainView);
void                champlain_view_zoom_out             (ChamplainView *champlainView);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkAlignment
                                       +----ChamplainView

Implemented Interfaces

ChamplainView implements AtkImplementorIface and GtkBuildable.

Properties

  "decel-rate"               gdouble               : Read / Write
  "latitude"                 gfloat                : Read / Write
  "longitude"                gfloat                : Read / Write
  "map-source"               gint                  : Read / Write
  "offline"                  gboolean              : Read / Write
  "zoom-level"               gint                  : Read / Write

Description

The ChamplainView widget is a Clutter based widget 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 ()

GtkWidget*          champlain_view_new                  (ChamplainViewMode mode);

mode :

a ChamplainViewMode, the scrolling mode Returns a new ChamplainWidget ready to be used as a GtkWidget.

Returns :

Since 0.1


champlain_view_center_on ()

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

Centers the map on these coordinates.

view :

a ChamplainView

longitude :

the longitude to center the map at

latitude :

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