Top |
GObject ╰── GInitiallyUnowned ╰── ChamplainMapSource ├── ChamplainTileCache ├── ChamplainTileSource ╰── ChamplainMapSourceChain
ChamplainTile objects come from map sources which are represented by ChamplainMapSource. This is should be considered an abstract type as it does nothing of interest.
When loading new tiles, ChamplainView calls champlain_map_source_fill_tile()
on the current ChamplainMapSource passing it a ChamplainTile to be filled
with the image.
Apart from being a base class of all map sources, ChamplainMapSource also supports cooperation of multiple map sources by arranging them into chains. Every map source has the “next-source” property that determines the next map source in the chain. When a function of a ChamplainMapSource object is invoked, the map source may decide to delegate the work to the next map source in the chain by invoking the same function on it.
To understand the concept of chains, consider for instance a chain
consisting of ChamplainFileCache whose next source is
ChamplainNetworkTileSource whose next source is an error tile source
created with champlain_map_source_factory_create_error_source()
.
When champlain_map_source_fill_tile()
is called on the first object of the
chain, ChamplainFileCache, the cache checks whether it contains the
requested tile in its database. If it does, it returns the tile; otherwise,
it calls champlain_map_source_fill_tile()
on the next source in the chain
(ChamplainNetworkTileSource). The network tile source loads the tile
from the network. When successful, it returns the tile; otherwise it requests
the tile from the next source in the chain (error tile source).
The error tile source always generates an error tile, no matter what
its next source is.
ChamplainMapSource *
champlain_map_source_get_next_source (ChamplainMapSource *map_source
);
Get the next source in the chain.
Since: 0.6
void champlain_map_source_set_next_source (ChamplainMapSource *map_source
,ChamplainMapSource *next_source
);
Sets the next map source in the chain.
Since: 0.6
ChamplainRenderer *
champlain_map_source_get_renderer (ChamplainMapSource *map_source
);
Get the renderer used for tiles rendering.
Since: 0.8
void champlain_map_source_set_renderer (ChamplainMapSource *map_source
,ChamplainRenderer *renderer
);
Sets the renderer used for tiles rendering.
Since: 0.8
const gchar *
champlain_map_source_get_id (ChamplainMapSource *map_source
);
Gets map source's id.
Since: 0.4
const gchar *
champlain_map_source_get_name (ChamplainMapSource *map_source
);
Gets map source's name.
Since: 0.4
const gchar *
champlain_map_source_get_license (ChamplainMapSource *map_source
);
Gets map source's license.
Since: 0.4
const gchar *
champlain_map_source_get_license_uri (ChamplainMapSource *map_source
);
Gets map source's license URI.
Since: 0.4
guint
champlain_map_source_get_min_zoom_level
(ChamplainMapSource *map_source
);
Gets map source's minimum zoom level.
Since: 0.4
guint
champlain_map_source_get_max_zoom_level
(ChamplainMapSource *map_source
);
Gets map source's maximum zoom level.
Since: 0.4
guint
champlain_map_source_get_tile_size (ChamplainMapSource *map_source
);
Gets map source's tile size.
Since: 0.4
ChamplainMapProjection
champlain_map_source_get_projection (ChamplainMapSource *map_source
);
Gets map source's projection.
Since: 0.4
gdouble champlain_map_source_get_x (ChamplainMapSource *map_source
,guint zoom_level
,gdouble longitude
);
Gets the x position on the map using this map source's projection. (0, 0) is located at the top left.
Since: 0.4
gdouble champlain_map_source_get_y (ChamplainMapSource *map_source
,guint zoom_level
,gdouble latitude
);
Gets the y position on the map using this map source's projection. (0, 0) is located at the top left.
Since: 0.4
gdouble champlain_map_source_get_longitude (ChamplainMapSource *map_source
,guint zoom_level
,gdouble x
);
Gets the longitude corresponding to this x position in the map source's projection.
Since: 0.4
gdouble champlain_map_source_get_latitude (ChamplainMapSource *map_source
,guint zoom_level
,gdouble y
);
Gets the latitude corresponding to this y position in the map source's projection.
Since: 0.4
guint champlain_map_source_get_row_count (ChamplainMapSource *map_source
,guint zoom_level
);
Gets the number of tiles in a row at this zoom level for this map source.
Since: 0.4
guint champlain_map_source_get_column_count (ChamplainMapSource *map_source
,guint zoom_level
);
Gets the number of tiles in a column at this zoom level for this map source.
Since: 0.4
gdouble champlain_map_source_get_meters_per_pixel (ChamplainMapSource *map_source
,guint zoom_level
,gdouble latitude
,gdouble longitude
);
Gets meters per pixel at the position on the map using this map source's projection.
Since: 0.4.3
void champlain_map_source_fill_tile (ChamplainMapSource *map_source
,ChamplainTile *tile
);
Fills the tile with image data (either from cache, network or rendered locally).
Since: 0.4
struct ChamplainMapSource;
The ChamplainMapSource structure contains only private data and should be accessed using the provided API
Since: 0.4
“next-source”
property“next-source” ChamplainMapSource *
Next source in the loading chain.
Owner: ChamplainMapSource
Flags: Read / Write
Since: 0.6
“renderer”
property“renderer” ChamplainRenderer *
Renderer used for tiles rendering.
Owner: ChamplainMapSource
Flags: Read / Write
Since: 0.8