4 |
* osm-gps-map.h |
* osm-gps-map.h |
5 |
* Copyright (C) Marcus Bauer 2008 <marcus.bauer@gmail.com> |
* Copyright (C) Marcus Bauer 2008 <marcus.bauer@gmail.com> |
6 |
* Copyright (C) John Stowers 2009 <john.stowers@gmail.com> |
* Copyright (C) John Stowers 2009 <john.stowers@gmail.com> |
7 |
|
* Copyright (C) Till Harbaum 2009 <till@harbaum.org> |
8 |
* |
* |
9 |
* Contributions by |
* Contributions by |
10 |
* Everaldo Canuto 2009 <everaldo.canuto@gmail.com> |
* Everaldo Canuto 2009 <everaldo.canuto@gmail.com> |
11 |
* |
* |
12 |
* osm-gps-map.c is free software: you can redistribute it and/or modify it |
* This is free software: you can redistribute it and/or modify it |
13 |
* under the terms of the GNU General Public License as published by the |
* under the terms of the GNU General Public License |
14 |
* Free Software Foundation, either version 3 of the License, or |
* as published by the Free Software Foundation; version 2. |
|
* (at your option) any later version. |
|
15 |
* |
* |
16 |
* osm-gps-map.c is distributed in the hope that it will be useful, but |
* This program is distributed in the hope that it will be useful, |
17 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 |
* See the GNU General Public License for more details. |
* GNU General Public License for more details. |
20 |
* |
* |
21 |
* You should have received a copy of the GNU General Public License along |
* You should have received a copy of the GNU General Public License |
22 |
* with this program. If not, see <http://www.gnu.org/licenses/>. |
* along with this program; if not, see <http://www.gnu.org/licenses/>. |
23 |
*/ |
*/ |
24 |
|
|
25 |
#ifndef _OSM_GPS_MAP_H_ |
#ifndef _OSM_GPS_MAP_H_ |
65 |
OSM_GPS_MAP_SOURCE_NULL, |
OSM_GPS_MAP_SOURCE_NULL, |
66 |
OSM_GPS_MAP_SOURCE_OPENSTREETMAP, |
OSM_GPS_MAP_SOURCE_OPENSTREETMAP, |
67 |
OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER, |
OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER, |
68 |
|
OSM_GPS_MAP_SOURCE_OPENAERIALMAP, |
69 |
|
OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE, |
70 |
OSM_GPS_MAP_SOURCE_OPENCYCLEMAP, |
OSM_GPS_MAP_SOURCE_OPENCYCLEMAP, |
71 |
OSM_GPS_MAP_SOURCE_OSMC_TRAILS, |
OSM_GPS_MAP_SOURCE_OSM_PUBLIC_TRANSPORT, |
72 |
OSM_GPS_MAP_SOURCE_GOOGLE_STREET, |
OSM_GPS_MAP_SOURCE_GOOGLE_STREET, |
73 |
OSM_GPS_MAP_SOURCE_GOOGLE_SATELLITE, |
OSM_GPS_MAP_SOURCE_GOOGLE_SATELLITE, |
74 |
|
OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID, |
75 |
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET, |
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET, |
76 |
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_SATELLITE, |
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_SATELLITE, |
77 |
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID, |
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID, |
78 |
|
OSM_GPS_MAP_SOURCE_YAHOO_STREET, |
79 |
|
OSM_GPS_MAP_SOURCE_YAHOO_SATELLITE, |
80 |
|
OSM_GPS_MAP_SOURCE_YAHOO_HYBRID, |
81 |
|
OSM_GPS_MAP_SOURCE_OSMC_TRAILS, |
82 |
|
|
83 |
/* entries below are currently unusable */ |
OSM_GPS_MAP_SOURCE_LAST |
|
OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE, /* not enough details */ |
|
|
OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID, /* disabled by google */ |
|
|
OSM_GPS_MAP_SOURCE_YAHOO_STREET, /* no implemented yet */ |
|
|
OSM_GPS_MAP_SOURCE_YAHOO_SATELLITE, /* no implemented yet */ |
|
|
OSM_GPS_MAP_SOURCE_YAHOO_HYBRID /* no implemented yet */ |
|
84 |
} OsmGpsMapSource_t; |
} OsmGpsMapSource_t; |
85 |
|
|
86 |
#define OSM_GPS_MAP_SOURCE_LAST (OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID) |
typedef enum { |
87 |
|
OSM_GPS_MAP_KEY_FULLSCREEN, |
88 |
#define OSM_GPS_MAP_INVALID (0.0/0.0) |
OSM_GPS_MAP_KEY_ZOOMIN, |
89 |
|
OSM_GPS_MAP_KEY_ZOOMOUT, |
90 |
|
OSM_GPS_MAP_KEY_UP, |
91 |
|
OSM_GPS_MAP_KEY_DOWN, |
92 |
|
OSM_GPS_MAP_KEY_LEFT, |
93 |
|
OSM_GPS_MAP_KEY_RIGHT, |
94 |
|
OSM_GPS_MAP_KEY_MAX |
95 |
|
} OsmGpsMapKey_t; |
96 |
|
|
97 |
|
#define OSM_GPS_MAP_INVALID (0.0/0.0) |
98 |
|
#define OSM_GPS_MAP_CACHE_DISABLED "none://" |
99 |
|
#define OSM_GPS_MAP_CACHE_AUTO "auto://" |
100 |
|
#define OSM_GPS_MAP_CACHE_FRIENDLY "friendly://" |
101 |
|
|
102 |
typedef struct { |
typedef struct { |
103 |
gint x, y, w, h; |
gint x, y, w, h; |
125 |
|
|
126 |
void(*render)(struct osm_gps_map_osd_s *); |
void(*render)(struct osm_gps_map_osd_s *); |
127 |
void(*draw)(struct osm_gps_map_osd_s *, GdkDrawable *); |
void(*draw)(struct osm_gps_map_osd_s *, GdkDrawable *); |
128 |
osd_button_t(*check)(struct osm_gps_map_osd_s *,gint, gint); /* check if x/y lies within OSD */ |
osd_button_t(*check)(struct osm_gps_map_osd_s *,gboolean,gint, gint); /* check if x/y lies within OSD */ |
129 |
gboolean(*busy)(struct osm_gps_map_osd_s *); |
gboolean(*busy)(struct osm_gps_map_osd_s *); |
130 |
void(*free)(struct osm_gps_map_osd_s *); |
void(*free)(struct osm_gps_map_osd_s *); |
131 |
|
|
135 |
gpointer priv; |
gpointer priv; |
136 |
} osm_gps_map_osd_t; |
} osm_gps_map_osd_t; |
137 |
|
|
138 |
typedef void (*OsmGpsMapBalloonCallback)(cairo_t *, OsmGpsMapRect_t *rect, |
typedef enum { |
139 |
gpointer data); |
OSM_GPS_MAP_BALLOON_EVENT_TYPE_DRAW, |
140 |
|
OSM_GPS_MAP_BALLOON_EVENT_TYPE_CLICK, |
141 |
|
OSM_GPS_MAP_BALLOON_EVENT_TYPE_REMOVED, |
142 |
|
OSM_GPS_MAP_BALLOON_EVENT_TYPE_SIZE_REQUEST, |
143 |
|
} osm_gps_map_balloon_event_type_t; |
144 |
|
|
145 |
|
typedef struct { |
146 |
|
osm_gps_map_balloon_event_type_t type; |
147 |
|
union { |
148 |
|
struct { |
149 |
|
OsmGpsMapRect_t *rect; |
150 |
|
cairo_t *cr; |
151 |
|
} draw; |
152 |
|
|
153 |
|
struct { |
154 |
|
int x, y; |
155 |
|
gboolean down; |
156 |
|
} click; |
157 |
|
} data; |
158 |
|
} osm_gps_map_balloon_event_t; |
159 |
|
|
160 |
|
typedef void (*OsmGpsMapBalloonCallback)(osm_gps_map_balloon_event_t *event, gpointer data); |
161 |
#define OSM_GPS_MAP_BALLOON_CALLBACK(f) ((OsmGpsMapBalloonCallback) (f)) |
#define OSM_GPS_MAP_BALLOON_CALLBACK(f) ((OsmGpsMapBalloonCallback) (f)) |
162 |
|
|
163 |
GType osm_gps_map_get_type (void) G_GNUC_CONST; |
GType osm_gps_map_get_type (void) G_GNUC_CONST; |
164 |
|
|
165 |
|
GtkWidget* osm_gps_map_new (void); |
166 |
|
|
167 |
|
char* osm_gps_map_get_default_cache_directory (void); |
168 |
|
|
169 |
|
const char* osm_gps_map_source_get_friendly_name (OsmGpsMapSource_t source); |
170 |
|
const char* osm_gps_map_source_get_repo_uri (OsmGpsMapSource_t source); |
171 |
|
const char* osm_gps_map_source_get_image_format (OsmGpsMapSource_t source); |
172 |
|
int osm_gps_map_source_get_min_zoom (OsmGpsMapSource_t source); |
173 |
|
int osm_gps_map_source_get_max_zoom (OsmGpsMapSource_t source); |
174 |
|
gboolean osm_gps_map_source_is_valid (OsmGpsMapSource_t source); |
175 |
|
|
176 |
|
void osm_gps_map_download_maps (OsmGpsMap *map, coord_t *pt1, coord_t *pt2, int zoom_start, int zoom_end); |
177 |
|
void osm_gps_map_get_bbox (OsmGpsMap *map, coord_t *pt1, coord_t *pt2); |
178 |
|
void osm_gps_map_set_mapcenter (OsmGpsMap *map, float latitude, float longitude, int zoom); |
179 |
|
void osm_gps_map_set_center (OsmGpsMap *map, float latitude, float longitude); |
180 |
|
int osm_gps_map_set_zoom (OsmGpsMap *map, int zoom); |
181 |
|
int osm_gps_map_zoom_in (OsmGpsMap *map); |
182 |
|
int osm_gps_map_zoom_out (OsmGpsMap *map); |
183 |
|
void osm_gps_map_add_track (OsmGpsMap *map, GSList *track); |
184 |
|
void osm_gps_map_replace_track (OsmGpsMap *map, GSList *old_track, GSList *new_track); |
185 |
|
void osm_gps_map_clear_tracks (OsmGpsMap *map); |
186 |
|
void osm_gps_map_add_image (OsmGpsMap *map, float latitude, float longitude, GdkPixbuf *image); |
187 |
|
void osm_gps_map_add_image_with_alignment (OsmGpsMap *map, float latitude, float longitude, GdkPixbuf *image, float xalign, float yalign); |
188 |
|
gboolean osm_gps_map_remove_image (OsmGpsMap *map, GdkPixbuf *image); |
189 |
|
void osm_gps_map_clear_images (OsmGpsMap *map); |
190 |
|
void osm_gps_map_draw_gps (OsmGpsMap *map, float latitude, float longitude, float heading); |
191 |
|
void osm_gps_map_clear_gps (OsmGpsMap *map); |
192 |
|
coord_t osm_gps_map_get_co_ordinates (OsmGpsMap *map, int pixel_x, int pixel_y); |
193 |
|
void osm_gps_map_screen_to_geographic (OsmGpsMap *map, gint pixel_x, gint pixel_y, gfloat *latitude, gfloat *longitude); |
194 |
|
void osm_gps_map_geographic_to_screen (OsmGpsMap *map, gfloat latitude, gfloat longitude, gint *pixel_x, gint *pixel_y); |
195 |
|
void osm_gps_map_scroll (OsmGpsMap *map, gint dx, gint dy); |
196 |
|
float osm_gps_map_get_scale (OsmGpsMap *map); |
197 |
|
void osm_gps_map_set_keyboard_shortcut (OsmGpsMap *map, OsmGpsMapKey_t key, guint keyval); |
198 |
|
|
|
const char* osm_gps_map_source_get_friendly_name(OsmGpsMapSource_t source); |
|
|
const char* osm_gps_map_source_get_repo_uri(OsmGpsMapSource_t source); |
|
|
const char *osm_gps_map_source_get_image_format(OsmGpsMapSource_t source); |
|
|
int osm_gps_map_source_get_min_zoom(OsmGpsMapSource_t source); |
|
|
int osm_gps_map_source_get_max_zoom(OsmGpsMapSource_t source); |
|
|
|
|
|
void osm_gps_map_download_maps (OsmGpsMap *map, coord_t *pt1, coord_t *pt2, int zoom_start, int zoom_end); |
|
|
void osm_gps_map_get_bbox (OsmGpsMap *map, coord_t *pt1, coord_t *pt2); |
|
|
void osm_gps_map_set_mapcenter (OsmGpsMap *map, float latitude, float longitude, int zoom); |
|
|
void osm_gps_map_set_center (OsmGpsMap *map, float latitude, float longitude); |
|
|
int osm_gps_map_set_zoom (OsmGpsMap *map, int zoom); |
|
|
void osm_gps_map_add_track (OsmGpsMap *map, GSList *track); |
|
|
void osm_gps_map_clear_tracks (OsmGpsMap *map); |
|
|
void osm_gps_map_add_image (OsmGpsMap *map, float latitude, float longitude, GdkPixbuf *image); |
|
|
gboolean osm_gps_map_remove_image (OsmGpsMap *map, GdkPixbuf *image); |
|
|
void osm_gps_map_clear_images (OsmGpsMap *map); |
|
|
void osm_gps_map_draw_gps (OsmGpsMap *map, float latitude, float longitude, float heading); |
|
|
void osm_gps_map_clear_gps (OsmGpsMap *map); |
|
|
coord_t osm_gps_map_get_co_ordinates (OsmGpsMap *map, int pixel_x, int pixel_y); |
|
|
GtkWidget * osm_gps_map_new(void); |
|
|
void osm_gps_map_screen_to_geographic (OsmGpsMap *map, |
|
|
gint pixel_x, gint pixel_y, |
|
|
gfloat *latitude, gfloat *longitude); |
|
|
void osm_gps_map_geographic_to_screen (OsmGpsMap *map, |
|
|
gfloat latitude, gfloat longitude, |
|
|
gint *pixel_x, gint *pixel_y); |
|
|
void osm_gps_map_scroll (OsmGpsMap *map, gint dx, gint dy); |
|
|
float osm_gps_map_get_scale(OsmGpsMap *map); |
|
199 |
#ifdef ENABLE_OSD |
#ifdef ENABLE_OSD |
200 |
void osm_gps_map_register_osd(OsmGpsMap *map, osm_gps_map_osd_t *osd); |
void osm_gps_map_register_osd(OsmGpsMap *map, osm_gps_map_osd_t *osd); |
201 |
void osm_gps_map_redraw (OsmGpsMap *map); |
void osm_gps_map_redraw (OsmGpsMap *map); |
202 |
osm_gps_map_osd_t *osm_gps_map_osd_get(OsmGpsMap *map); |
osm_gps_map_osd_t *osm_gps_map_osd_get(OsmGpsMap *map); |
203 |
void osm_gps_map_repaint (OsmGpsMap *map); |
void osm_gps_map_repaint (OsmGpsMap *map); |
204 |
|
coord_t *osm_gps_map_get_gps (OsmGpsMap *map); |
205 |
#endif |
#endif |
206 |
|
|
207 |
|
|