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 3930e94b6edcc1f7c94a8b6a9b66e7e671293332 Author: Rijn Buve <[email protected]> Date: Tue Sep 2 13:39:57 2014 +0200 Added changes required by PG --- example/{mapcode.c => mapcode.cpp} | 9 +++++---- mapcodelib/basics.h | 26 +++++--------------------- mapcodelib/mapcoder.c | 6 +++--- mapcodelib/mapcoder.h | 20 +++++++++++++++++++- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/example/mapcode.c b/example/mapcode.cpp similarity index 98% rename from example/mapcode.c rename to example/mapcode.cpp index d3102d7..20bd7b8 100644 --- a/example/mapcode.c +++ b/example/mapcode.cpp @@ -24,6 +24,7 @@ */ #include <stdio.h> +#include <time.h> #include <math.h> #include "../mapcodelib/mapcoder.c" @@ -144,8 +145,8 @@ static void unitToLatLonDeg( const double lonRad = atan2(y, x); // Convert radians to degrees. - *latDeg = isnan(latRad) ? 90.0 : radToDeg(latRad); - *lonDeg = isnan(lonRad) ? 180.0 : radToDeg(lonRad); + *latDeg = (latRad == NAN) ? 90.0 : radToDeg(latRad); + *lonDeg = (lonRad == NAN) ? 180.0 : radToDeg(lonRad); } @@ -398,7 +399,7 @@ int main(const int argc, const char** argv) // Get territory context. int context = 0; - char* defaultTerritory = "AAA"; + const char* defaultTerritory = "AAA"; if (argc == 5) { context = convertTerritoryIsoNameToCode(argv[4], 0); defaultTerritory = argv[4]; @@ -540,7 +541,7 @@ int main(const int argc, const char** argv) int gridX = 0; int gridY = 0; - int line = round(sqrt(totalNrOfPoints)); + int line = (int) (sqrt(totalNrOfPoints) + 0.5); for (int i = 0; i < totalNrOfPoints; ++i) { double lat; double lon; diff --git a/mapcodelib/basics.h b/mapcodelib/basics.h old mode 100755 new mode 100644 index 1cafe44..1dbb933 --- a/mapcodelib/basics.h +++ b/mapcodelib/basics.h @@ -1,31 +1,15 @@ -/* - * Copyright (C) 2014 Stichting Mapcode Foundation (http://www.mapcode.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #define UWORD unsigned short int // 2-byte unsigned integer #define mapcode_cversion "1.33" #define MAXWIDE 10 #define BASEX 31 #define MAXFITLONG 6 -#define XSIDE3 168 +#define XSIDE3 168 #define YSIDE3 176 #define ALIASES "2UK=2UT,2CG=2CT,1GU=GUM,1UM=UMI,1VI=VIR,1PR=PRI,1AS=ASM,1MP=MNP,4JB=JBT,4QL=QLD,4TS=TAS,4CX=CXR,4CC=CCK,4NF=NFK,4HM=HMD,4NI=NFK,COL=5CL,5ME=5MX,MEX=5MX,5TM=TAM,5AG=AGU,5BC=BCN,5BS=BCS,5CM=CAM,5CS=CHP,5CH=CHH,5CO=COA,5DF=DIF,5DG=DUR,5GT=GUA,5GR=GRO,5HG=HID,5JA=JAL,5MI=MIC,5MO=MOR,5NA=NAY,5NL=NLE,5OA=OAX,5PB=PUE,5QE=QUE,5QR=ROO,5SL=SLP,5SI=SIN,5SO=SON,5TB=TAB,5TL=TLA,5VE=VER,5YU=YUC,5ZA=ZAC,811=8BJ,812=8TJ,813=8HE,814=8SX,815=8NM,821=8LN,822=8JL,823=8HL,831=8SH,832=8JS,833 [...] -#define MAX_MAPCODE_TERRITORY_CODE 541 // total number of areas (i.e. recognised iso codes) in this database +#define MAX_CCODE 541 // total number of areas (i.e. recognised iso codes) in this database static char *entity_iso = "" "VAT,MCO,GIB,TKL,CCK,BLM,NRU,TUV,MAC,SXM," "MAF,NFK,PCN,BVT,BMU,IOT,SMR,GGY,AIA,MSR," @@ -168,7 +152,7 @@ static char encode_chars[31] = { }; -static UWORD data_start[MAX_MAPCODE_TERRITORY_CODE+1] = { +static UWORD data_start[MAX_CCODE+1] = { 0, 3, 6, 9, 13, 16, 18, 19, 30, 31, 33, 35, 37, 42, 44, 47, 51, 54, 56, 58, 60, 62, 64, 68, 71, 79, 81, 116, 121, 131, @@ -226,13 +210,13 @@ static UWORD data_start[MAX_MAPCODE_TERRITORY_CODE+1] = { 16130,16162 }; -#define NR_BOUNDARY_RECS 16162 +#define NR_RECS 16162 #define WORST_RECS_PER_CCODE 195 // 8 Argentina @43 typedef struct { long minx; long miny; long maxx; long maxy; unsigned long flags; } mminforec; #ifndef MAKE_SOURCE_DIGITAL -static mminforec mminfo[NR_BOUNDARY_RECS+1] = { +static mminforec mminfo[NR_RECS+1] = { { 12433114, 41851944, 12548434, 41938434,0x001002b}, { 5850000, 35450000, 18560000, 55080000,0x50a0636}, { 12444000, 41899000, 12460000, 41908000,0x003063c}, diff --git a/mapcodelib/mapcoder.c b/mapcodelib/mapcoder.c old mode 100755 new mode 100644 index af1d9d9..165b11a --- a/mapcodelib/mapcoder.c +++ b/mapcodelib/mapcoder.c @@ -2317,8 +2317,8 @@ void asdms1(unsigned char *r,double v,long max,unsigned char degsym) // worst ca unsigned char *asdms(unsigned char *r,double lat,double lon,unsigned char degsym) // worst case EXcluding zts is 22 bytes: -##d##'##",-###d##'##" { asdms1(r,lat,90*3600,degsym); - strcat(r,","); - asdms1(r+strlen(r),lon,180*3600,degsym); + strcat((char*)r,","); + asdms1(r+strlen((char*)r),lon,180*3600,degsym); return r; } @@ -2348,7 +2348,7 @@ int interpret_coord( const unsigned char *i, int islat, double *result ) while ( expnow<4 && isdig(*i) ) { // get value - double v=atof(i); skipfp(i); skipwhite(i); + double v=atof((char*)i); skipfp(i); skipwhite(i); if ( *i && strchr("oOdD\x0F8\x0BA\x0B0\x0A7",*i) ) // degree symbol? $F8=248degree $BA=186 $B0=176 $A7=167 { i++; skipwhite(i); diff --git a/mapcodelib/mapcoder.h b/mapcodelib/mapcoder.h old mode 100755 new mode 100644 index a04805d..ab483bc --- a/mapcodelib/mapcoder.h +++ b/mapcodelib/mapcoder.h @@ -19,7 +19,7 @@ #define UWORD unsigned short int // 2-byte unsigned integer. #define SUPPORT_FOREIGN_ALPHABETS -#define MAX_NR_OF_MAPCODE_RESULTS 64 // Max. number of results returned by encoder. +#define MAX_NR_OF_MAPCODE_RESULTS 48 // Max. number of results returned by encoder. #define MAX_MAPCODE_RESULT_LEN 24 // Max. number of characters in a single result. #define COMPARE_MAPCODE_MISSING_CHARACTERS -999 // Used for compareWithMapcodeFormat. @@ -203,3 +203,21 @@ const char* decodeToRoman(const UWORD* string); * de-allocated by the caller. It will be overwritten by a subsequent call to this method! */ const UWORD* encodeToAlphabet(const char* mapcode, int alphabet); + + +/** + * List of #defines to support legacy systems. These names are deprecated but supported for + * existing systems. Please use the names above. + */ +#define coord2mc encodeLatLonToMapcodes +#define coord2mc1 encodeLatLonToSingleMapcode +#define mc2coord decodeMapcodeToLatLon +#define lookslikemapcode compareWithMapcodeFormat +#define text2tc convertTerritoryIsoNameToCode +#define tc2text convertTerritoryCodeToIsoName +#define tccontext getCountryOrParentCountry +#define tcparent getParentCountryOfState +#define decode_to_roman decodeToRoman +#define encode_to_alphabet encodeToAlphabet +#define MAX_MAPCODE_TERRITORY_CODE MAX_CCODE +#define NR_BOUNDARY_RECS NR_RECS -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapcode.git _______________________________________________ Pkg-grass-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

