Mercurial > forge
changeset 10023:024ea45ee76d octave-forge
OctPROJ updated to version 1.1.0
author | jgpallero |
---|---|
date | Fri, 13 Apr 2012 10:40:59 +0000 |
parents | c249a87b7802 |
children | 28b882879c6e |
files | main/octproj/ChangeLog main/octproj/DESCRIPTION main/octproj/doc/octproj.pdf main/octproj/doc/octproj.tex main/octproj/src/projwrap.c main/octproj/src/projwrap.h |
diffstat | 6 files changed, 97 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/main/octproj/ChangeLog Fri Apr 13 10:06:29 2012 +0000 +++ b/main/octproj/ChangeLog Fri Apr 13 10:40:59 2012 +0000 @@ -1,8 +1,33 @@ +2012-04-13 José Luis García Pallero <jgpallero@gmail.com> + + * .hgtags: + Version 1.1.0 + [12956dd625ba] [tip] + + * src/projwrap.c: + Fix bug with return of pj_transform (this bug was introduced in the + previous commit) + [37daef7c6a9f] [OctPROJ-1.1.0] + + * DESCRIPTION: + Change DESCRIPTION file for the new version + [be913864a259] + + * doc/octproj.pdf, doc/octproj.tex: + Put the date of different releases in the reference manual + [b08517c90fe3] + + * src/projwrap.c, src/projwrap.h: + Changes for working with PROJ >= 4.8.0: include proj_api.h instead + of projects.h and change detection for inverse step in projections. + Remains backward compatible until PROJ 4.5.0 + [b102562a313b] + 2011-05-13 José Luis García Pallero <jgpallero@gmail.com> * .hgtags: version 1.0.2 - [9f5db47ce5c1] [tip] + [9f5db47ce5c1] * DESCRIPTION: Update the DESCRIPTION file with the new version number
--- a/main/octproj/DESCRIPTION Fri Apr 13 10:06:29 2012 +0000 +++ b/main/octproj/DESCRIPTION Fri Apr 13 10:40:59 2012 +0000 @@ -1,8 +1,8 @@ Name: OctPROJ -Version: 1.0.2 -Date: 2011-05-13 -Author: José Luis García Pallero <jgpallero@gmail.com> -Maintainer: José Luis García Pallero <jgpallero@gmail.com> +Version: 1.1.0 +Date: 2012-04-13 +Author: José Luis García Pallero, <jgpallero@gmail.com> +Maintainer: José Luis García Pallero, <jgpallero@gmail.com> Title: GNU Octave bindings to PROJ.4 Description: This package allows to call functions of PROJ.4 library for cartographic projections transformations. @@ -10,4 +10,4 @@ Url: http://trac.osgeo.org/proj/ http://octave.sourceforge.net/index.html Autoload: yes License: GPL version 3 or later (PROJ.4 is under MIT license) -SystemRequirements: libproj-dev (>= 4.7.0) (Debian system) +SystemRequirements: libproj-dev (>= 4.5.0) (Debian system)
--- a/main/octproj/doc/octproj.tex Fri Apr 13 10:06:29 2012 +0000 +++ b/main/octproj/doc/octproj.tex Fri Apr 13 10:40:59 2012 +0000 @@ -13,7 +13,10 @@ \author{Jos\'e Luis Garc\'ia Pallero\footnote{Instituto de Astronom\'ia y Geodesia, Fac. de CC Matem\'aticas, Universidad Complutense de Madrid. \texttt{jlgpallero@pdi.ucm.es}, \texttt{jgpallero@gmail.com}}} -\date{\today} +\date{April 13, 2012 (version 1.1.0)\\ + May 13, 2011 (version 1.0.2)\\ + November 29, 2010 (version 1.0.1)\\ + February 9, 2010 (version 1.0.0)} \begin{document} \maketitle
--- a/main/octproj/src/projwrap.c Fri Apr 13 10:06:29 2012 +0000 +++ b/main/octproj/src/projwrap.c Fri Apr 13 10:40:59 2012 +0000 @@ -138,14 +138,6 @@ //exit return *idErr; } - //test if inverse step exist - if(pjStruct->inv==0) - { - //error text - sprintf(errorText,"Inverse step do not exists\n\t%s",params); - //exit - return PROJWRAP_ERR_NOT_INV_PROJ; - } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //projection error initialization @@ -168,14 +160,28 @@ out.v = HUGE_VAL; //assign error code idErr = pj_get_errno_ref(); - //error text (only the first time) - if(pos==0) + //was the error due to inverse step do not exist? + if((*idErr)==PROJ_ERR_NOT_INV_PROJ) { + //memory free + pj_free(pjStruct); //error text - sprintf(errorText,"Projection error\n\t%s",pj_strerrno(*idErr)); + sprintf(errorText,"Inverse step do not exists\n\t%s",params); + //exit + return PROJWRAP_ERR_NOT_INV_PROJ; } - //projection error identificator - *projectionError = 1; + else + { + //error text (only the first time) + if(pos==0) + { + //error text + sprintf(errorText,"Projection error\n\t%s", + pj_strerrno(*idErr)); + } + //projection error identificator + *projectionError = 1; + } } //assign output coordinates u[pos] = out.u; @@ -209,53 +215,57 @@ char errorText[]) { //error codes - int* idErr1=NULL; - int idErr2=0; + int* idErr=NULL; + int idErrTrans=0; //proj structures projPJ pjStart; projPJ pjEnd; //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// - //start projection initialization + //start and end projections initialization pjStart = pj_init_plus(paramsStart); - if(!pjStart) + pjEnd = pj_init_plus(paramsEnd); + //error testing + if((!pjStart)||(!pjEnd)) { + //memory free + pj_free(pjStart); + pj_free(pjEnd); //error code - idErr1 = pj_get_errno_ref(); + idErr = pj_get_errno_ref(); //error text - sprintf(errorText,"Start system parameters\n\t%s\n\t%s", - pj_strerrno(*idErr1),paramsStart); + sprintf(errorText,"Wrong system parameters\n\t%s\n\t" + "Start: %s\n\tEnd: %s", + pj_strerrno(*idErr),paramsStart,paramsEnd); //exit - return *idErr1; - } - //end projection initialization - pjEnd = pj_init_plus(paramsEnd); - if(!pjEnd) - { - //error code - idErr1 = pj_get_errno_ref(); - //error text - sprintf(errorText,"End system parameters\n\t%s\n\t%s", - pj_strerrno(*idErr1),paramsEnd); - //free memory - pj_free(pjStart); - //exit - return *idErr1; + return *idErr; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //transformation - idErr2 = pj_transform(pjStart,pjEnd,nElem,incElem,u,v,z); + idErrTrans = pj_transform(pjStart,pjEnd,(long)nElem,(int)incElem,u,v,z); //catching possible errors - if(idErr2) + if(idErrTrans) { - //error text - sprintf(errorText,"Projection error\n\t%s",pj_strerrno(idErr2)); //memory free pj_free(pjStart); pj_free(pjEnd); - //exit - return idErr2; + //was the error due to inverse step do not exist? + if(idErrTrans==PROJ_ERR_NOT_INV_PROJ) + { + //error text + sprintf(errorText,"Inverse step do not exists\n\t" + "Start: %s\n\tEnd: %s",paramsStart,paramsEnd); + //exit + return PROJWRAP_ERR_NOT_INV_PROJ; + } + else + { + //error text + sprintf(errorText,"Projection error\n\t%s",pj_strerrno(idErrTrans)); + //exit + return idErrTrans; + } } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// @@ -265,7 +275,7 @@ //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //exit - return idErr2; + return idErrTrans; } /******************************************************************************/ /******************************************************************************/
--- a/main/octproj/src/projwrap.h Fri Apr 13 10:06:29 2012 +0000 +++ b/main/octproj/src/projwrap.h Fri Apr 13 10:40:59 2012 +0000 @@ -23,7 +23,7 @@ #include<stdio.h> #include<stdlib.h> #include<math.h> -#include<projects.h> +#include<proj_api.h> /******************************************************************************/ /******************************************************************************/ #ifdef __cplusplus @@ -32,6 +32,15 @@ /******************************************************************************/ /******************************************************************************/ /** +\def PROJ_ERR_NOT_INV_PROJ +\brief Error identifier from PROJ.4. Do not exist inverse step for a defined + projection. +\date 13-04-2012: Constant creation. +*/ +#define PROJ_ERR_NOT_INV_PROJ -17 +/******************************************************************************/ +/******************************************************************************/ +/** \def PROJWRAP_ERR_NOT_INV_PROJ \brief Error identifier. Do not exist inverse step for a defined projection. \date 12-12-2009: Constant creation.