133 |
} |
} |
134 |
|
|
135 |
#ifdef ENABLE_OSM_GPS_MAP |
#ifdef ENABLE_OSM_GPS_MAP |
136 |
|
static GSList *pos_append(GSList *list, pos_float_t lat, pos_float_t lon) { |
137 |
|
coord_t *coo = g_new0(coord_t, 1); |
138 |
|
coo->rlat = DEG2RAD(lat); |
139 |
|
coo->rlon = DEG2RAD(lon); |
140 |
|
list = g_slist_append(list, coo); |
141 |
|
return list; |
142 |
|
} |
143 |
|
|
144 |
/* the contents of the map tab have been changed */ |
/* the contents of the map tab have been changed */ |
145 |
static void map_update(context_t *context, gboolean forced) { |
static void map_update(context_t *context, gboolean forced) { |
146 |
|
|
164 |
osm_gps_map_set_center(OSM_GPS_MAP(context->map.widget), |
osm_gps_map_set_center(OSM_GPS_MAP(context->map.widget), |
165 |
center_lat, center_lon); |
center_lat, center_lon); |
166 |
|
|
167 |
osm_gps_map_set_zoom(OSM_GPS_MAP(context->map.widget), (hzoom+vzoom+0.5)/2); |
/* use smallest zoom, so everything fits on screen */ |
168 |
|
osm_gps_map_set_zoom(OSM_GPS_MAP(context->map.widget), |
169 |
|
(vzoom < hzoom)?vzoom:hzoom); |
170 |
|
|
171 |
|
/* ---------- draw border (as a gps track) -------------- */ |
172 |
|
osm_gps_map_clear_tracks(OSM_GPS_MAP(context->map.widget)); |
173 |
|
|
174 |
|
GSList *box = pos_append(NULL, context->min.lat, context->min.lon); |
175 |
|
box = pos_append(box, context->max.lat, context->min.lon); |
176 |
|
box = pos_append(box, context->max.lat, context->max.lon); |
177 |
|
box = pos_append(box, context->min.lat, context->max.lon); |
178 |
|
box = pos_append(box, context->min.lat, context->min.lon); |
179 |
|
|
180 |
|
osm_gps_map_add_track(OSM_GPS_MAP(context->map.widget), box); |
181 |
|
|
182 |
context->map.needs_redraw = FALSE; |
context->map.needs_redraw = FALSE; |
183 |
} |
} |