[mapnik-vector-tile] 01/04: Imported Upstream version 1.0.4+dfsg
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Mar 11 12:31:36 UTC 2016
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 10fe62556f7bedd591001b8cc03b3a01e8613b41
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Fri Mar 11 13:29:24 2016 +0100
Imported Upstream version 1.0.4+dfsg
---
CHANGELOG.md | 5 +++
Makefile | 2 +-
bench/vtile-transform.cpp | 1 +
package.json | 2 +-
src/vector_tile_geometry_feature.hpp | 8 ++--
test/data/0.0.0.vector-b.mvt | Bin 2835 -> 2840 bytes
test/data/simplified_geometry.geojson | 1 +
test/data/simplified_geometry_pbf.geojson | 1 +
test/test_utils.cpp | 1 +
test/unit/encoding/geometry_to_feature_pbf.cpp | 50 +++++++++++++++++++++++++
test/vector_tile.cpp | 18 ++++++++-
test/vector_tile_pbf.cpp | 15 +++++++-
test/vector_tile_rasterize.cpp | 2 +-
13 files changed, 95 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 40f0524..d767b5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 1.0.4
+
+- Updated the version of the clipper again, fixing more problems with intersections.
+- Fixed bug in `vector_tile_geometry_feature.hpp` that was causing a segfault.
+
## 1.0.3
- Updated the version of clipper after a bug was found in clipper that would result in invalid polygons where interior rings were outside another exterior ring.
diff --git a/Makefile b/Makefile
index 459d54c..df4348f 100755
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
MAPNIK_PLUGINDIR := $(shell mapnik-config --input-plugins)
BUILDTYPE ?= Release
-CLIPPER_REVISION=b82601d67830a84179888360e3dea645c1125a26
+CLIPPER_REVISION=150f2c4f58a72c051bcad76c84f10362797bf5ab
PROTOZERO_REVISION=v1.3.0
GYP_REVISION=3464008
diff --git a/bench/vtile-transform.cpp b/bench/vtile-transform.cpp
index 5bc78ba..ae39f4e 100644
--- a/bench/vtile-transform.cpp
+++ b/bench/vtile-transform.cpp
@@ -1,3 +1,4 @@
+#include <mapnik/geometry_correct.hpp>
#include <mapnik/projection.hpp>
#include <mapnik/geometry_transform.hpp>
#include <mapnik/util/file_io.hpp>
diff --git a/package.json b/package.json
index 3167d67..a8db03d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mapnik-vector-tile",
- "version": "1.0.3",
+ "version": "1.0.4",
"description": "Mapnik Vector Tile API",
"main": "./package.json",
"repository" : {
diff --git a/src/vector_tile_geometry_feature.hpp b/src/vector_tile_geometry_feature.hpp
index 250f394..fc10a88 100644
--- a/src/vector_tile_geometry_feature.hpp
+++ b/src/vector_tile_geometry_feature.hpp
@@ -63,11 +63,11 @@ struct geometry_to_feature_pbf_visitor
feature_writer.add_packed_uint32(Feature_Encoding::TAGS, feature_tags.begin(), feature_tags.end());
builder_.make_not_empty();
}
+ else
+ {
+ feature_writer.rollback();
+ }
}
- if (!success)
- {
- layer_writer.rollback();
- }
}
void operator() (mapnik::geometry::geometry_collection<std::int64_t> const& collection)
diff --git a/test/data/0.0.0.vector-b.mvt b/test/data/0.0.0.vector-b.mvt
index 295bf58..4ab38ac 100644
Binary files a/test/data/0.0.0.vector-b.mvt and b/test/data/0.0.0.vector-b.mvt differ
diff --git a/test/data/simplified_geometry.geojson b/test/data/simplified_geometry.geojson
new file mode 100644
index 0000000..8ce0bdb
--- /dev/null
+++ b/test/data/simplified_geometry.geojson
@@ -0,0 +1 @@
+{"type":"Polygon","coordinates":[[[160.36171875,11.2997786224589],[160.3828125,11.3011576095711],[160.408125,11.3039155638972],[160.408125,11.2997786224589],[160.425,11.3094313929343],[160.41234375,11.3411453475587],[160.3996875,11.3301148056307],[160.40953125,11.3700984927314],[160.39265625,11.3618264654176],[160.396875,11.3797488877286],[160.4053125,11.3893989555911],[160.40953125,11.3866418267411],[160.419375,11.4004272036667],[160.41515625,11.4059411672242],[160.419375,11.41145502372 [...]
\ No newline at end of file
diff --git a/test/data/simplified_geometry_pbf.geojson b/test/data/simplified_geometry_pbf.geojson
new file mode 100644
index 0000000..8ce0bdb
--- /dev/null
+++ b/test/data/simplified_geometry_pbf.geojson
@@ -0,0 +1 @@
+{"type":"Polygon","coordinates":[[[160.36171875,11.2997786224589],[160.3828125,11.3011576095711],[160.408125,11.3039155638972],[160.408125,11.2997786224589],[160.425,11.3094313929343],[160.41234375,11.3411453475587],[160.3996875,11.3301148056307],[160.40953125,11.3700984927314],[160.39265625,11.3618264654176],[160.396875,11.3797488877286],[160.4053125,11.3893989555911],[160.40953125,11.3866418267411],[160.419375,11.4004272036667],[160.41515625,11.4059411672242],[160.419375,11.41145502372 [...]
\ No newline at end of file
diff --git a/test/test_utils.cpp b/test/test_utils.cpp
index f56ae15..5a3fca8 100644
--- a/test/test_utils.cpp
+++ b/test/test_utils.cpp
@@ -18,6 +18,7 @@
#include <mapnik/image.hpp>
#include <mapnik/image_reader.hpp>
#include <mapnik/util/file_io.hpp>
+#include <mapnik/geometry_correct.hpp>
#include <mapnik/json/geometry_parser.hpp>
#include <string>
#include <memory>
diff --git a/test/unit/encoding/geometry_to_feature_pbf.cpp b/test/unit/encoding/geometry_to_feature_pbf.cpp
new file mode 100644
index 0000000..66741ee
--- /dev/null
+++ b/test/unit/encoding/geometry_to_feature_pbf.cpp
@@ -0,0 +1,50 @@
+#include "catch.hpp"
+
+// mapnik vector tile
+#include "vector_tile_geometry_feature.hpp"
+#include "vector_tile_layer.hpp"
+
+// mapnik
+#include <mapnik/geometry.hpp>
+#include <mapnik/feature.hpp>
+#include <mapnik/feature_factory.hpp>
+#include <mapnik/util/variant.hpp>
+
+// protozero
+#include <protozero/pbf_writer.hpp>
+
+// libprotobuf
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#include "vector_tile.pb.h"
+#pragma GCC diagnostic pop
+
+// std
+#include <limits>
+
+//
+// Unit tests for encoding of geometries to features
+//
+
+TEST_CASE("encode feature pbf of degenerate linestring")
+{
+ mapnik::geometry::geometry_empty empty;
+ std::string empty_buffer = "";
+ mapnik::vector_tile_impl::layer_builder_pbf empty_layer("foo", 4096, empty_buffer);
+ mapnik::feature_ptr empty_feature(mapnik::feature_factory::create(std::make_shared<mapnik::context_type>(),1));
+ mapnik::vector_tile_impl::geometry_to_feature_pbf_visitor empty_visitor(*empty_feature, empty_layer);
+ empty_visitor(empty);
+
+ mapnik::geometry::line_string<std::int64_t> line;
+ line.add_coord(10,10);
+
+ std::string layer_buffer = "";
+ mapnik::vector_tile_impl::layer_builder_pbf layer("foo", 4096, layer_buffer);
+ mapnik::feature_ptr f(mapnik::feature_factory::create(std::make_shared<mapnik::context_type>(),1));
+ mapnik::vector_tile_impl::geometry_to_feature_pbf_visitor visitor(*f, layer);
+ visitor(line);
+
+ REQUIRE(layer_buffer == empty_buffer);
+ REQUIRE(layer.empty == true);
+}
diff --git a/test/vector_tile.cpp b/test/vector_tile.cpp
index 1f3ee0d..7a8edd7 100644
--- a/test/vector_tile.cpp
+++ b/test/vector_tile.cpp
@@ -15,6 +15,7 @@
#include <mapnik/memory_datasource.hpp>
#include <mapnik/projection.hpp>
#include <mapnik/proj_transform.hpp>
+#include <mapnik/util/file_io.hpp>
#include <mapnik/util/fs.hpp>
#include <mapnik/util/geometry_to_geojson.hpp>
#include <mapnik/vertex_adapters.hpp>
@@ -34,6 +35,9 @@
#include "vector_tile.pb.h"
#pragma GCC diagnostic pop
+// std
+#include <fstream>
+
TEST_CASE("vector tile from simplified geojson")
{
unsigned tile_size = 256 * 1000;
@@ -90,8 +94,18 @@ TEST_CASE("vector tile from simplified geojson")
CHECK( n_err == 0 );
std::string geojson_string;
CHECK( mapnik::util::to_geojson(geojson_string,projected_geom) );
- //std::clog << geojson_string << std::endl;
- CHECK( geojson_string == "{\"type\":\"Polygon\",\"coordinates\":[[[160.36171875,11.2997786224589],[160.3828125,11.3011576095711],[160.408125,11.3039155638972],[160.408125,11.2997786224589],[160.425,11.3094313929343],[160.41234375,11.3411453475587],[160.3996875,11.3301148056307],[160.40953125,11.3700984927314],[160.39265625,11.3618264654176],[160.396875,11.3797488877286],[160.4053125,11.3893989555911],[160.40953125,11.3866418267411],[160.419375,11.4004272036667],[160.41515625,11.40594 [...]
+ std::string geojson_file = "./test/data/simplified_geometry.geojson";
+ mapnik::util::file input(geojson_file);
+ if (input.open())
+ {
+ std::string json_string(input.data().get(), input.size());
+ CHECK (geojson_string == json_string);
+ }
+ if (!mapnik::util::exists(geojson_file) || (std::getenv("UPDATE") != nullptr))
+ {
+ std::ofstream out(geojson_file);
+ out << geojson_string;
+ }
}
TEST_CASE("vector tile transform -- should not throw on coords outside merc range")
diff --git a/test/vector_tile_pbf.cpp b/test/vector_tile_pbf.cpp
index 6150bad..21fdb66 100644
--- a/test/vector_tile_pbf.cpp
+++ b/test/vector_tile_pbf.cpp
@@ -14,6 +14,7 @@
#include <mapnik/projection.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/geometry_is_empty.hpp>
+#include <mapnik/util/file_io.hpp>
#include <mapnik/util/geometry_to_geojson.hpp>
#include <mapnik/geometry_reprojection.hpp>
#include <mapnik/geometry_transform.hpp>
@@ -414,8 +415,18 @@ TEST_CASE("pbf vector tile from simplified geojson")
CHECK( n_err == 0 );
std::string geojson_string;
CHECK( mapnik::util::to_geojson(geojson_string,projected_geom) );
- //std::clog << geojson_string << std::endl;
- CHECK( geojson_string == "{\"type\":\"Polygon\",\"coordinates\":[[[160.36171875,11.2997786224589],[160.3828125,11.3011576095711],[160.408125,11.3039155638972],[160.408125,11.2997786224589],[160.425,11.3094313929343],[160.41234375,11.3411453475587],[160.3996875,11.3301148056307],[160.40953125,11.3700984927314],[160.39265625,11.3618264654176],[160.396875,11.3797488877286],[160.4053125,11.3893989555911],[160.40953125,11.3866418267411],[160.419375,11.4004272036667],[160.41515625,11 [...]
+ std::string geojson_file = "./test/data/simplified_geometry_pbf.geojson";
+ mapnik::util::file input(geojson_file);
+ if (input.open())
+ {
+ std::string json_string(input.data().get(), input.size());
+ CHECK (geojson_string == json_string);
+ }
+ if (!mapnik::util::exists(geojson_file) || (std::getenv("UPDATE") != nullptr))
+ {
+ std::ofstream out(geojson_file);
+ out << geojson_string;
+ }
break;
}
}
diff --git a/test/vector_tile_rasterize.cpp b/test/vector_tile_rasterize.cpp
index 61dfcfb..4f43a34 100644
--- a/test/vector_tile_rasterize.cpp
+++ b/test/vector_tile_rasterize.cpp
@@ -122,7 +122,7 @@ TEST_CASE("vector tile rasterize -- should try to decode windfail tile")
// now `tile` should contain all the data
std::string buffer2;
out_tile.serialize_to_string(buffer2);
- CHECK(2835 == buffer2.size());
+ CHECK(2840 == buffer2.size());
std::ofstream stream_out("./test/data/0.0.0.vector-b.mvt",std::ios_base::out|std::ios_base::binary);
stream_out << buffer2;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapnik-vector-tile.git
More information about the Pkg-grass-devel
mailing list