]> err.no Git - mapper/commitdiff
misc
authorKaj-Michael Lang <milang@angel.tal.org>
Fri, 19 Oct 2007 12:56:45 +0000 (15:56 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Fri, 19 Oct 2007 12:56:45 +0000 (15:56 +0300)
src/gpsdata.h
src/map.c
src/route.c

index dbd58b03fd9b8b25e4e377767566cb832c6e48ef..32665bc16a351d140380c1dcfd84a7a2857b7eec 100644 (file)
@@ -5,6 +5,12 @@
 
 #define GPS_SAT_MAX                    (12)
 
+typedef enum {
+        FIX_NOFIX=1,
+        FIX_2D=2,
+        FIX_3D=3
+} GpsFix;
+
 typedef struct _GpsSatelliteData GpsSatelliteData;
 struct _GpsSatelliteData {
        guint prn;
index ab0f3f966ba96d493784d85e4741cca91c5b8403..f5dc286096d7287a5abe77786a2ebb1005c8a1fc 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -561,6 +561,10 @@ map_update_location_from_center(void)
 {
 /* Force re-validation of place if user is clicking around */
 map_loc.valid=FALSE;
+if (_gps.fix<2) {
+       _pos.unitx=_center.unitx;
+       _pos.unity=_center.unity;
+}
 map_update_location(_center.unitx, _center.unity, TRUE);
 return FALSE;
 }
index afc3241a064e6d14e591009054911b017608ec55..f3e064b4bffb363dfda68ff5ec2a06ab32a86012 100644 (file)
@@ -565,7 +565,9 @@ if (_next_way) {
        _near_point_dist_squared = near_dist_squared;
 
        for (wnext = wcurr = _next_way; wcurr != _route.wtail; wcurr++) {
-               if (wcurr->point < near
+               if (wcurr->point < near || (wcurr->point == near && quick 
+                               && (_next_wpt && (DISTANCE_SQUARED(_pos, *near) > _next_way_dist_squared
+                               && DISTANCE_SQUARED(_pos, *_next_wpt) < _next_wpt_dist_squared))))
                    /* Okay, this else if expression warrants explanation.  If the
                     * nearest track point happens to be a waypoint, then we want to
                     * check if we have "passed" that waypoint.  To check this, we
@@ -574,16 +576,12 @@ if (_next_way) {
                     * decreasing, then we have passed the waypoint, and thus we
                     * should skip it.  Note that if there is no _next_wpt, then
                     * there is no next waypoint, so we do not skip it in that case. */
-                   || (wcurr->point == near && quick
-                       && (_next_wpt && (DISTANCE_SQUARED(_pos, *near) > _next_way_dist_squared
-                               && DISTANCE_SQUARED(_pos, *_next_wpt) < _next_wpt_dist_squared))))
                        wnext = wcurr + 1;
                else
                        break;
        }
 
-       if (wnext == _route.wtail && (wnext->point < near
-                                     || (wnext->point == near && quick
+       if (wnext == _route.wtail && (wnext->point < near || (wnext->point == near && quick
                                          && (_next_wpt && (DISTANCE_SQUARED (_pos, *near) > _next_way_dist_squared
                                               && DISTANCE_SQUARED(_pos, *_next_wpt) < _next_wpt_dist_squared)))))
        {
@@ -632,8 +630,7 @@ while (!_near_point->unity && _near_point != _route.tail)
        _near_point++;
 
 /* Initialize _next_way. */
-if (_route.wtail == _route.whead - 1
-    || (_autoroute_data.enabled && _route.wtail == _route.whead))
+if (_route.wtail == _route.whead - 1 || (_autoroute_data.enabled && _route.wtail == _route.whead))
        _next_way = NULL;
 else
        /* We have at least one waypoint. */