ChamplainMapSourceFactory

## ChamplainMapSourceFactory ChamplainMapSourceFactory — Manages ChamplainMapSource instances |

## Synopsis

    struct              ChamplainMapSourceFactory;
    ChamplainMapSourceFactory * champlain_map_source_factory_dup_default
                                                            (void);
    ChamplainMapSource * champlain_map_source_factory_create
                                                            (ChamplainMapSourceFactory *factory,
                                                             const gchar *id);
    ChamplainMapSource * champlain_map_source_factory_create_cached_source
                                                            (ChamplainMapSourceFactory *factory,
                                                             const gchar *id);
    ChamplainMapSource * champlain_map_source_factory_create_memcached_source
                                                            (ChamplainMapSourceFactory *factory,
                                                             const gchar *id);
    ChamplainMapSource * champlain_map_source_factory_create_error_source
                                                            (ChamplainMapSourceFactory *factory,
                                                             guint tile_size);
    gboolean            champlain_map_source_factory_register
                                                            (ChamplainMapSourceFactory *factory,
                                                             ChamplainMapSourceDesc *desc);
    GSList *            champlain_map_source_factory_get_registered
                                                            (ChamplainMapSourceFactory *factory);
    #define             CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK
    #define             CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP
    #define             CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP
    #define             CHAMPLAIN_MAP_SOURCE_OSM_AERIAL_MAP
    #define             CHAMPLAIN_MAP_SOURCE_OSM_MAPQUEST
    #define             CHAMPLAIN_MAP_SOURCE_MFF_RELIEF
    #define             CHAMPLAIN_MAP_SOURCE_OAM
    #define             CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER
    #define             CHAMPLAIN_MAP_SOURCE_OWM_CLOUDS
    #define             CHAMPLAIN_MAP_SOURCE_OWM_PRECIPITATION
    #define             CHAMPLAIN_MAP_SOURCE_OWM_PRESSURE
    #define             CHAMPLAIN_MAP_SOURCE_OWM_TEMPERATURE
    #define             CHAMPLAIN_MAP_SOURCE_OWM_WIND

## Object Hierarchy

      GObject
       +----ChamplainMapSourceFactory

## Description

This factory manages the create of ChamplainMapSource. It contains names and constructor functions for each available map sources in libchamplain. You can add your own with champlain_map_source_factory_register.

To get the wanted map source, use champlain_map_source_factory_create. It will return a ready to use ChamplainMapSource.

To get the list of registered map sources, use champlain_map_source_factory_get_registered.

## Details

### struct ChamplainMapSourceFactory

    struct ChamplainMapSourceFactory;

The ChamplainMapSourceFactory structure contains only private data and should be accessed using the provided API

Since 0.4

### champlain_map_source_factory_dup_default ()

    ChamplainMapSourceFactory * champlain_map_source_factory_dup_default
                                                            (void);

A method to obtain the singleton object.

Returns : | the singleton ChamplainMapSourceFactory, it should be freed using #`g_object_unref()` when not needed. [transfer full]

Since 0.4

### champlain_map_source_factory_create ()

    ChamplainMapSource * champlain_map_source_factory_create
                                                            (ChamplainMapSourceFactory *factory,
                                                             const gchar *id);

Note: The id should not contain any character that can't be in a filename as it will be used as the cache directory name for that map source.

`factory` : | the Factory
`id` : | the wanted map source id
Returns : | a ready to use ChamplainMapSource matching the given name, returns NULL is none match. [transfer none]

Since 0.4

### champlain_map_source_factory_create_cached_source ()

    ChamplainMapSource * champlain_map_source_factory_create_cached_source
                                                            (ChamplainMapSourceFactory *factory,
                                                             const gchar *id);

Creates a cached map source.

`factory` : | the Factory
`id` : | the wanted map source id
Returns : | a ready to use ChamplainMapSourceChain consisting of ChamplainMemoryCache, ChamplainFileCache, ChamplainMapSource matching the given name, and an error tile source created with `champlain_map_source_factory_create_error_source()`. [transfer none]

Since 0.6

### champlain_map_source_factory_create_memcached_source ()

    ChamplainMapSource * champlain_map_source_factory_create_memcached_source
                                                            (ChamplainMapSourceFactory *factory,
                                                             const gchar *id);

Creates a memory cached map source.

`factory` : | the Factory
`id` : | the wanted map source id
Returns : | a ready to use ChamplainMapSourceChain consisting of ChamplainMemoryCache and ChamplainMapSource matching the given name. [transfer none]

Since 0.12.5

### champlain_map_source_factory_create_error_source ()

    ChamplainMapSource * champlain_map_source_factory_create_error_source
                                                            (ChamplainMapSourceFactory *factory,
                                                             guint tile_size);

Creates a map source generating error tiles.

`factory` : | the Factory
`tile_size` : | the size of the error tile
Returns : | a ready to use map source generating error tiles. [transfer none]

Since 0.8

### champlain_map_source_factory_register ()

    gboolean            champlain_map_source_factory_register
                                                            (ChamplainMapSourceFactory *factory,
                                                             ChamplainMapSourceDesc *desc);

Registers the new map source with the given constructor. When this map source is requested, the given constructor will be used to build the map source. ChamplainMapSourceFactory will take ownership of the passed ChamplainMapSourceDesc, so don't free it.

`factory` : | A ChamplainMapSourceFactory
`desc` : | the description of the map source
Returns : | TRUE if the registration suceeded.

Since 0.10

### champlain_map_source_factory_get_registered ()

    GSList *            champlain_map_source_factory_get_registered
                                                            (ChamplainMapSourceFactory *factory);

Get the list of registered map sources.

`factory` : | the Factory
Returns : | the list of registered map sources, the items should not be freed, the list should be freed with g_slist_free. [transfer container][element-type ChamplainMapSourceDesc]

Since 0.4

### CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK

    #define CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK "osm-mapnik"

OpenStreetMap Mapnik

### CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP

    #define CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP "osm-cyclemap"

OpenStreetMap Cycle Map

### CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP

    #define CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP "osm-transportmap"

OpenStreetMap Transport Map

### CHAMPLAIN_MAP_SOURCE_OSM_AERIAL_MAP

    #define CHAMPLAIN_MAP_SOURCE_OSM_AERIAL_MAP "osm-aerialmap"

Mapquest Open Aerial

### CHAMPLAIN_MAP_SOURCE_OSM_MAPQUEST

    #define CHAMPLAIN_MAP_SOURCE_OSM_MAPQUEST "osm-mapquest"

Mapquest OpenStreetMap

### CHAMPLAIN_MAP_SOURCE_MFF_RELIEF

    #define CHAMPLAIN_MAP_SOURCE_MFF_RELIEF "mff-relief"

Maps for Free Relief

### CHAMPLAIN_MAP_SOURCE_OAM

    #define CHAMPLAIN_MAP_SOURCE_OAM "OpenAerialMap"

### Warning

`CHAMPLAIN_MAP_SOURCE_OAM` is deprecated and should not be used in newly-written code. OpenAerialMap isn't available any more and will be removed in the next release. As it doens't exist, it isn't registered to the factory and the 'create' method won't return any source.

OpenAerialMap

### CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER

    #define CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER "osm-osmarender"

### Warning

`CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER` is deprecated and should not be used in newly-written code. Osmarender isn't available any more and will be removed in the next release. As it doens't exist, it isn't registered to the factory and the 'create' method won't return any source.

OpenStreetMap Osmarender

### CHAMPLAIN_MAP_SOURCE_OWM_CLOUDS

    #define CHAMPLAIN_MAP_SOURCE_OWM_CLOUDS "owm-clouds"

OpenWeatherMap clouds layer

### CHAMPLAIN_MAP_SOURCE_OWM_PRECIPITATION

    #define CHAMPLAIN_MAP_SOURCE_OWM_PRECIPITATION "owm-precipitation"

OpenWeatherMap precipitation

### CHAMPLAIN_MAP_SOURCE_OWM_PRESSURE

    #define CHAMPLAIN_MAP_SOURCE_OWM_PRESSURE "owm-pressure"

OpenWeatherMap sea level pressure

### CHAMPLAIN_MAP_SOURCE_OWM_TEMPERATURE

    #define CHAMPLAIN_MAP_SOURCE_OWM_TEMPERATURE "owm-temperature"

OpenWeatherMap temperature

### CHAMPLAIN_MAP_SOURCE_OWM_WIND

    #define CHAMPLAIN_MAP_SOURCE_OWM_WIND "owm-wind"

OpenWeatherMap wind