From 8efaa959f00b29ad3ef3a6415f9bf737f76b35e3 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Fri, 24 Feb 2023 09:23:52 +0000 Subject: [PATCH] projection - rename 'expanded' to 'definition' (PJ_PROJ_INFO) + add 'description' method --- include/mapnik/projection.hpp | 3 ++- src/projection.cpp | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/mapnik/projection.hpp b/include/mapnik/projection.hpp index 6dc4ad399..5b65ea8d8 100644 --- a/include/mapnik/projection.hpp +++ b/include/mapnik/projection.hpp @@ -77,7 +77,8 @@ class MAPNIK_DECL projection std::string const& params() const; void forward(double& x, double& y) const; void inverse(double& x, double& y) const; - std::string expanded() const; + std::string definition() const; + std::string description() const; void init_proj() const; private: diff --git a/src/projection.cpp b/src/projection.cpp index ceb826541..375b48db1 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -196,13 +196,27 @@ projection::~projection() #endif } -std::string projection::expanded() const +std::string projection::description() const { #ifdef MAPNIK_USE_PROJ if (proj_) { PJ_PROJ_INFO info = proj_pj_info(proj_); - return mapnik::util::trim_copy(info.definition); + if (std::strlen(info.description) > 0) + return mapnik::util::trim_copy(info.description); + } +#endif + return std::string("Undefined"); +} + +std::string projection::definition() const +{ +#ifdef MAPNIK_USE_PROJ + if (proj_) + { + PJ_PROJ_INFO info = proj_pj_info(proj_); + if (std::strlen(info.definition) > 0) + return mapnik::util::trim_copy(info.definition); } #endif return params_;