![]() |
![]() |
![]() |
libchamplain Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
ChamplainMapSourceFactoryChamplainMapSourceFactory — Manages ChamplainMapSource |
ChamplainMapSourceFactory; ChamplainMapSourceDesc; ChamplainMapSource * (*ChamplainMapSourceConstructor) (); ChamplainMapSourceFactory * champlain_map_source_factory_get_default (void); GSList * champlain_map_source_factory_get_list (ChamplainMapSourceFactory *factory); ChamplainMapSource * champlain_map_source_factory_create (ChamplainMapSourceFactory *factory, const gchar *id); gboolean champlain_map_source_factory_register (ChamplainMapSourceFactory *factory, ChamplainMapSourceDesc *desc);
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_list.
typedef struct { gchar *id; gchar *name; gchar *license; gchar *license_uri; gint min_zoom_level; gint max_zoom_level; ChamplainMapProjection projection; ChamplainMapSourceConstructor constructor; } ChamplainMapSourceDesc;
Describes a ChamplainMapSource. This is returned by champlain_map_source_factory_get_list.
Since 0.4
ChamplainMapSource * (*ChamplainMapSourceConstructor) ();
A ChamplainMapSource constructor. It should return a ready to use ChamplainMapSource.
Returns : |
Since 0.4
ChamplainMapSourceFactory * champlain_map_source_factory_get_default (void);
Returns : |
the singleton ChamplainMapSourceFactory |
Since 0.4
GSList * champlain_map_source_factory_get_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. |
Since 0.4
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. They will not be freed either so you can use static structs here.
|
the Factory |
|
|
Returns : |
TRUE if the registration suceeded. |
Since 0.4