diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index 5814114a155..b23978cac40 100644 --- a/platform/node/test/ignores.json +++ b/platform/node/test/ignores.json @@ -47,13 +47,7 @@ "render-tests/debug/tile": "https://github.com/mapbox/mapbox-gl-native/issues/3841", "render-tests/debug/tile-overscaled": "https://github.com/mapbox/mapbox-gl-native/issues/3841", "render-tests/extent/1024-circle": "needs investigation", - "render-tests/fill-extrusion-pattern/@2x": "https://github.com/mapbox/mapbox-gl-js/issues/3327", - "render-tests/fill-extrusion-pattern/function": "https://github.com/mapbox/mapbox-gl-js/issues/3327", - "render-tests/fill-extrusion-pattern/function-2": "https://github.com/mapbox/mapbox-gl-js/issues/3327", - "render-tests/fill-extrusion-pattern/literal": "https://github.com/mapbox/mapbox-gl-js/issues/3327", - "render-tests/fill-extrusion-pattern/opacity": "https://github.com/mapbox/mapbox-gl-js/issues/3327", - "render-tests/fill-extrusion-pattern/feature-expression": "https://github.com/mapbox/mapbox-gl-js/issues/3327", - "render-tests/fill-extrusion-pattern/tile-buffer": "https://github.com/mapbox/mapbox-gl-js/issues/3327", + "render-tests/fill-extrusion-pattern/tile-buffer": "https://github.com/mapbox/mapbox-gl-js/issues/4403", "render-tests/fill-pattern/literal": "FLAKY: do not re-enable without extensive testing - https://github.com/mapbox/mapbox-gl-native/issues/14423", "render-tests/fill-pattern/opacity": "FLAKY: do not re-enable without extensive testing - https://github.com/mapbox/mapbox-gl-native/issues/14870", "render-tests/fill-pattern/update-feature-state": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", diff --git a/src/mbgl/tile/geometry_tile_data.cpp b/src/mbgl/tile/geometry_tile_data.cpp index 5320df6893a..7f4c3dbeb0e 100644 --- a/src/mbgl/tile/geometry_tile_data.cpp +++ b/src/mbgl/tile/geometry_tile_data.cpp @@ -36,6 +36,27 @@ static GeometryCollection toGeometryCollection(MultiPolygon&& multipoly return result; } +// Attempts to restore original point order in rings: +// see https://github.com/mapbox/mapbox-gl-native/issues/15268. +static GeometryCollection restorePointOrder(GeometryCollection&& rings, const GeometryCollection& originalRings) { + if (rings.size() != originalRings.size()) { + // No sense restoring starting point if polygons are changed. + return std::move(rings); + } + + int i = 0; + for (auto& ring : rings) { + const auto originalRing = originalRings[i++]; + auto item = find(ring.begin(), ring.end() - 1, originalRing[0]); + if (item != ring.end()) { + rotate(ring.begin(), item, ring.end() - 1); + // Close the ring. + ring.back() = ring.front(); + } + } + return std::move(rings); +} + GeometryCollection fixupPolygons(const GeometryCollection& rings) { using namespace mapbox::geometry::wagyu; @@ -48,7 +69,7 @@ GeometryCollection fixupPolygons(const GeometryCollection& rings) { MultiPolygon multipolygon; clipper.execute(clip_type_union, multipolygon, fill_type_even_odd, fill_type_even_odd); - return toGeometryCollection(std::move(multipolygon)); + return restorePointOrder(toGeometryCollection(std::move(multipolygon)), rings); } std::vector classifyRings(const GeometryCollection& rings) {