![]() |
![]() |
![]() |
libchamplain Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
ChamplainMapSourceFactoryChamplainMapSourceFactory — Manages ChamplainMapSource |
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); gboolean champlain_map_source_factory_register (ChamplainMapSourceFactory *factory, ChamplainMapSourceDesc *desc, ChamplainMapSourceConstructor constructor, gpointer data); ChamplainMapSourceDesc * champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc); void champlain_map_source_desc_free (ChamplainMapSourceDesc *desc); GType champlain_map_source_desc_get_type (void); ChamplainMapSourceDesc * champlain_map_source_desc_new (void);
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.
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 * |
A unique identifier, should contain only characters found in filenames |
gchar * |
A display name |
gchar * |
A display name for the licence of the data |
gchar * |
A URI for the licence of the data |
gint |
the minimum supported zoom level |
gint |
the maximum supported zoom level |
ChamplainMapProjection |
the projection used by the data |
ChamplainMapSourceConstructor |
a function that returns a fully constructed ChamplainMapSource |
gchar * |
the URI to use to fetch network map data |
gpointer |
user data passed to the constructor |
Since 0.4
ChamplainMapSource * (*ChamplainMapSourceConstructor) (ChamplainMapSourceDesc *desc, gpointer data);
A ChamplainMapSource constructor. It should return a ready to use ChamplainMapSource.
|
a ChamplainMapSourceDesc |
|
User data |
Returns : |
A fully constructed ChamplainMapSource ready to be used. |
Since 0.4
ChamplainMapSourceFactory * champlain_map_source_factory_dup_default (void);
Returns : |
the singleton ChamplainMapSourceFactory, it should be freed using g_object_unref when not needed. |
Since 0.4
GSList * champlain_map_source_factory_dup_list (ChamplainMapSourceFactory *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
ChamplainMapSource * champlain_map_source_factory_create (ChamplainMapSourceFactory *factory, const gchar *id);
|
the Factory |
|
the wanted map source id |
Returns : |
a ready to use ChamplainMapSource matching the given name, returns NULL is none match. 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. |
Since 0.4
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.
|
A ChamplainMapSourceFactory |
|
the description of the map source |
|
the new map source constructor function |
|
data to be passed to the constructor function, or NULL |
Returns : |
TRUE if the registration suceeded. |
Since 0.4
ChamplainMapSourceDesc * champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc);
Makes a copy of the map source desc structure. The result must be freed using champlain_map_source_desc_free. All string fields will be duplicated with g_strdup.
|
a ChamplainMapSourceDesc |
Returns : |
an allocated copy of desc .
|
Since 0.4
void champlain_map_source_desc_free (ChamplainMapSourceDesc *desc);
Frees a desc structure created with champlain_map_source_desc_new or champlain_map_source_desc_copy. All strings will be freed with g_free. The data pointer will not be freed.
|
a ChamplainMapSourceDesc |
Since 0.4
ChamplainMapSourceDesc * champlain_map_source_desc_new (void);
Returns : |
a newly allocated ChamplainMapSourceDesc to be freed with champlain_map_source_desc_free |
Since 0.4