[mapcode] 34/56: Fixed voor no-hp support

Stefan Fritsch sf at moszumanska.debian.org
Wed Nov 2 23:27:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

sf pushed a commit to annotated tag v2.0.2
in repository mapcode.

commit e200f6dda18e7e2f40d6633ef95c2104c4a2d88b
Author: Rijn Buve <rijn at buve.nl>
Date:   Thu Jul 2 13:13:29 2015 +0200

    Fixed voor no-hp support
---
 mapcodelib/mapcoder.c |  2 +-
 utility/mapcode.cpp   | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/mapcodelib/mapcoder.c b/mapcodelib/mapcoder.c
index 49451df..741c18b 100644
--- a/mapcodelib/mapcoder.c
+++ b/mapcodelib/mapcoder.c
@@ -19,7 +19,7 @@
 #include <ctype.h>  // toupper
 #include "mapcoder.h"
 
-#define SUPPORT_HIGH_PRECISION
+#undef SUPPORT_HIGH_PRECISION
 
 /*
   no threadsafe:
diff --git a/utility/mapcode.cpp b/utility/mapcode.cpp
index 1c65193..bb4f459 100644
--- a/utility/mapcode.cpp
+++ b/utility/mapcode.cpp
@@ -80,6 +80,9 @@ static void usage(const char* appName) {
     printf("MAPCODE (version %s)\n", mapcode_cversion);
     printf("Copyright (C) 2014-2015 Stichting Mapcode Foundation\n");
     printf("\n");
+#ifndef SUPPORT_HIGH_PRECISION
+    printf("Warning: High precision support is disabled in this build.)\n\n");
+#endif
     printf("Usage:\n");
     printf("    %s [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]\n", appName);
     printf("\n");
@@ -292,6 +295,16 @@ static void generateAndOutputMapcodes(double lat, double lon, int iShowError, in
         lat += 180;
     }
 
+#ifndef SUPPORT_HIGH_PRECISION
+    {
+        // Need to truncate lat/lon to microdegrees.
+        long intLon = lon * 1000000.0;
+        long intLat = lat * 1000000.0;
+        lon = (intLon / 1000000.0);
+        lat = (intLat / 1000000.0);
+    }
+#endif
+
     const int nrResults = encodeLatLonToMapcodes(results, lat, lon, context, extraDigits);
     if (nrResults <= 0) {
         if (iShowError) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapcode.git



More information about the Pkg-grass-devel mailing list