diff --git a/include/boost/geometry/srs/projections/impl/geocent.hpp b/include/boost/geometry/srs/projections/impl/geocent.hpp index 7bfb269fc..8ae2f393c 100644 --- a/include/boost/geometry/srs/projections/impl/geocent.hpp +++ b/include/boost/geometry/srs/projections/impl/geocent.hpp @@ -171,9 +171,9 @@ inline long pj_Set_Geocentric_Parameters (GeocentricInfo & gi, T const& a, T template -void pj_Get_Geocentric_Parameters (GeocentricInfo const& gi, - T & a, - T & b) +inline void pj_Get_Geocentric_Parameters (GeocentricInfo const& gi, + T & a, + T & b) { /* BEGIN Get_Geocentric_Parameters */ /* * The function Get_Geocentric_Parameters returns the ellipsoid parameters @@ -189,9 +189,9 @@ void pj_Get_Geocentric_Parameters (GeocentricInfo const& gi, template -long pj_Convert_Geodetic_To_Geocentric (GeocentricInfo const& gi, - T Longitude, T Latitude, T Height, - T & X, T & Y, T & Z) +inline long pj_Convert_Geodetic_To_Geocentric (GeocentricInfo const& gi, + T Longitude, T Latitude, T Height, + T & X, T & Y, T & Z) { /* BEGIN Convert_Geodetic_To_Geocentric */ /* * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates @@ -260,9 +260,9 @@ long pj_Convert_Geodetic_To_Geocentric (GeocentricInfo const& gi, #define BOOST_GEOMETRY_PROJECTIONS_USE_ITERATIVE_METHOD template -void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo const& gi, - T X, T Y, T Z, - T & Longitude, T & Latitude, T & Height) +inline void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo const& gi, + T X, T Y, T Z, + T & Longitude, T & Latitude, T & Height) { /* BEGIN Convert_Geocentric_To_Geodetic */ static const T PI_OVER_2 = math::half_pi(); diff --git a/include/boost/geometry/srs/projections/impl/pj_init.hpp b/include/boost/geometry/srs/projections/impl/pj_init.hpp index a048e163a..e63379483 100644 --- a/include/boost/geometry/srs/projections/impl/pj_init.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_init.hpp @@ -255,7 +255,7 @@ inline parameters pj_init(BGParams const& bg_params, R const& arguments, bool us pin.over = pj_param(pin.params, "bover").i; /* longitude center for wrapping */ - pin.is_long_wrap_set = pj_param(pin.params, "tlon_wrap").i; + pin.is_long_wrap_set = pj_param(pin.params, "tlon_wrap").i != 0; if (pin.is_long_wrap_set) pin.long_wrap_center = pj_param(pin.params, "rlon_wrap").f; diff --git a/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp b/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp index af11dc8cf..54467d4a3 100644 --- a/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_strerrno.hpp @@ -87,7 +87,7 @@ pj_err_list[] = { "malformed pipeline", /* -50 */ }; -std::string pj_strerrno(int err) { +inline std::string pj_strerrno(int err) { if (0==err) return ""; diff --git a/include/boost/geometry/srs/projections/impl/pj_transform.hpp b/include/boost/geometry/srs/projections/impl/pj_transform.hpp index 4bac52bb9..8949ca82d 100644 --- a/include/boost/geometry/srs/projections/impl/pj_transform.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_transform.hpp @@ -171,13 +171,20 @@ static int pj_adjust_axis( projCtx ctx, const char *axis, int denormalize_flag, #define SRS_WGS84_ESQUARED 0.0066943799901413165 #endif*/ -#define Dx_BF (defn.datum_params[0]) -#define Dy_BF (defn.datum_params[1]) -#define Dz_BF (defn.datum_params[2]) -#define Rx_BF (defn.datum_params[3]) -#define Ry_BF (defn.datum_params[4]) -#define Rz_BF (defn.datum_params[5]) -#define M_BF (defn.datum_params[6]) +template +inline double Dx_BF(Par const& defn) { return defn.datum_params[0]; } +template +inline double Dy_BF(Par const& defn) { return defn.datum_params[1]; } +template +inline double Dz_BF(Par const& defn) { return defn.datum_params[2]; } +template +inline double Rx_BF(Par const& defn) { return defn.datum_params[3]; } +template +inline double Ry_BF(Par const& defn) { return defn.datum_params[4]; } +template +inline double Rz_BF(Par const& defn) { return defn.datum_params[5]; } +template +inline double M_BF(Par const& defn) { return defn.datum_params[6]; } /* ** This table is intended to indicate for any given error code in @@ -723,7 +730,7 @@ inline int pj_geocentric_to_geodetic( T const& a, T const& es, /************************************************************************/ template -bool pj_compare_datums( Par & srcdefn, Par & dstdefn ) +inline bool pj_compare_datums( Par & srcdefn, Par & dstdefn ) { if( srcdefn.datum_type != dstdefn.datum_type ) { @@ -766,8 +773,8 @@ bool pj_compare_datums( Par & srcdefn, Par & dstdefn ) /************************************************************************/ template -int pj_geocentric_to_wgs84( Par const& defn, - range_wrapper & range_wrapper ) +inline int pj_geocentric_to_wgs84( Par const& defn, + range_wrapper & range_wrapper ) { typedef typename boost::range_value::type point_type; @@ -785,9 +792,9 @@ int pj_geocentric_to_wgs84( Par const& defn, if( get<0>(point) == HUGE_VAL ) continue; - set<0>(point, get<0>(point) + Dx_BF); - set<1>(point, get<1>(point) + Dy_BF); - range_wrapper.set_z(i, range_wrapper.get_z(i) + Dz_BF); + set<0>(point, get<0>(point) + Dx_BF(defn)); + set<1>(point, get<1>(point) + Dy_BF(defn)); + range_wrapper.set_z(i, range_wrapper.get_z(i) + Dz_BF(defn)); } } else if( defn.datum_type == PJD_7PARAM ) @@ -805,9 +812,9 @@ int pj_geocentric_to_wgs84( Par const& defn, coord_t x_out, y_out, z_out; - x_out = M_BF*( x - Rz_BF*y + Ry_BF*z) + Dx_BF; - y_out = M_BF*( Rz_BF*x + y - Rx_BF*z) + Dy_BF; - z_out = M_BF*(-Ry_BF*x + Rx_BF*y + z) + Dz_BF; + x_out = M_BF(defn)*( x - Rz_BF(defn)*y + Ry_BF(defn)*z) + Dx_BF(defn); + y_out = M_BF(defn)*( Rz_BF(defn)*x + y - Rx_BF(defn)*z) + Dy_BF(defn); + z_out = M_BF(defn)*(-Ry_BF(defn)*x + Rx_BF(defn)*y + z) + Dz_BF(defn); set<0>(point, x_out); set<1>(point, y_out); @@ -823,8 +830,8 @@ int pj_geocentric_to_wgs84( Par const& defn, /************************************************************************/ template -int pj_geocentric_from_wgs84( Par const& defn, - range_wrapper & range_wrapper ) +inline int pj_geocentric_from_wgs84( Par const& defn, + range_wrapper & range_wrapper ) { typedef typename boost::range_value::type point_type; @@ -842,9 +849,9 @@ int pj_geocentric_from_wgs84( Par const& defn, if( get<0>(point) == HUGE_VAL ) continue; - set<0>(point, get<0>(point) - Dx_BF); - set<1>(point, get<1>(point) - Dy_BF); - range_wrapper.set_z(i, range_wrapper.get_z(i) - Dz_BF); + set<0>(point, get<0>(point) - Dx_BF(defn)); + set<1>(point, get<1>(point) - Dy_BF(defn)); + range_wrapper.set_z(i, range_wrapper.get_z(i) - Dz_BF(defn)); } } else if( defn.datum_type == PJD_7PARAM ) @@ -861,13 +868,13 @@ int pj_geocentric_from_wgs84( Par const& defn, coord_t y = get<1>(point); coord_t z = range_wrapper.get_z(i); - coord_t x_tmp = (x - Dx_BF) / M_BF; - coord_t y_tmp = (y - Dy_BF) / M_BF; - coord_t z_tmp = (z - Dz_BF) / M_BF; + coord_t x_tmp = (x - Dx_BF(defn)) / M_BF(defn); + coord_t y_tmp = (y - Dy_BF(defn)) / M_BF(defn); + coord_t z_tmp = (z - Dz_BF(defn)) / M_BF(defn); - x = x_tmp + Rz_BF*y_tmp - Ry_BF*z_tmp; - y = -Rz_BF*x_tmp + y_tmp + Rx_BF*z_tmp; - z = Ry_BF*x_tmp - Rx_BF*y_tmp + z_tmp; + x = x_tmp + Rz_BF(defn)*y_tmp - Ry_BF(defn)*z_tmp; + y = -Rz_BF(defn)*x_tmp + y_tmp + Rx_BF(defn)*z_tmp; + z = Ry_BF(defn)*x_tmp - Rx_BF(defn)*y_tmp + z_tmp; set<0>(point, x); set<1>(point, y); @@ -893,8 +900,8 @@ inline bool pj_datum_check_error(int err) /************************************************************************/ template -void pj_datum_transform( Par const& srcdefn, Par const& dstdefn, - Range & range ) +inline void pj_datum_transform( Par const& srcdefn, Par const& dstdefn, + Range & range ) { double src_a, src_es, dst_a, dst_es;