From fe2e9d28770cf503188bb3c7448dcdbbc3edfd28 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 9 Mar 2018 18:17:33 +0100 Subject: [PATCH] [srs] Add new projection error/exception codes. --- .../srs/projections/impl/pj_strerrno.hpp | 11 +++++++++++ .../srs/projections/impl/pj_transform.hpp | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp b/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp index 22e0c48af..418bea926 100644 --- a/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp @@ -86,6 +86,17 @@ pj_err_list[] = { "point not within available datum shift grids", /* -48 */ "invalid sweep axis, choose x or y", /* -49 */ "malformed pipeline", /* -50 */ + "unit conversion factor must be > 0", /* -51 */ + "invalid scale", /* -52 */ + "non-convergent computation", /* -53 */ + "missing required arguments", /* -54 */ + "lat_0 = 0", /* -55 */ + "ellipsoidal usage unsupported", /* -56 */ + "only one +init allowed for non-pipeline operations", /* -57 */ + "argument not numerical or out of range", /* -58 */ + + /* When adding error messages, remember to update ID defines in + projects.h, and transient_error array in pj_transform */ }; inline std::string pj_generic_strerrno(std::string const& msg, int err) diff --git a/include/boost/geometry/srs/projections/impl/pj_transform.hpp b/include/boost/geometry/srs/projections/impl/pj_transform.hpp index 8c2095642..b6200a57a 100644 --- a/include/boost/geometry/srs/projections/impl/pj_transform.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_transform.hpp @@ -182,22 +182,32 @@ inline typename Par::type M_BF(Par const& defn) { return defn.datum_params[6]; } /* ** This table is intended to indicate for any given error code in -** the range 0 to -44, whether that error will occur for all locations (ie. +** the range 0 to -56, whether that error will occur for all locations (ie. ** it is a problem with the coordinate system as a whole) in which case the ** value would be 0, or if the problem is with the point being transformed ** in which case the value is 1. ** ** At some point we might want to move this array in with the error message ** list or something, but while experimenting with it this should be fine. +** +** +** NOTE (2017-10-01): Non-transient errors really should have resulted in a +** PJ==0 during initialization, and hence should be handled at the level +** before calling pj_transform. The only obvious example of the contrary +** appears to be the PJD_ERR_GRID_AREA case, which may also be taken to +** mean "no grids available" +** +** */ -static const int transient_error[50] = { +static const int transient_error[60] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 to 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10 to 19 */ 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, /* 20 to 29 */ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, /* 30 to 39 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 40 to 49 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }; + /* 40 to 49 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + /* 50 to 59 */ 1, 0, 1, 0, 1, 1, 1, 1, 0, 0 }; template