diff --git a/deps/clipper/include/clipper.hpp b/deps/clipper/include/clipper.hpp index 5af03f98f..c1cb4a15f 100755 --- a/deps/clipper/include/clipper.hpp +++ b/deps/clipper/include/clipper.hpp @@ -1,8 +1,8 @@ /******************************************************************************* * * * Author : Angus Johnson * -* Version : 6.2.8 * -* Date : 10 February 2015 * +* Version : 6.2.9 * +* Date : 16 February 2015 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2015 * * * @@ -170,18 +170,18 @@ private: friend class MAPNIK_DECL Clipper; //to access AllNodes }; -bool Orientation(const Path &poly); -double Area(const Path &poly); -int PointInPolygon(const IntPoint &pt, const Path &path); +MAPNIK_DECL bool Orientation(const Path &poly); +MAPNIK_DECL double Area(const Path &poly); +MAPNIK_DECL int PointInPolygon(const IntPoint &pt, const Path &path); -void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd); -void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd); -void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd); +MAPNIK_DECL void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd); +MAPNIK_DECL void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd); +MAPNIK_DECL void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd); -void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415); -void CleanPolygon(Path& poly, double distance = 1.415); -void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); -void CleanPolygons(Paths& polys, double distance = 1.415); +MAPNIK_DECL void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415); +MAPNIK_DECL void CleanPolygon(Path& poly, double distance = 1.415); +MAPNIK_DECL void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); +MAPNIK_DECL void CleanPolygons(Paths& polys, double distance = 1.415); void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed); void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed); diff --git a/deps/clipper/src/clipper.cpp b/deps/clipper/src/clipper.cpp index 2e63bc7af..bc53d9159 100755 --- a/deps/clipper/src/clipper.cpp +++ b/deps/clipper/src/clipper.cpp @@ -1,8 +1,8 @@ /******************************************************************************* * * * Author : Angus Johnson * -* Version : 6.2.8 * -* Date : 10 February 2015 * +* Version : 6.2.9 * +* Date : 16 February 2015 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2015 * * * @@ -969,16 +969,13 @@ TEdge* ClipperBase::ProcessBound(TEdge* E, bool NextIsForward) EStart = E->Prev; else EStart = E->Next; - if (EStart->OutIdx != Skip) - { - if (IsHorizontal(*EStart)) //ie an adjoining horizontal skip edge + if (IsHorizontal(*EStart)) //ie an adjoining horizontal skip edge { if (EStart->Bot.X != E->Bot.X && EStart->Top.X != E->Bot.X) ReverseHorizontal(*E); } else if (EStart->Bot.X != E->Bot.X) ReverseHorizontal(*E); - } } EStart = E; diff --git a/include/mapnik/json/generic_json.hpp b/include/mapnik/json/generic_json.hpp index 109c9c587..c4fa67c28 100644 --- a/include/mapnik/json/generic_json.hpp +++ b/include/mapnik/json/generic_json.hpp @@ -57,8 +57,7 @@ struct unicode_string : qi::grammar struct push_utf8 { - template - struct result { typedef void type; }; + using result_type = void; void operator()(std::string& utf8, uchar code_point) const { @@ -71,8 +70,7 @@ struct push_utf8 struct push_esc { - template - struct result { typedef void type; }; + using result_type = void; void operator()(std::string& utf8, uchar c) const { diff --git a/include/mapnik/renderer_common/process_markers_symbolizer.hpp b/include/mapnik/renderer_common/process_markers_symbolizer.hpp index 799fff7af..14660fdd3 100644 --- a/include/mapnik/renderer_common/process_markers_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_markers_symbolizer.hpp @@ -171,9 +171,9 @@ struct render_marker_symbolizer_visitor if (clip) // optional clip (default: true) { geometry::geometry_types type = geometry::geometry_type(feature_.get_geometry()); - if (type == geometry::geometry_types::Polygon) + if (type == geometry::geometry_types::Polygon || type == geometry::geometry_types::MultiPolygon) converter.template set(); - else if (type == geometry::geometry_types::LineString) + else if (type == geometry::geometry_types::LineString || type == geometry::geometry_types::MultiLineString) converter.template set(); } diff --git a/include/mapnik/simplify_converter.hpp b/include/mapnik/simplify_converter.hpp index b31a0bff5..e9a88c4cf 100644 --- a/include/mapnik/simplify_converter.hpp +++ b/include/mapnik/simplify_converter.hpp @@ -244,7 +244,8 @@ private: // We eliminated the previous point because it was too close, but // we have to output it now anyway, since this is the end of the // vertex stream. Make sure that we output SEG_CLOSE in the next call. - vtx = last; + vtx.x = start_vertex_.x; + vtx.y = start_vertex_.y; status_ = closing; } break; diff --git a/include/mapnik/vertex_adapters.hpp b/include/mapnik/vertex_adapters.hpp index f09c737fb..5d4935858 100644 --- a/include/mapnik/vertex_adapters.hpp +++ b/include/mapnik/vertex_adapters.hpp @@ -181,6 +181,57 @@ private: mutable bool start_loop_; }; +struct ring_vertex_adapter +{ + using value_type = typename point::value_type; + ring_vertex_adapter(linear_ring const& ring) + : ring_(ring), + current_index_(0), + end_index_(ring_.size()), + start_loop_(true) {} + + void rewind(unsigned) const + { + current_index_ = 0; + end_index_ = ring_.size(); + start_loop_ = true; + } + + unsigned vertex(value_type * x, value_type * y) const + { + if (current_index_ < end_index_) + { + auto const& coord = ring_[current_index_++]; + *x = coord.x; + *y = coord.y; + if (start_loop_) + { + start_loop_= false; + return mapnik::SEG_MOVETO; + } + if (current_index_ == end_index_) + { + *x = 0; + *y = 0; + return mapnik::SEG_CLOSE; + } + return mapnik::SEG_LINETO; + } + return mapnik::SEG_END; + } + + inline geometry_types type () const + { + return geometry_types::Polygon; + } + +private: + linear_ring const& ring_; + mutable std::size_t current_index_; + mutable std::size_t end_index_; + mutable bool start_loop_; +}; + template struct vertex_adapter_traits {}; diff --git a/tests/cxx/vertex_adapter.cpp b/tests/cxx/vertex_adapter.cpp index ab6c9ab53..1f63c062e 100644 --- a/tests/cxx/vertex_adapter.cpp +++ b/tests/cxx/vertex_adapter.cpp @@ -98,7 +98,40 @@ SECTION("polygon with hole") { REQUIRE( x == 0 ); REQUIRE( y == 0 ); - // first hole + // exterior ring via ring_vertex_adapter + mapnik::geometry::ring_vertex_adapter va2(g.exterior_ring); + cmd = va2.vertex(&x,&y); + REQUIRE( cmd == mapnik::SEG_MOVETO ); + REQUIRE( x == 0 ); + REQUIRE( y == 0 ); + + cmd = va2.vertex(&x,&y); + REQUIRE( cmd == mapnik::SEG_LINETO ); + REQUIRE( x == -10 ); + REQUIRE( y == 0 ); + + cmd = va2.vertex(&x,&y); + REQUIRE( cmd == mapnik::SEG_LINETO ); + REQUIRE( x == -10 ); + REQUIRE( y == 10 ); + + cmd = va2.vertex(&x,&y); + REQUIRE( cmd == mapnik::SEG_LINETO ); + REQUIRE( x == 0 ); + REQUIRE( y == 10 ); + + cmd = va2.vertex(&x,&y); + REQUIRE( cmd == mapnik::SEG_CLOSE ); + REQUIRE( x == 0 ); + REQUIRE( y == 0 ); + + // since ring adapter is only for exterior, next should be END + cmd = va2.vertex(&x,&y); + REQUIRE( cmd == mapnik::SEG_END ); + REQUIRE( x == 0 ); + REQUIRE( y == 0 ); + + // first hole for polygon_adapter cmd = va.vertex(&x,&y); REQUIRE( cmd == mapnik::SEG_MOVETO ); REQUIRE( x == -7 );