ChamplainMapSource

## ChamplainMapSource ChamplainMapSource — A base class for map sources |

## Synopsis

    enum                ChamplainMapProjection;
                        ChamplainMapSource;
    gint                champlain_map_source_get_min_zoom_level
                                                            (ChamplainMapSource *map_source);
    gint                champlain_map_source_get_max_zoom_level
                                                            (ChamplainMapSource *map_source);
    guint               champlain_map_source_get_tile_size  (ChamplainMapSource *map_source);
    guint               champlain_map_source_get_x          (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             gdouble longitude);
    guint               champlain_map_source_get_y          (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             gdouble latitude);
    gdouble             champlain_map_source_get_longitude  (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             guint x);
    gdouble             champlain_map_source_get_latitude   (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             guint y);
    guint               champlain_map_source_get_row_count  (ChamplainMapSource *map_source,
                                                             gint zoom_level);
    guint               champlain_map_source_get_column_count
                                                            (ChamplainMapSource *map_source,
                                                             gint zoom_level);
    void                champlain_map_source_fill_tile      (ChamplainMapSource *map_source,
                                                             ChamplainTile *tile);
    void                champlain_map_source_set_name       (ChamplainMapSource *map_source,
                                                             const gchar *name);
    const gchar *       champlain_map_source_get_name       (ChamplainMapSource *map_source);
    void                champlain_map_source_set_license    (ChamplainMapSource *map_source,
                                                             const gchar *license);
    const gchar *       champlain_map_source_get_license    (ChamplainMapSource *map_source);
    void                champlain_map_source_set_license_uri
                                                            (ChamplainMapSource *map_source,
                                                             const gchar *license_uri);
    const gchar *       champlain_map_source_get_license_uri
                                                            (ChamplainMapSource *map_source);
    void                champlain_map_source_set_projection (ChamplainMapSource *map_source,
                                                             ChamplainMapProjection projection);
    ChamplainMapProjection  champlain_map_source_get_projection
                                                            (ChamplainMapSource *map_source);
    const gchar *       champlain_map_source_get_id         (ChamplainMapSource *map_source);
    void                champlain_map_source_set_id         (ChamplainMapSource *map_source,
                                                             const gchar *id);

## Object Hierarchy

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

## Properties

      "id"                       gchar*                : Read / Write / Construct
      "license"                  gchar*                : Read / Write / Construct
      "license-uri"              gchar*                : Read / Write / Construct
      "max-zoom-level"           guint                 : Read / Write / Construct
      "min-zoom-level"           guint                 : Read / Write / Construct
      "name"                     gchar*                : Read / Write / Construct
      "projection"               ChamplainMapProjection  : Read / Write / Construct
      "tile-size"                guint                 : Read / Write / Construct

## Description

ChamplainTiles come from map sources which are represented by ChamplainMapSource. This is should be considered an abstract type as it does nothing of interest.

When loading new tiles, ChamplainView calls champlain_map_source_get_tile on the current ChamplainMapSource passing it a ChamplainTile to be filled with the image. ChamplainMapSources should check with ChamplainCache if the image is already locally available with champlain_cache_fill_tile.

## Details

### enum ChamplainMapProjection

    typedef enum
    {
      CHAMPLAIN_MAP_PROJECTION_MERCATOR
    } ChamplainMapProjection;

### ChamplainMapSource

    typedef struct _ChamplainMapSource ChamplainMapSource;

### champlain_map_source_get_min_zoom_level ()

    gint                champlain_map_source_get_min_zoom_level
                                                            (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the miminum zoom level this map source supports

Since 0.4

### champlain_map_source_get_max_zoom_level ()

    gint                champlain_map_source_get_max_zoom_level
                                                            (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the maximum zoom level this map source supports

Since 0.4

### champlain_map_source_get_tile_size ()

    guint               champlain_map_source_get_tile_size  (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the tile's size (width and height) in pixels for this map source

Since 0.4

### champlain_map_source_get_x ()

    guint               champlain_map_source_get_x          (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             gdouble longitude);

`map_source` : | a ChamplainMapSource
`zoom_level` : | the zoom level
`longitude` : | a longitude
Returns : | the x position on the map using this map source's projection. (0, 0) is located at the top left.

Since 0.4

### champlain_map_source_get_y ()

    guint               champlain_map_source_get_y          (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             gdouble latitude);

`map_source` : | a ChamplainMapSource
`zoom_level` : | the zoom level
`latitude` : | a latitude
Returns : | the y position on the map using this map source's projection. (0, 0) is located at the top left.

Since 0.4

### champlain_map_source_get_longitude ()

    gdouble             champlain_map_source_get_longitude  (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             guint x);

`map_source` : | a ChamplainMapSource
`zoom_level` : | the zoom level
`x` : | a x position
Returns : | the longitude corresponding to this x position in the map source's projection.

Since 0.4

### champlain_map_source_get_latitude ()

    gdouble             champlain_map_source_get_latitude   (ChamplainMapSource *map_source,
                                                             gint zoom_level,
                                                             guint y);

`map_source` : | a ChamplainMapSource
`zoom_level` : | the zoom level
`y` : | a y position
Returns : | the latitude corresponding to this y position in the map source's projection.

Since 0.4

### champlain_map_source_get_row_count ()

    guint               champlain_map_source_get_row_count  (ChamplainMapSource *map_source,
                                                             gint zoom_level);

`map_source` : | a ChamplainMapSource
`zoom_level` : | the zoom level
Returns : | the number of tiles in a row at this zoom level for this map source.

Since 0.4

### champlain_map_source_get_column_count ()

    guint               champlain_map_source_get_column_count
                                                            (ChamplainMapSource *map_source,
                                                             gint zoom_level);

`map_source` : | a ChamplainMapSource
`zoom_level` : | the zoom level
Returns : | the number of tiles in a column at this zoom level for this map source.

Since 0.4

### champlain_map_source_fill_tile ()

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

Fills the tile with image data (either from cache, network or rendered locally).

`map_source` : | a ChamplainMapSource
`tile` : | A ChamplainTile

Since 0.4

### champlain_map_source_set_name ()

    void                champlain_map_source_set_name       (ChamplainMapSource *map_source,
                                                             const gchar *name);

Sets the map source's name.

`map_source` : | a ChamplainMapSource
`name` : | a name

Since 0.4

### champlain_map_source_get_name ()

    const gchar *       champlain_map_source_get_name       (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the map source's name.

Since 0.4

### champlain_map_source_set_license ()

    void                champlain_map_source_set_license    (ChamplainMapSource *map_source,
                                                             const gchar *license);

Sets the map source's license.

`map_source` : | a ChamplainMapSource
`license` : | the licence

Since 0.4

### champlain_map_source_get_license ()

    const gchar *       champlain_map_source_get_license    (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the map source's license.

Since 0.4

### champlain_map_source_set_license_uri ()

    void                champlain_map_source_set_license_uri
                                                            (ChamplainMapSource *map_source,
                                                             const gchar *license_uri);

Sets the map source's license URI.

`map_source` : | a ChamplainMapSource
`license_uri` : | the licence URI

Since 0.4

### champlain_map_source_get_license_uri ()

    const gchar *       champlain_map_source_get_license_uri
                                                            (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the map source's license URI.

Since 0.4

### champlain_map_source_set_projection ()

    void                champlain_map_source_set_projection (ChamplainMapSource *map_source,
                                                             ChamplainMapProjection projection);

Sets the map source's projection.

`map_source` : | a ChamplainMapSource
`projection` : | a ChamplainMapProjection

Since 0.4

### champlain_map_source_get_projection ()

    ChamplainMapProjection  champlain_map_source_get_projection
                                                            (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the map source's projection.

Since 0.4

### champlain_map_source_get_id ()

    const gchar *       champlain_map_source_get_id         (ChamplainMapSource *map_source);

`map_source` : | a ChamplainMapSource
Returns : | the map source's id.

Since 0.4

### champlain_map_source_set_id ()

    void                champlain_map_source_set_id         (ChamplainMapSource *map_source,
                                                             const gchar *id);

Sets the map source's id.

`map_source` : | a ChamplainMapSource
`id` : | a id

Since 0.4

## Property Details

### The `"id"` property

      "id"                       gchar*                : Read / Write / Construct

The name of the map source

Default value: ""

Since 0.4

### The `"license"` property

      "license"                  gchar*                : Read / Write / Construct

The usage license of the map source

Default value: ""

Since 0.4

### The `"license-uri"` property

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

The usage license's uri for more information

Default value: ""

Since 0.4

### The `"max-zoom-level"` property

      "max-zoom-level"           guint                 : Read / Write / Construct

The maximum zoom level

Allowed values: <= 50

Default value: 18

Since 0.4

### The `"min-zoom-level"` property

      "min-zoom-level"           guint                 : Read / Write / Construct

The minimum zoom level

Allowed values: <= 50

Default value: 0

Since 0.4

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct

The name of the map source

Default value: ""

Since 0.4

### The `"projection"` property

      "projection"               ChamplainMapProjection  : Read / Write / Construct

The map projection of the map source

Default value: CHAMPLAIN_MAP_PROJECTION_MERCATOR

Since 0.4

### The `"tile-size"` property

      "tile-size"                guint                 : Read / Write / Construct

The tile size of the map source

Allowed values: <= 2048

Default value: 256

Since 0.4