From: robertlipe Date: Sat, 6 Jul 2013 21:00:12 +0000 (+0000) Subject: Round, don't truncate lowrance coords on write X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~557 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b89c3846ea1f2b8c8b893f97ebf2bc3de7f8a00b;p=gpsbabel.git Round, don't truncate lowrance coords on write --- diff --git a/gpsbabel/lowranceusr.cc b/gpsbabel/lowranceusr.cc index 233dbe576..0c1685b5d 100644 --- a/gpsbabel/lowranceusr.cc +++ b/gpsbabel/lowranceusr.cc @@ -362,7 +362,7 @@ lon_mm_to_deg(double x) static long lon_deg_to_mm(double x) { - return (long)(x * SEMIMINOR * DEGREESTORADIANS); + return lround(x * SEMIMINOR * DEGREESTORADIANS); } static double diff --git a/gpsbabel/reference/enchilada.usr b/gpsbabel/reference/enchilada.usr index 7df325297..3721d4247 100644 Binary files a/gpsbabel/reference/enchilada.usr and b/gpsbabel/reference/enchilada.usr differ diff --git a/gpsbabel/reference/ignoreicons.usr b/gpsbabel/reference/ignoreicons.usr index f3724e4b3..e7c3484d2 100644 Binary files a/gpsbabel/reference/ignoreicons.usr and b/gpsbabel/reference/ignoreicons.usr differ diff --git a/gpsbabel/reference/lowrance.usr b/gpsbabel/reference/lowrance.usr index 26350d029..3de225509 100644 Binary files a/gpsbabel/reference/lowrance.usr and b/gpsbabel/reference/lowrance.usr differ diff --git a/gpsbabel/testo.d/classic-1.test b/gpsbabel/testo.d/classic-1.test index db446cc4e..aaaaac8d8 100644 --- a/gpsbabel/testo.d/classic-1.test +++ b/gpsbabel/testo.d/classic-1.test @@ -4,41 +4,6 @@ # Magellan serial # TODO - -# -# Lowrance USR. Binary, and also slightly lossy because of the math to -# convert lat/long. It also doesn't support description, which makes it -# awkward to test. -# -rm -f ${TMPDIR}/lowrance1.usr -rm -f ${TMPDIR}/enchilada1.usr -rm -f ${TMPDIR}/enchilada.gpx -gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -o lowranceusr -F ${TMPDIR}/lowrance1.usr -bincompare ${TMPDIR}/lowrance1.usr ${REFERENCE}/lowrance.usr -gpsbabel -i lowranceusr -f ${TMPDIR}/lowrance1.usr -o lowranceusr -F ${TMPDIR}/lowrance1.usr -# And because of the FP rounding, we can't even read our file, write it back -# and get the same data. Sigh. -# bincompare ${REFERENCE}/lowrance.usr ${TMPDIR}/lowrance1.usr -gpsbabel -i lowranceusr -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx -gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr -bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/enchilada.usr -# Don't convert icons as waypts -gpsbabel -i lowranceusr,ignoreicons -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx -gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr -bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/ignoreicons.usr - -# -# Another variation of Lowrance. Compare v2 and v3. These original -# files were saved on the same units as v2 and v3. -# -${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v2.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v2-unicsv.txt -${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v3.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v3-unicsv.txt -compare ${REFERENCE}/lowrance-v2-unicsv.txt ${TMPDIR}/lowrance-v2-unicsv.txt -compare ${REFERENCE}/lowrance-v3-unicsv.txt ${TMPDIR}/lowrance-v3-unicsv.txt -# Ideally, there'd be a test for v2 vs. v3 writes, but their numeric -# instability makes this icky. - -# # CSV (Comma separated value) data. gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -o csv -F ${TMPDIR}/csv.csv diff --git a/gpsbabel/testo.d/lowranceusr.test b/gpsbabel/testo.d/lowranceusr.test new file mode 100644 index 000000000..a45b1bca9 --- /dev/null +++ b/gpsbabel/testo.d/lowranceusr.test @@ -0,0 +1,36 @@ + +# +# Lowrance USR. Binary, and also slightly lossy because of the math to +# convert lat/long. It also doesn't support description, which makes it +# awkward to test. +# +rm -f ${TMPDIR}/lowrance1.usr +rm -f ${TMPDIR}/enchilada1.usr +rm -f ${TMPDIR}/enchilada.gpx +gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -o lowranceusr -F ${TMPDIR}/lowrance1.usr +bincompare ${TMPDIR}/lowrance1.usr ${REFERENCE}/lowrance.usr + +gpsbabel -i lowranceusr -f ${TMPDIR}/lowrance1.usr -o lowranceusr -F ${TMPDIR}/lowrance1.usr +# And because of the FP rounding, we can't even read our file, write it back +# and get the same data. Sigh. +# bincompare ${REFERENCE}/lowrance.usr ${TMPDIR}/lowrance1.usr + +gpsbabel -i lowranceusr -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx +gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr +bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/enchilada.usr + +# Don't convert icons as waypts +gpsbabel -i lowranceusr,ignoreicons -f ${REFERENCE}/all.usr -o gpx -F ${TMPDIR}/enchilada.gpx +gpsbabel -i gpx -f ${TMPDIR}/enchilada.gpx -o lowranceusr -F ${TMPDIR}/enchilada1.usr +bincompare ${TMPDIR}/enchilada1.usr ${REFERENCE}/ignoreicons.usr +# +# Another variation of Lowrance. Compare v2 and v3. These original +# files were saved on the same units as v2 and v3. +# +${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v2.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v2-unicsv.txt +${PNAME} -i lowranceusr -f ${REFERENCE}/lowrance-v3.usr -o unicsv,utc=0 -F ${TMPDIR}/lowrance-v3-unicsv.txt +compare ${REFERENCE}/lowrance-v2-unicsv.txt ${TMPDIR}/lowrance-v2-unicsv.txt +compare ${REFERENCE}/lowrance-v3-unicsv.txt ${TMPDIR}/lowrance-v3-unicsv.txt +# Ideally, there'd be a test for v2 vs. v3 writes, but their numeric +# instability makes this icky. +