![]() |
![]() |
![]() |
libchamplain Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
struct ChamplainMapSource; enum ChamplainMapProjection; const gchar * champlain_map_source_get_id (ChamplainMapSource *map_source
); const gchar * champlain_map_source_get_name (ChamplainMapSource *map_source
); const gchar * champlain_map_source_get_license (ChamplainMapSource *map_source
); const gchar * champlain_map_source_get_license_uri (ChamplainMapSource *map_source
); guint champlain_map_source_get_min_zoom_level (ChamplainMapSource *map_source
); guint champlain_map_source_get_max_zoom_level (ChamplainMapSource *map_source
); guint champlain_map_source_get_tile_size (ChamplainMapSource *map_source
); ChamplainMapProjection champlain_map_source_get_projection (ChamplainMapSource *map_source
); guint champlain_map_source_get_x (ChamplainMapSource *map_source
,guint zoom_level
,gdouble longitude
); guint champlain_map_source_get_y (ChamplainMapSource *map_source
,guint zoom_level
,gdouble latitude
); gdouble champlain_map_source_get_longitude (ChamplainMapSource *map_source
,guint zoom_level
,guint x
); gdouble champlain_map_source_get_latitude (ChamplainMapSource *map_source
,guint zoom_level
,guint y
); guint champlain_map_source_get_row_count (ChamplainMapSource *map_source
,guint zoom_level
); guint champlain_map_source_get_column_count (ChamplainMapSource *map_source
,guint zoom_level
); gdouble champlain_map_source_get_meters_per_pixel (ChamplainMapSource *map_source
,guint zoom_level
,gdouble latitude
,gdouble longitude
); void champlain_map_source_fill_tile (ChamplainMapSource *map_source
,ChamplainTile *tile
); ChamplainMapSource * champlain_map_source_get_next_source (ChamplainMapSource *map_source
); void champlain_map_source_set_next_source (ChamplainMapSource *map_source
,ChamplainMapSource *next_source
);
GObject +----GInitiallyUnowned +----ChamplainMapSource +----ChamplainTileSource +----ChamplainTileCache +----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 undertand the concept of chains, consider for instance a chain
consisting of ChamplainFileCache whose next source is
ChamplainNetworkTileSource whose next source is ChamplainErrorTileSource.
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 (ChamplainErrorTileSource).
ChamplainErrorTileSource always generates an error tile, no matter what
its next source is.
typedef enum { CHAMPLAIN_MAP_PROJECTION_MERCATOR } ChamplainMapProjection;
Projections supported by the library.
const gchar * champlain_map_source_get_id (ChamplainMapSource *map_source
);
Gets map source's id.
|
a ChamplainMapSource |
Returns : |
the map source's id. |
Since 0.4
const gchar * champlain_map_source_get_name (ChamplainMapSource *map_source
);
Gets map source's name.
|
a ChamplainMapSource |
Returns : |
the map source's name. |
Since 0.4
const gchar * champlain_map_source_get_license (ChamplainMapSource *map_source
);
Gets map source's license.
|
a ChamplainMapSource |
Returns : |
the map source's license. |
Since 0.4
const gchar * champlain_map_source_get_license_uri
(ChamplainMapSource *map_source
);
Gets map source's license URI.
|
a ChamplainMapSource |
Returns : |
the 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.
|
a ChamplainMapSource |
Returns : |
the miminum zoom level this map source supports |
Since 0.4
guint champlain_map_source_get_max_zoom_level
(ChamplainMapSource *map_source
);
Gets map source's maximum zoom level.
|
a ChamplainMapSource |
Returns : |
the maximum zoom level this map source supports |
Since 0.4
guint champlain_map_source_get_tile_size (ChamplainMapSource *map_source
);
Gets map source's tile size.
|
a ChamplainMapSource |
Returns : |
the tile's size (width and height) in pixels for this map source |
Since 0.4
ChamplainMapProjection champlain_map_source_get_projection
(ChamplainMapSource *map_source
);
Gets map source's projection.
|
a ChamplainMapSource |
Returns : |
the map source's projection. |
Since 0.4
guint 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.
|
a ChamplainMapSource |
|
the zoom level |
|
a longitude |
Returns : |
the x position |
Since 0.4
guint 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.
|
a ChamplainMapSource |
|
the zoom level |
|
a latitude |
Returns : |
the y position |
Since 0.4
gdouble champlain_map_source_get_longitude (ChamplainMapSource *map_source
,guint zoom_level
,guint x
);
Gets the longitude corresponding to this x position in the map source's projection.
|
a ChamplainMapSource |
|
the zoom level |
|
a x position |
Returns : |
the longitude |
Since 0.4
gdouble champlain_map_source_get_latitude (ChamplainMapSource *map_source
,guint zoom_level
,guint y
);
Gets the latitude corresponding to this y position in the map source's projection.
|
a ChamplainMapSource |
|
the zoom level |
|
a y position |
Returns : |
the latitude |
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.
|
a ChamplainMapSource |
|
the zoom level |
Returns : |
the number of tiles in a row |
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.
|
a ChamplainMapSource |
|
the zoom level |
Returns : |
the number of tiles in a column |
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.
|
a ChamplainMapSource |
|
the zoom level |
|
a latitude |
|
a longitude |
Returns : |
the meters per pixel |
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).
|
a ChamplainMapSource |
|
A ChamplainTile |
Since 0.4
ChamplainMapSource * champlain_map_source_get_next_source
(ChamplainMapSource *map_source
);
Get the next source in the chain.
|
a ChamplainMapSource |
Returns : |
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.
|
a ChamplainMapSource |
|
the next ChamplainMapSource in the chain |
Since 0.6
"next-source"
property"next-source" ChamplainMapSource* : Read / Write
Next source in the loading chain.
Since 0.6
"reload-tiles"
signalvoid user_function (ChamplainMapSource *map_source, gpointer user_data) : Run Last
The ChamplainMapSource::reload-tiles signal is emitted when the map source changed its style or data
|
the ChamplainMapSource that received the signal |
|
user data set when the signal handler was connected. |
Since 0.6