This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mapnik-vector-tile.

commit d7f8a01a45a5f3f21ff19565cc137dd5b983b974
Author: Bas Couwenberg <sebas...@xs4all.nl>
Date:   Sat Oct 3 10:55:24 2015 +0200

    Imported Upstream version 0.11.0+dfsg
---
 CHANGELOG.md                  |  5 ++++
 Makefile                      |  4 ++--
 package.json                  |  2 +-
 src/vector_tile_processor.hpp |  2 ++
 src/vector_tile_processor.ipp | 31 ++++++++++++++++++------
 test/clipper_test.cpp         | 55 +++++++++++++++++++++++++++++++++++++++++++
 test/raster_tile.cpp          |  4 ++--
 test/vector_tile_pbf.cpp      |  2 +-
 8 files changed, 92 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index aaadafc..0b41e51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Changelog
 
+## 0.11.0
+
+ - Changed processor so that it now can optionally turn on and off strict 
enforcing of simple geometries from the clipper
+ - Updated angus clipper library used in Makefile to 6.4.0 
(https://github.com/mapnik/clipper/tree/r496-mapnik)
+
 ## 0.10.0
 
  - Changed the way painted is determined. Painted could not be marked as true 
but a vector tile would still be empty.
diff --git a/Makefile b/Makefile
index 27454c1..1e05b3d 100755
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 MAPNIK_PLUGINDIR := $(shell mapnik-config --input-plugins)
 BUILDTYPE ?= Release
 
-CLIPPER_REVISION=e0973e0802
+CLIPPER_REVISION=b848b91877b6f0121356aaf813e8b9a45f929daa
 PROTOZERO_REVISION=v1.0.0
 GYP_REVISION=3464008
 
@@ -14,7 +14,7 @@ all: libvtile
        git clone https://github.com/mapbox/protozero.git ./deps/protozero && 
cd ./deps/protozero && git checkout $(PROTOZERO_REVISION)
 
 ./deps/clipper:
-       git clone https://github.com/mapnik/clipper.git -b r493-mapnik 
./deps/clipper && cd ./deps/clipper && git checkout $(CLIPPER_REVISION) && 
./cpp/fix_members.sh
+       git clone https://github.com/mapnik/clipper.git -b r496-mapnik 
./deps/clipper && cd ./deps/clipper && git checkout $(CLIPPER_REVISION) && 
./cpp/fix_members.sh
 
 build/Makefile: ./deps/gyp ./deps/clipper ./deps/protozero gyp/build.gyp 
test/*cpp
        deps/gyp/gyp gyp/build.gyp --depth=. 
-DMAPNIK_PLUGINDIR=\"$(MAPNIK_PLUGINDIR)\" -Goutput_dir=. 
--generator-output=./build -f make
diff --git a/package.json b/package.json
index 132131c..59b972c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
     "name": "mapnik-vector-tile",
-    "version": "0.10.0",
+    "version": "0.11.0",
     "description": "Mapnik vector tile API",
     "main": "./package.json",
     "repository"   :  {
diff --git a/src/vector_tile_processor.hpp b/src/vector_tile_processor.hpp
index 89cf4ce..70fe9e0 100644
--- a/src/vector_tile_processor.hpp
+++ b/src/vector_tile_processor.hpp
@@ -37,6 +37,7 @@ private:
     double scale_factor_;
     mapnik::view_transform t_;
     double area_threshold_;
+    bool strictly_simple_;
     std::string image_format_;
     scaling_method_e scaling_method_;
     bool painted_;
@@ -49,6 +50,7 @@ public:
               unsigned offset_x=0,
               unsigned offset_y=0,
               double area_threshold=0.1,
+              bool strictly_simple=false,
               std::string const& image_format="jpeg",
               scaling_method_e scaling_method=SCALING_NEAR
         );
diff --git a/src/vector_tile_processor.ipp b/src/vector_tile_processor.ipp
index 220cfeb..e642e21 100644
--- a/src/vector_tile_processor.ipp
+++ b/src/vector_tile_processor.ipp
@@ -592,6 +592,7 @@ processor<T>::processor(T & backend,
               unsigned offset_x,
               unsigned offset_y,
               double area_threshold,
+              bool strictly_simple,
               std::string const& image_format,
               scaling_method_e scaling_method)
     : backend_(backend),
@@ -600,6 +601,7 @@ processor<T>::processor(T & backend,
       scale_factor_(scale_factor),
       t_(m_req.width(),m_req.height(),m_req.extent(),offset_x,offset_y),
       area_threshold_(area_threshold),
+      strictly_simple_(strictly_simple),
       image_format_(image_format),
       scaling_method_(scaling_method),
       painted_(false),
@@ -890,11 +892,13 @@ struct encoder_visitor {
     encoder_visitor(backend_type & backend,
                     mapnik::feature_impl const& feature,
                     mapnik::box2d<int> const& tile_clipping_extent,
-                    double area_threshold) :
+                    double area_threshold,
+                    bool strictly_simple) :
       backend_(backend),
       feature_(feature),
       tile_clipping_extent_(tile_clipping_extent),
-      area_threshold_(area_threshold) {}
+      area_threshold_(area_threshold),
+      strictly_simple_(strictly_simple) {}
 
     bool operator() (mapnik::geometry::geometry_empty const&)
     {
@@ -1041,7 +1045,10 @@ struct encoder_visitor {
             std::reverse(geom.exterior_ring.begin(), geom.exterior_ring.end());
         }
         ClipperLib::Clipper poly_clipper;
-        //poly_clipper.StrictlySimple(true);
+        /*if (strictly_simple_) 
+        {
+            poly_clipper.StrictlySimple(true);
+        }*/
         if (!poly_clipper.AddPath(geom.exterior_ring, ClipperLib::ptSubject, 
true))
         {
             return painted;
@@ -1080,7 +1087,10 @@ struct encoder_visitor {
         }
         
         ClipperLib::PolyTree polygons;
-        //clipper.StrictlySimple(true);
+        if (strictly_simple_)
+        {
+            clipper.StrictlySimple(true);
+        }
         clipper.Execute(ClipperLib::ctUnion, polygons); //, 
ClipperLib::pftNonZero);
         clipper.Clear();
         
@@ -1142,7 +1152,10 @@ struct encoder_visitor {
                 std::reverse(poly.exterior_ring.begin(), 
poly.exterior_ring.end());
             }
             ClipperLib::Clipper poly_clipper;
-            //poly_clipper.StrictlySimple(true);
+            /*if (strictly_simple_)
+            {
+                poly_clipper.StrictlySimple(true);
+            }*/
             if (!poly_clipper.AddPath(poly.exterior_ring, 
ClipperLib::ptSubject, true))
             {
                 continue;
@@ -1180,7 +1193,10 @@ struct encoder_visitor {
         }
         
         ClipperLib::PolyTree polygons;
-        //clipper.StrictlySimple(true);
+        if (strictly_simple_) 
+        {
+            clipper.StrictlySimple(true);
+        }
         clipper.Execute(ClipperLib::ctUnion, polygons); //, 
ClipperLib::pftNonZero);
         clipper.Clear();
         
@@ -1211,6 +1227,7 @@ struct encoder_visitor {
     mapnik::feature_impl const& feature_;
     mapnik::box2d<int> const& tile_clipping_extent_;
     double area_threshold_;
+    bool strictly_simple_;
 };
 
 template <typename T>
@@ -1295,7 +1312,7 @@ bool processor<T>::handle_geometry(T2 const& vs,
     using vector_tile_strategy_type = T2;
     mapnik::vector_tile_impl::transform_visitor<vector_tile_strategy_type> 
skipping_transformer(vs, target_clipping_extent);
     mapnik::geometry::geometry<std::int64_t> new_geom = 
mapnik::util::apply_visitor(skipping_transformer,geom);
-    encoder_visitor<T> encoder(backend_, feature, tile_clipping_extent, 
area_threshold_);
+    encoder_visitor<T> encoder(backend_, feature, tile_clipping_extent, 
area_threshold_, strictly_simple_);
     if (simplify_distance_ > 0)
     {
         simplify_visitor<T> simplifier(simplify_distance_,encoder);
diff --git a/test/clipper_test.cpp b/test/clipper_test.cpp
index 5224a98..4eb1c25 100644
--- a/test/clipper_test.cpp
+++ b/test/clipper_test.cpp
@@ -189,3 +189,58 @@ TEST_CASE( "clipper AddPath 2", "should throw on out of 
range coords" ) {
     }        
 }
 
+TEST_CASE( "clipper polytree error" ) {
+
+    // http://sourceforge.net/p/polyclipping/bugs/132/
+    ClipperLib::Clipper clipper;
+    ClipperLib::Paths polygons;
+    ClipperLib::Path shape1;
+    ClipperLib::Path shape2;
+    ClipperLib::Path shape3;
+    ClipperLib::Path shape4;
+    // shape 1
+    shape1.emplace_back(280000, 240000),
+    shape1.emplace_back(180000, 240000),
+    shape1.emplace_back(180000, 200000),
+    shape1.emplace_back(240000, 200000),
+    shape1.emplace_back(240000, 90000),
+    shape1.emplace_back(180000, 90000),
+    shape1.emplace_back(180000, 50000),
+    shape1.emplace_back(280000, 50000),
+    // shape 2
+    shape2.emplace_back(230000, 120000),
+    shape2.emplace_back(230000, 160000),
+    shape2.emplace_back(180000, 160000),
+    shape2.emplace_back(180000, 120000),
+    // shape 3
+    shape3.emplace_back(180000, 50000),
+    shape3.emplace_back(180000, 90000),
+    shape3.emplace_back(100000, 90001), // Problematic point
+    //shape3.emplace_back(100000, 90000), // This point is okay
+    shape3.emplace_back(100000, 200000),
+    shape3.emplace_back(180000, 200000),
+    shape3.emplace_back(180000, 240000),
+    shape3.emplace_back(60000, 240000),
+    shape3.emplace_back(60000, 50000),
+    // shape 4
+    shape4.emplace_back(180000, 120000),
+    shape4.emplace_back(180000, 160000),
+    shape4.emplace_back(120000, 160000),
+    shape4.emplace_back(120000, 120000),
+    polygons.emplace_back(shape1);
+    polygons.emplace_back(shape2);
+    polygons.emplace_back(shape3);
+    polygons.emplace_back(shape4);
+
+    clipper.AddPaths(polygons, ClipperLib::ptSubject, true);
+    ClipperLib::PolyTree solution;
+    clipper.Execute(ClipperLib::ctUnion, solution, ClipperLib::pftNonZero, 
ClipperLib::pftNonZero);
+
+    // Check that the polytree is correct
+    REQUIRE(solution.Childs.size() == 1);
+    REQUIRE(solution.Childs[0]->Childs.size() == 1);
+    REQUIRE(solution.Childs[0]->Childs[0]->Childs.size() == 1);
+    REQUIRE(solution.Childs[0]->Childs[0]->Childs[0]->Childs.size() == 0);
+
+}
+
diff --git a/test/raster_tile.cpp b/test/raster_tile.cpp
index 05be15d..6039873 100644
--- a/test/raster_tile.cpp
+++ b/test/raster_tile.cpp
@@ -48,7 +48,7 @@ TEST_CASE( "raster tile output 1", "should create raster tile 
with one raster la
     map.add_layer(lyr);
     mapnik::request m_req(tile_size,tile_size,bbox);
     m_req.set_buffer_size(map.buffer_size());
-    renderer_type 
ren(backend,map,m_req,1.0,0,0,1,"jpeg",mapnik::SCALING_BILINEAR);
+    renderer_type 
ren(backend,map,m_req,1.0,0,0,1,false,"jpeg",mapnik::SCALING_BILINEAR);
     ren.apply();
     std::string key("");
     CHECK(false == mapnik::vector_tile_impl::is_solid_extent(tile,key));
@@ -167,7 +167,7 @@ TEST_CASE( "raster tile output 2", "should be able to 
overzoom raster" ) {
         map.add_layer(lyr);
         mapnik::request m_req(256,256,bbox);
         m_req.set_buffer_size(map.buffer_size());
-        renderer_type 
ren(backend,map,m_req,1.0,0,0,1,"jpeg",mapnik::SCALING_BILINEAR);
+        renderer_type 
ren(backend,map,m_req,1.0,0,0,1,false,"jpeg",mapnik::SCALING_BILINEAR);
         ren.apply();
     }
     // Done creating test data, now test created tile
diff --git a/test/vector_tile_pbf.cpp b/test/vector_tile_pbf.cpp
index a45c500..f1ec69f 100644
--- a/test/vector_tile_pbf.cpp
+++ b/test/vector_tile_pbf.cpp
@@ -476,7 +476,7 @@ TEST_CASE( "pbf raster tile output", "should be able to 
overzoom raster" ) {
         map.add_layer(lyr);
         mapnik::request m_req(256,256,bbox);
         m_req.set_buffer_size(map.buffer_size());
-        renderer_type 
ren(backend,map,m_req,1.0,0,0,1,"jpeg",mapnik::SCALING_BILINEAR);
+        renderer_type 
ren(backend,map,m_req,1.0,0,0,1,false,"jpeg",mapnik::SCALING_BILINEAR);
         ren.apply();
     }
     // Done creating test data, now test created tile

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/mapnik-vector-tile.git

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to