In the race to the 0.3 development release, we are reviewing the API to see it is nice to use, bindable and most of all intuitive to g* coders. But sometimes, it is hard to find out how to do it well: comments on this particular issue would be appreciated.
ChamplainView is the map view that displays the map. It needs a ChamplainMapSource from which it gets the map. There are specialised objects that inherit from ChamplainMapSource such as ChamplainNetworkMapSource and the upcoming ChamplainLocalMapSource (or what ever it will be named by the end of the SoC).
champlainNetworkMapSource* champlain_network_map_source_new_full (const gchar *name,
const gchar *license,
const gchar *license_uri,
guint min_zoom,
guint map_zoom,
guint tile_size,
ChamplainMapProjection projection,
const gchar *uri_format);
As you don’t want to fill all this information each time you create a new map source, libchamplain currently provides helper constructions:
ChamplainMapSource * champlain_map_source_new_osm_mapnik (void);
ChamplainMapSource * champlain_map_source_new_osm_cyclemap (void);
ChamplainMapSource * champlain_map_source_new_osm_osmarender (void);
ChamplainMapSource * champlain_map_source_new_oam (void);
ChamplainMapSource * champlain_map_source_new_mff_relief (void);
We think it could be interesting to replace these by a Factory to which you pass an enum value to get the constructed ChamplainMapSource. You would probably be able to add your own map source constructor (as you can implement your own map sources). You would probably be able to get the list of available map source too.
The question is: is this overkill? the best way to do it? is there something similar in glib or gtk to get inspired from? We base most of the API decisions by looking at other Gtk+ widgets, but this particular object seems to be a different case.
We are asking for your ideas.
11 Responses