[mapcode] 29/32: Add handling for lat/lon out of bounds in test set generation.

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


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

sf pushed a commit to annotated tag v1.33
in repository mapcode.

commit fba3383222936276a6f8d3f37cb7023894238b9b
Author: unknown <matthew.lowden at tomtom.com>
Date:   Thu Sep 4 08:18:37 2014 +0200

    Add handling for lat/lon out of bounds in test set generation.
---
 example/mapcode.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/example/mapcode.cpp b/example/mapcode.cpp
index d7e46fa..4c75ad9 100755
--- a/example/mapcode.cpp
+++ b/example/mapcode.cpp
@@ -277,6 +277,20 @@ static void generateAndOutputMapcodes(double lat, double lon, int iShowError) {
 
     char* results[MAX_NR_OF_MAPCODE_RESULTS];
     int context = 0;
+
+	while (lon > 180) {
+		lon -= 360;
+	}
+	while (lon < -180) {
+		lon += 360;
+	}
+	while (lat > 90) {
+		lat -= 180;
+	}
+	while (lat < -90) {
+		lat += 180;
+	}
+
     const int nrResults = encodeLatLonToMapcodes(results, lat, lon, context);
     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