ChamplainMapSourceFactory

ChamplainMapSourceFactory — Manages ChamplainMapSource instances

Synopsis

                    ChamplainMapSourceFactory;
                    ChamplainMapSourceDesc;
ChamplainMapSource * (*ChamplainMapSourceConstructor)   (ChamplainMapSourceDesc *desc,
                                                         gpointer data);
ChamplainMapSourceFactory * champlain_map_source_factory_dup_default
                                                        (void);
GSList *            champlain_map_source_factory_dup_list
                                                        (ChamplainMapSourceFactory *factory);
ChamplainMapSource * champlain_map_source_factory_create
                                                        (ChamplainMapSourceFactory *factory,
                                                         const gchar *id);
ChamplainMapSource * champlain_map_source_factory_create_cached_source
                                                        (ChamplainMapSourceFactory *factory,
                                                         const gchar *id);
gboolean            champlain_map_source_factory_register
                                                        (ChamplainMapSourceFactory *factory,
                                                         ChamplainMapSourceDesc *desc,
                                                         ChamplainMapSourceConstructor constructor,
                                                         gpointer data);
#define             CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK
#define             CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER
#define             CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP
#define             CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP
#define             CHAMPLAIN_MAP_SOURCE_OAM
#define             CHAMPLAIN_MAP_SOURCE_MFF_RELIEF
#define             CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL
#define             CHAMPLAIN_MAP_SOURCE_MEMPHIS_NETWORK

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

Details

ChamplainMapSourceFactory

typedef struct _ChamplainMapSourceFactory ChamplainMapSourceFactory;


ChamplainMapSourceDesc

typedef struct {
  gchar *id;
  gchar *name;
  gchar *license;
  gchar *license_uri;
  gint min_zoom_level;
  gint max_zoom_level;
  ChamplainMapProjection projection;
  ChamplainMapSourceConstructor constructor;
  gchar *uri_format;
  gpointer data;
} ChamplainMapSourceDesc;

Describes a ChamplainMapSource. This is returned by champlain_map_source_factory_get_list.

gchar *id;

A unique identifier, should contain only characters found in filenames

gchar *name;

A display name

gchar *license;

A display name for the licence of the data

gchar *license_uri;

A URI for the licence of the data

gint min_zoom_level;

the minimum supported zoom level

gint max_zoom_level;

the maximum supported zoom level

ChamplainMapProjection projection;

the projection used by the data

ChamplainMapSourceConstructor constructor;

a function that returns a fully constructed ChamplainMapSource

gchar *uri_format;

the URI to use to fetch network map data

gpointer data;

user data passed to the constructor

Since 0.4


ChamplainMapSourceConstructor ()

ChamplainMapSource * (*ChamplainMapSourceConstructor)   (ChamplainMapSourceDesc *desc,
                                                         gpointer data);

A ChamplainMapSource constructor. It should return a ready to use ChamplainMapSource.

desc :

a ChamplainMapSourceDesc

data :

User data

Returns :

A fully constructed ChamplainMapSource ready to be used.

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.

Since 0.4


champlain_map_source_factory_dup_list ()

GSList *            champlain_map_source_factory_dup_list
                                                        (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.

Since 0.4


champlain_map_source_factory_create ()

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

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.

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 ChamplainFileCache, ChamplainMapSource matching the given name, and ChamplainErrorTileSource.

Since 0.6


champlain_map_source_factory_register ()

gboolean            champlain_map_source_factory_register
                                                        (ChamplainMapSourceFactory *factory,
                                                         ChamplainMapSourceDesc *desc,
                                                         ChamplainMapSourceConstructor constructor,
                                                         gpointer data);

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. They will not be freed either so you can use static structs here.

factory :

A ChamplainMapSourceFactory

desc :

the description of the map source

constructor :

the new map source constructor function

data :

data to be passed to the constructor function, or NULL

Returns :

TRUE if the registration suceeded.

Since 0.4


CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK

#define             CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK

OpenStreetMap Mapnik


CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER

#define             CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER

OpenStreetMap Osmarender


CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP

#define             CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP

OpenStreetMap Cycle Map


CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP

#define             CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP

OpenStreetMap Transport Map


CHAMPLAIN_MAP_SOURCE_OAM

#define             CHAMPLAIN_MAP_SOURCE_OAM

OpenAerialMap


CHAMPLAIN_MAP_SOURCE_MFF_RELIEF

#define             CHAMPLAIN_MAP_SOURCE_MFF_RELIEF

Maps for Free Relief


CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL

#define CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL "memphis-local"

OpenStreetMap Memphis Local Map


CHAMPLAIN_MAP_SOURCE_MEMPHIS_NETWORK

#define CHAMPLAIN_MAP_SOURCE_MEMPHIS_NETWORK "memphis-network"

OpenStreetMap Memphis Network Map