Parent Directory | Revision Log
Disabled maps for free
1 | harbaum | 32 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */ |
2 | /* vim:set et sw=4 ts=4 cino=t0,(0: */ | ||
3 | /* | ||
4 | * osm-gps-map.h | ||
5 | * Copyright (C) Marcus Bauer 2008 <marcus.bauer@gmail.com> | ||
6 | * Copyright (C) John Stowers 2009 <john.stowers@gmail.com> | ||
7 | * | ||
8 | * Contributions by | ||
9 | * Everaldo Canuto 2009 <everaldo.canuto@gmail.com> | ||
10 | * | ||
11 | * osm-gps-map.c is free software: you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation, either version 3 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * osm-gps-map.c is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
19 | * See the GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License along | ||
22 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
23 | */ | ||
24 | |||
25 | #ifndef _OSM_GPS_MAP_H_ | ||
26 | #define _OSM_GPS_MAP_H_ | ||
27 | |||
28 | harbaum | 69 | #include "config.h" |
29 | |||
30 | harbaum | 32 | #include <glib.h> |
31 | #include <glib-object.h> | ||
32 | #include <gtk/gtk.h> | ||
33 | #include <gdk-pixbuf/gdk-pixbuf.h> | ||
34 | |||
35 | G_BEGIN_DECLS | ||
36 | |||
37 | #define OSM_TYPE_GPS_MAP (osm_gps_map_get_type ()) | ||
38 | #define OSM_GPS_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSM_TYPE_GPS_MAP, OsmGpsMap)) | ||
39 | #define OSM_GPS_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSM_TYPE_GPS_MAP, OsmGpsMapClass)) | ||
40 | #define OSM_IS_GPS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSM_TYPE_GPS_MAP)) | ||
41 | #define OSM_IS_GPS_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSM_TYPE_GPS_MAP)) | ||
42 | #define OSM_GPS_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSM_TYPE_GPS_MAP, OsmGpsMapClass)) | ||
43 | |||
44 | typedef struct _OsmGpsMapClass OsmGpsMapClass; | ||
45 | typedef struct _OsmGpsMap OsmGpsMap; | ||
46 | typedef struct _OsmGpsMapPrivate OsmGpsMapPrivate; | ||
47 | |||
48 | struct _OsmGpsMapClass | ||
49 | { | ||
50 | GtkDrawingAreaClass parent_class; | ||
51 | }; | ||
52 | |||
53 | struct _OsmGpsMap | ||
54 | { | ||
55 | GtkDrawingArea parent_instance; | ||
56 | OsmGpsMapPrivate *priv; | ||
57 | }; | ||
58 | |||
59 | typedef struct { | ||
60 | float rlat; | ||
61 | float rlon; | ||
62 | } coord_t; | ||
63 | |||
64 | harbaum | 55 | typedef enum { |
65 | OSM_GPS_MAP_SOURCE_NULL, | ||
66 | OSM_GPS_MAP_SOURCE_OPENSTREETMAP, | ||
67 | OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER, | ||
68 | harbaum | 84 | OSM_GPS_MAP_SOURCE_OPENCYCLEMAP, |
69 | harbaum | 55 | OSM_GPS_MAP_SOURCE_GOOGLE_STREET, |
70 | OSM_GPS_MAP_SOURCE_GOOGLE_SATELLITE, | ||
71 | OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET, | ||
72 | OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_SATELLITE, | ||
73 | OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID, | ||
74 | harbaum | 89 | |
75 | /* entries below are currently unusable */ | ||
76 | harbaum | 90 | OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE, /* not enough details */ |
77 | harbaum | 89 | OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID, /* disabled by google */ |
78 | OSM_GPS_MAP_SOURCE_YAHOO_STREET, /* no implemented yet */ | ||
79 | OSM_GPS_MAP_SOURCE_YAHOO_SATELLITE, /* no implemented yet */ | ||
80 | OSM_GPS_MAP_SOURCE_YAHOO_HYBRID /* no implemented yet */ | ||
81 | harbaum | 55 | } OsmGpsMapSource_t; |
82 | harbaum | 32 | |
83 | harbaum | 89 | #define OSM_GPS_MAP_SOURCE_LAST (OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID) |
84 | harbaum | 87 | |
85 | harbaum | 58 | typedef struct { |
86 | gint x, y, w, h; | ||
87 | } OsmGpsMapRect_t; | ||
88 | |||
89 | harbaum | 69 | typedef enum { |
90 | OSD_NONE = 0, | ||
91 | OSD_BG, | ||
92 | OSD_UP, | ||
93 | OSD_DOWN, | ||
94 | OSD_LEFT, | ||
95 | OSD_RIGHT, | ||
96 | OSD_IN, | ||
97 | OSD_OUT, | ||
98 | harbaum | 73 | OSD_CUSTOM // first custom buttom |
99 | harbaum | 69 | } osd_button_t; |
100 | |||
101 | harbaum | 73 | typedef void (*OsmGpsMapOsdCallback)(osd_button_t but, gpointer data); |
102 | #define OSM_GPS_MAP_OSD_CALLBACK(f) ((OsmGpsMapOsdCallback) (f)) | ||
103 | |||
104 | /* the osd structure mainly contains various callbacks */ | ||
105 | /* required to draw and update the OSD */ | ||
106 | typedef struct osm_gps_map_osd_s { | ||
107 | GtkWidget *widget; // the main map widget (to get its stlye info) | ||
108 | |||
109 | void(*render)(struct osm_gps_map_osd_s *); | ||
110 | harbaum | 75 | void(*draw)(struct osm_gps_map_osd_s *, GdkDrawable *); |
111 | harbaum | 77 | osd_button_t(*check)(struct osm_gps_map_osd_s *,gint, gint); /* check if x/y lies within OSD */ |
112 | harbaum | 87 | gboolean(*busy)(struct osm_gps_map_osd_s *); |
113 | harbaum | 73 | void(*free)(struct osm_gps_map_osd_s *); |
114 | |||
115 | OsmGpsMapOsdCallback cb; | ||
116 | gpointer data; | ||
117 | |||
118 | gpointer priv; | ||
119 | } osm_gps_map_osd_t; | ||
120 | |||
121 | harbaum | 58 | typedef void (*OsmGpsMapBalloonCallback)(cairo_t *, OsmGpsMapRect_t *rect, |
122 | gpointer data); | ||
123 | #define OSM_GPS_MAP_BALLOON_CALLBACK(f) ((OsmGpsMapBalloonCallback) (f)) | ||
124 | |||
125 | harbaum | 32 | GType osm_gps_map_get_type (void) G_GNUC_CONST; |
126 | harbaum | 55 | |
127 | const char* osm_gps_map_source_get_friendly_name(OsmGpsMapSource_t source); | ||
128 | const char* osm_gps_map_source_get_repo_uri(OsmGpsMapSource_t source); | ||
129 | const char *osm_gps_map_source_get_image_format(OsmGpsMapSource_t source); | ||
130 | int osm_gps_map_source_get_min_zoom(OsmGpsMapSource_t source); | ||
131 | int osm_gps_map_source_get_max_zoom(OsmGpsMapSource_t source); | ||
132 | |||
133 | harbaum | 32 | void osm_gps_map_download_maps (OsmGpsMap *map, coord_t *pt1, coord_t *pt2, int zoom_start, int zoom_end); |
134 | void osm_gps_map_get_bbox (OsmGpsMap *map, coord_t *pt1, coord_t *pt2); | ||
135 | void osm_gps_map_set_mapcenter (OsmGpsMap *map, float latitude, float longitude, int zoom); | ||
136 | void osm_gps_map_set_center (OsmGpsMap *map, float latitude, float longitude); | ||
137 | int osm_gps_map_set_zoom (OsmGpsMap *map, int zoom); | ||
138 | void osm_gps_map_add_track (OsmGpsMap *map, GSList *track); | ||
139 | void osm_gps_map_clear_tracks (OsmGpsMap *map); | ||
140 | void osm_gps_map_add_image (OsmGpsMap *map, float latitude, float longitude, GdkPixbuf *image); | ||
141 | harbaum | 55 | gboolean osm_gps_map_remove_image (OsmGpsMap *map, GdkPixbuf *image); |
142 | harbaum | 32 | void osm_gps_map_clear_images (OsmGpsMap *map); |
143 | void osm_gps_map_draw_gps (OsmGpsMap *map, float latitude, float longitude, float heading); | ||
144 | void osm_gps_map_clear_gps (OsmGpsMap *map); | ||
145 | coord_t osm_gps_map_get_co_ordinates (OsmGpsMap *map, int pixel_x, int pixel_y); | ||
146 | GtkWidget * osm_gps_map_new(void); | ||
147 | void osm_gps_map_screen_to_geographic (OsmGpsMap *map, | ||
148 | gint pixel_x, gint pixel_y, | ||
149 | gfloat *latitude, gfloat *longitude); | ||
150 | void osm_gps_map_geographic_to_screen (OsmGpsMap *map, | ||
151 | gfloat latitude, gfloat longitude, | ||
152 | gint *pixel_x, gint *pixel_y); | ||
153 | void osm_gps_map_scroll (OsmGpsMap *map, gint dx, gint dy); | ||
154 | harbaum | 55 | float osm_gps_map_get_scale(OsmGpsMap *map); |
155 | harbaum | 65 | #ifdef ENABLE_BALLOON |
156 | harbaum | 58 | void osm_gps_map_draw_balloon (OsmGpsMap *map, float latitude, float longitude, OsmGpsMapBalloonCallback cb, gpointer data); |
157 | harbaum | 57 | void osm_gps_map_clear_balloon (OsmGpsMap *map); |
158 | harbaum | 65 | #endif |
159 | harbaum | 66 | #ifdef ENABLE_OSD |
160 | harbaum | 73 | void osm_gps_map_register_osd(OsmGpsMap *map, osm_gps_map_osd_t *osd); |
161 | void osm_gps_map_redraw (OsmGpsMap *map); | ||
162 | osm_gps_map_osd_t *osm_gps_map_osd_get(OsmGpsMap *map); | ||
163 | harbaum | 86 | void osm_gps_map_repaint (OsmGpsMap *map); |
164 | harbaum | 66 | #endif |
165 | harbaum | 32 | |
166 | harbaum | 66 | |
167 | harbaum | 32 | G_END_DECLS |
168 | |||
169 | #endif /* _OSM_GPS_MAP_H_ */ |