[Git][debian-gis-team/mapnik][upstream] New upstream version 4.0.4+ds

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Wed Dec 4 15:18:13 GMT 2024



Bas Couwenberg pushed to branch upstream at Debian GIS Project / mapnik


Commits:
1e5562b1 by Bas Couwenberg at 2024-12-04T16:02:40+01:00
New upstream version 4.0.4+ds
- - - - -


8 changed files:

- CHANGELOG.md
- configure
- demo/viewer/mainwindow.cpp
- include/mapnik/expression_grammar_x3_def.hpp
- include/mapnik/function_call.hpp
- include/mapnik/version.hpp
- src/value.cpp
- test/unit/core/expressions_test.cpp


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -6,6 +6,16 @@ Developers: Please commit along with changes.
 
 For a complete change history, see the git log.
 
+## Mapnik 4.0.4
+
+Released December 4th, 2024
+
+(Packaged from [51a8a59f1](https://github.com/mapnik/mapnik/commit/51a8a59f1)
+
+- Implicit conversions operators in Expressions bool(expr), int(expr), float(expr), str(expr)
+- value::to_bool() - sync logic with Python bool() operator e.g `if 0 -> false : else -> true`
+- Demo viewer - fix bounding box reprojection
+
 ## Mapnik 4.0.3
 
 Released October 30th, 2024


=====================================
configure
=====================================
@@ -22,11 +22,11 @@ fi
 # These do not normally need to be set except when
 # building against binary versions of dependencies like
 # done via bootstrap.sh
-VARS=()
+
 if [ -f mapnik-settings.env ]; then
     echo "Inheriting from mapnik-settings.env"
     . ./mapnik-settings.env
     VARS=( $(cat mapnik-settings.env) )
 fi
 
-$PYTHON scons/scons.py --implicit-deps-changed configure ${VARS[*]} "$@"
+$PYTHON scons/scons.py --implicit-deps-changed configure ${VARS[*]:-} "$@"


=====================================
demo/viewer/mainwindow.cpp
=====================================
@@ -42,6 +42,7 @@
 #include <mapnik/load_map.hpp>
 #include <mapnik/save_map.hpp>
 #include <mapnik/projection.hpp>
+#include <mapnik/proj_transform.hpp>
 #include <mapnik/util/timer.hpp>
 #endif
 
@@ -408,12 +409,17 @@ void MainWindow::set_default_extent(double x0, double y0, double x1, double y1)
         std::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
         if (map_ptr)
         {
-            mapnik::projection prj(map_ptr->srs());
-            prj.forward(x0, y0);
-            prj.forward(x1, y1);
-            default_extent_ = mapnik::box2d<double>(x0, y0, x1, y1);
-            mapWidget_->zoomToBox(default_extent_);
-            std::cout << "SET DEFAULT EXT:" << default_extent_ << std::endl;
+            mapnik::projection wgs84("epsg:4326");
+            mapnik::projection map_proj(map_ptr->srs());
+            std::cerr << map_ptr->srs() << std::endl;
+            mapnik::proj_transform tr(wgs84, map_proj);
+            auto bbox = mapnik::box2d<double>(x0, y0, x1, y1);
+            if (tr.forward(bbox))
+            {
+                default_extent_ = bbox;
+                mapWidget_->zoomToBox(default_extent_);
+                std::cout << "SET DEFAULT EXT:" << default_extent_ << std::endl;
+            }
         }
     }
     catch (...)


=====================================
include/mapnik/expression_grammar_x3_def.hpp
=====================================
@@ -217,6 +217,10 @@ struct unary_function_types_ : x3::symbols<unary_function_impl>
           ("log", log_impl())       //
           ("abs", abs_impl())       //
           ("length", length_impl()) //
+          ("bool", bool_impl())     //
+          ("int", int_impl())       //
+          ("float", float_impl())   //
+          ("str", str_impl())       //
           ;
     }
 } const unary_func_types;


=====================================
include/mapnik/function_call.hpp
=====================================
@@ -89,6 +89,30 @@ struct length_impl
     value_type operator()(value_type const& val) const { return val.to_unicode().length(); }
 };
 
+// str
+struct str_impl
+{
+    value_type operator()(value_type const& val) const { return val.to_unicode(); }
+};
+
+// bool
+struct bool_impl
+{
+    value_type operator()(value_type const& val) const { return val.to_bool(); }
+};
+
+// int
+struct int_impl
+{
+    value_type operator()(value_type const& val) const { return val.to_int(); }
+};
+
+// float
+struct float_impl
+{
+    value_type operator()(value_type const& val) const { return val.to_double(); }
+};
+
 // min
 inline value_type min_impl(value_type const& arg1, value_type const& arg2)
 {


=====================================
include/mapnik/version.hpp
=====================================
@@ -27,7 +27,7 @@
 
 #define MAPNIK_MAJOR_VERSION 4
 #define MAPNIK_MINOR_VERSION 0
-#define MAPNIK_PATCH_VERSION 3
+#define MAPNIK_PATCH_VERSION 4
 
 #define MAPNIK_VERSION MAPNIK_VERSION_ENCODE(MAPNIK_MAJOR_VERSION, MAPNIK_MINOR_VERSION, MAPNIK_PATCH_VERSION)
 


=====================================
src/value.cpp
=====================================
@@ -441,7 +441,7 @@ struct convert<value_bool>
     template<typename T>
     value_bool operator()(T val) const
     {
-        return val > 0 ? true : false;
+        return val == 0 ? false : true;
     }
 };
 


=====================================
test/unit/core/expressions_test.cpp
=====================================
@@ -94,6 +94,15 @@ TEST_CASE("expressions")
     TRY_CHECK(parse_and_dump("'escaped \\' apostrophe'") == "'escaped \\' apostrophe'");
     TRY_CHECK(parse_and_dump("'escaped \\\\ backslash'") == "'escaped \\\\ backslash'");
 
+    // explicit conversions
+    TRY_CHECK(eval("int('123')") == 123);
+    TRY_CHECK(eval("float('3.14'+'159')") == 3.14159);
+    TRY_CHECK(eval("bool(-0.001)") == true);
+    TRY_CHECK(eval("bool(0.001)") == true);
+    TRY_CHECK(eval("bool(0.0)") == false);
+    TRY_CHECK(eval("str(123)") == tr.transcode("123"));
+    TRY_CHECK(eval("float(str(3.14) + str(159))") == 3.14159);
+
     // floating point constants
     TRY_CHECK(parse_and_dump("pi") == "3.14159");
     TRY_CHECK(parse_and_dump("deg_to_rad") == "0.0174533");



View it on GitLab: https://salsa.debian.org/debian-gis-team/mapnik/-/commit/1e5562b1c19c8065a3f5fe3394202b23998269b8

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapnik/-/commit/1e5562b1c19c8065a3f5fe3394202b23998269b8
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20241204/473de38b/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list