1 /* 2 * Copyright (C) 2010-2013 Jiri Techet <techet@gmail.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #if !defined (__CHAMPLAIN_CHAMPLAIN_H_INSIDE__) && !defined (CHAMPLAIN_COMPILATION) 20 #error "Only <champlain/champlain.h> can be included directly." 21 #endif 22 23 #ifndef _CHAMPLAIN_MAP_SOURCE_H_ 24 #define _CHAMPLAIN_MAP_SOURCE_H_ 25 26 #include <champlain/champlain-defines.h> 27 #include <champlain/champlain-tile.h> 28 #include <champlain/champlain-renderer.h> 29 30 G_BEGIN_DECLS 31 32 #define CHAMPLAIN_TYPE_MAP_SOURCE champlain_map_source_get_type () 33 34 #define CHAMPLAIN_MAP_SOURCE(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSource)) 36 37 #define CHAMPLAIN_MAP_SOURCE_CLASS(klass) \ 38 (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourceClass)) 39 40 #define CHAMPLAIN_IS_MAP_SOURCE(obj) \ 41 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE)) 42 43 #define CHAMPLAIN_IS_MAP_SOURCE_CLASS(klass) \ 44 (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MAP_SOURCE)) 45 46 #define CHAMPLAIN_MAP_SOURCE_GET_CLASS(obj) \ 47 (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourceClass)) 48 49 typedef struct _ChamplainMapSourcePrivate ChamplainMapSourcePrivate; 50 51 typedef struct _ChamplainMapSourceClass ChamplainMapSourceClass; 52 53 /** 54 * ChamplainMapProjection: 55 * @CHAMPLAIN_MAP_PROJECTION_MERCATOR: Currently the only supported projection 56 * 57 * Projections supported by the library. 58 */ 59 typedef enum 60 { 61 CHAMPLAIN_MAP_PROJECTION_MERCATOR 62 } ChamplainMapProjection; 63 64 /** 65 * ChamplainMapSource: 66 * 67 * The #ChamplainMapSource structure contains only private data 68 * and should be accessed using the provided API 69 * 70 * Since: 0.4 71 */ 72 struct _ChamplainMapSource 73 { 74 GInitiallyUnowned parent_instance; 75 76 ChamplainMapSourcePrivate *priv; 77 }; 78 79 struct _ChamplainMapSourceClass 80 { 81 GInitiallyUnownedClass parent_class; 82 83 const gchar * (*get_id)(ChamplainMapSource *map_source); 84 const gchar * (*get_name)(ChamplainMapSource *map_source); 85 const gchar * (*get_license)(ChamplainMapSource *map_source); 86 const gchar * (*get_license_uri)(ChamplainMapSource *map_source); 87 guint (*get_min_zoom_level)(ChamplainMapSource *map_source); 88 guint (*get_max_zoom_level)(ChamplainMapSource *map_source); 89 guint (*get_tile_size)(ChamplainMapSource *map_source); 90 ChamplainMapProjection (*get_projection)(ChamplainMapSource *map_source); 91 92 void (*fill_tile)(ChamplainMapSource *map_source, 93 ChamplainTile *tile); 94 }; 95 96 GType champlain_map_source_get_type (void); 97 98 ChamplainMapSource *champlain_map_source_get_next_source (ChamplainMapSource *map_source); 99 void champlain_map_source_set_next_source (ChamplainMapSource *map_source, 100 ChamplainMapSource *next_source); 101 102 ChamplainRenderer *champlain_map_source_get_renderer (ChamplainMapSource *map_source); 103 void champlain_map_source_set_renderer (ChamplainMapSource *map_source, 104 ChamplainRenderer *renderer); 105 106 const gchar *champlain_map_source_get_id (ChamplainMapSource *map_source); 107 const gchar *champlain_map_source_get_name (ChamplainMapSource *map_source); 108 const gchar *champlain_map_source_get_license (ChamplainMapSource *map_source); 109 const gchar *champlain_map_source_get_license_uri (ChamplainMapSource *map_source); 110 guint champlain_map_source_get_min_zoom_level (ChamplainMapSource *map_source); 111 guint champlain_map_source_get_max_zoom_level (ChamplainMapSource *map_source); 112 guint champlain_map_source_get_tile_size (ChamplainMapSource *map_source); 113 ChamplainMapProjection champlain_map_source_get_projection (ChamplainMapSource *map_source); 114 115 gdouble champlain_map_source_get_x (ChamplainMapSource *map_source, 116 guint zoom_level, 117 gdouble longitude); 118 gdouble champlain_map_source_get_y (ChamplainMapSource *map_source, 119 guint zoom_level, 120 gdouble latitude); 121 gdouble champlain_map_source_get_longitude (ChamplainMapSource *map_source, 122 guint zoom_level, 123 gdouble x); 124 gdouble champlain_map_source_get_latitude (ChamplainMapSource *map_source, 125 guint zoom_level, 126 gdouble y); 127 guint champlain_map_source_get_row_count (ChamplainMapSource *map_source, 128 guint zoom_level); 129 guint champlain_map_source_get_column_count (ChamplainMapSource *map_source, 130 guint zoom_level); 131 gdouble champlain_map_source_get_meters_per_pixel (ChamplainMapSource *map_source, 132 guint zoom_level, 133 gdouble latitude, 134 gdouble longitude); 135 136 void champlain_map_source_fill_tile (ChamplainMapSource *map_source, 137 ChamplainTile *tile); 138 139 G_END_DECLS 140 141 #endif /* _CHAMPLAIN_MAP_SOURCE_H_ */ 142