Diff of /trunk/src/map-tool.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 144 by harbaum, Tue Oct 27 08:38:31 2009 UTC revision 148 by harbaum, Wed Oct 28 11:57:54 2009 UTC
# Line 109  static int dist2pixel(map_context_t *con Line 109  static int dist2pixel(map_context_t *con
109    
110  static gboolean map_gps_update(gpointer data) {  static gboolean map_gps_update(gpointer data) {
111    map_context_t *context = (map_context_t*)data;    map_context_t *context = (map_context_t*)data;
112      static gboolean goto_is_enabled = FALSE;
113    
114    /* get reference position ... */    /* get reference position ... */
115    pos_t *refpos = get_pos(context->appdata);    pos_t *refpos = get_pos(context->appdata);
116    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);
117    
118    /* ... and enable "goto" button if it's valid */    /* ... and enable "goto" button if it's valid */
119    osm_gps_map_osd_enable_gps (OSM_GPS_MAP(context->widget),    if(ok != goto_is_enabled) {
120                   OSM_GPS_MAP_OSD_CALLBACK(ok?cb_map_gps:NULL), context);      osm_gps_map_osd_enable_gps (OSM_GPS_MAP(context->widget),
121                    OSM_GPS_MAP_OSD_CALLBACK(ok?cb_map_gps:NULL), context);
122        goto_is_enabled = ok;
123      }
124    
125    if(ok) {    if(ok) {
126      float heading = NAN;      float heading = NAN;
# Line 131  static gboolean map_gps_update(gpointer Line 135  static gboolean map_gps_update(gpointer
135          radius = dist2pixel(context, eph/1000, refpos->lat);          radius = dist2pixel(context, eph/1000, refpos->lat);
136      }      }
137    
138        /* TODO: in order to save energy: only draw if state actually changed */
139    
140      g_object_set(context->widget, "gps-track-highlight-radius", radius, NULL);      g_object_set(context->widget, "gps-track-highlight-radius", radius, NULL);
141      osm_gps_map_draw_gps(OSM_GPS_MAP(context->widget),      osm_gps_map_draw_gps(OSM_GPS_MAP(context->widget),
142                           refpos->lat, refpos->lon, heading);                           refpos->lat, refpos->lon, heading);

Legend:
Removed from v.144  
changed lines
  Added in v.148