ChamplainNetworkMapSource

ChamplainNetworkMapSource — A base object for network map sources

Synopsis

                    ChamplainNetworkMapSource;
ChamplainNetworkMapSource* champlain_network_map_source_new_full
                                                        (const gchar *id,
                                                         const gchar *name,
                                                         const gchar *license,
                                                         const gchar *license_uri,
                                                         guint min_zoom,
                                                         guint max_zoom,
                                                         guint tile_size,
                                                         ChamplainMapProjection projection,
                                                         const gchar *uri_format);
gchar *             champlain_network_map_source_get_tile_uri
                                                        (ChamplainNetworkMapSource *source,
                                                         gint x,
                                                         gint y,
                                                         gint z);
void                champlain_network_map_source_set_uri_format
                                                        (ChamplainNetworkMapSource *source,
                                                         const gchar *uri_format);
void                champlain_network_map_source_fill_tile
                                                        (ChamplainMapSource *map_source,
                                                         ChamplainTile *tile);

Object Hierarchy

  GObject
   +----ChamplainMapSource
         +----ChamplainNetworkMapSource

Properties

  "offline"                  gboolean              : Read / Write
  "proxy-uri"                gchar*                : Read / Write
  "uri-format"               gchar*                : Read / Write / Construct

Description

This object is specialized for map tiles that can be downloaded from a web server. This include all web based map services such as OpenStreetMap, Google Maps, Yahoo Maps and more. This object contains all mechanisms necessary to download and cache (with the help of ChamplainCache) tiles.

Some preconfigured network map sources are built-in this library, see ChamplainMapSourceFactory.

Details

ChamplainNetworkMapSource

typedef struct _ChamplainNetworkMapSource ChamplainNetworkMapSource;


champlain_network_map_source_new_full ()

ChamplainNetworkMapSource* champlain_network_map_source_new_full
                                                        (const gchar *id,
                                                         const gchar *name,
                                                         const gchar *license,
                                                         const gchar *license_uri,
                                                         guint min_zoom,
                                                         guint max_zoom,
                                                         guint tile_size,
                                                         ChamplainMapProjection projection,
                                                         const gchar *uri_format);

id :

name :

the map source's name

license :

the map source's license

license_uri :

the map source's license URI

min_zoom :

the map source's minimum zoom level

max_zoom :

the map source's maximum zoom level

tile_size :

the map source's tile size (in pixels)

projection :

the map source's projection

uri_format :

the URI to fetch the tiles from, see champlain_network_map_source_set_uri_format

Returns :

a constructed ChamplainNetworkMapSource

Since 0.4


champlain_network_map_source_get_tile_uri ()

gchar *             champlain_network_map_source_get_tile_uri
                                                        (ChamplainNetworkMapSource *source,
                                                         gint x,
                                                         gint y,
                                                         gint z);

source :

the ChamplainNetworkMapSource

x :

the x position of the tile

y :

the y position of the tile

z :

the zool level of the tile

Returns :

a contruscted URI with the given parameters based on the map source's URI format.

Since 0.4


champlain_network_map_source_set_uri_format ()

void                champlain_network_map_source_set_uri_format
                                                        (ChamplainNetworkMapSource *source,
                                                         const gchar *uri_format);

A URI format is a URI where x, y and zoom level information have been marked for parsing and insertion. There can be an unlimited number of marked items in a URI format. They are delimited by "#" before and after the variable name. There are 3 defined variable names: X, Y, and Z.

For example, this is the OpenStreetMap URI format: "http://tile.openstreetmap.org/Z#/X#/Y#.png"

source :

the ChamplainNetworkMapSource

uri_format :

the URI format

Since 0.4


champlain_network_map_source_fill_tile ()

void                champlain_network_map_source_fill_tile
                                                        (ChamplainMapSource *map_source,
                                                         ChamplainTile *tile);

Fills the passed tile with image data. If not in ChamplainCache, this function will initiate an async download of the image at the map source's URI format. Once done, the tile's state will be set to CHAMPLAIN_STATE_DONE.

map_source :

the ChamplainNetworkMapSource

tile :

the ChamplainTile

Since 0.4

Property Details

The "offline" property

  "offline"                  gboolean              : Read / Write

If the network map source can access network

Default value: FALSE

Since 0.4


The "proxy-uri" property

  "proxy-uri"                gchar*                : Read / Write

The proxy uri to use to access network

Default value: ""

Since 0.4


The "uri-format" property

  "uri-format"               gchar*                : Read / Write / Construct

The uri format for the map source, see champlain_network_map_source_set_uri_format

Default value: ""

Since 0.4