From 74a4dffbe7d416de9a93395240e2a3f4089775ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Tue, 8 Nov 2016 21:50:20 +0100 Subject: [PATCH] :triangular_ruler: don't try to paint post-reduction-invalid polygons --- src/Canvas.coffee | 4 ++++ src/Renderer.coffee | 14 +++++++------- src/Termap.coffee | 2 +- src/Tile.coffee | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Canvas.coffee b/src/Canvas.coffee index f74c1cc..64c53d5 100644 --- a/src/Canvas.coffee +++ b/src/Canvas.coffee @@ -50,7 +50,11 @@ module.exports = class Canvas for ring in rings if vertices.length + continue if ring.length < 3 holes.push vertices.length/2 + else + return if ring.length < 3 + for point in ring vertices = vertices.concat point diff --git a/src/Renderer.coffee b/src/Renderer.coffee index 4ccd148..44ee25a 100644 --- a/src/Renderer.coffee +++ b/src/Renderer.coffee @@ -292,12 +292,12 @@ module.exports = class Renderer # else # scaled = ([point.x, point.y] for point in simplify scaled, 2, false) - if filter - if scaled.length is 2 - if @_seen[ka = (scaled[0]<<8)+scaled[1]] or - @_seen[kb = (scaled[1]<<8)+scaled[0]] - return [] - - @_seen[ka] = @_seen[kb] = true + # if filter + # if scaled.length is 2 + # if @_seen[ka = (scaled[0]<<8)+scaled[1]] or + # @_seen[kb = (scaled[1]<<8)+scaled[0]] + # return [] + # + # @_seen[ka] = @_seen[kb] = true scaled diff --git a/src/Termap.coffee b/src/Termap.coffee index e85a5dc..2bcb092 100644 --- a/src/Termap.coffee +++ b/src/Termap.coffee @@ -188,7 +188,7 @@ module.exports = class Termap @zoom += @zoomy * @config.zoomStep else @zoomy *= -1 - @_draw() + setImmediate => @_draw() _getFooter: -> # features = @renderer.featuresAt @mousePosition.x-1-(@view[0]>>1), @mousePosition.y-1-(@view[1]>>2) diff --git a/src/Tile.coffee b/src/Tile.coffee index 2b7b2d9..195b1eb 100644 --- a/src/Tile.coffee +++ b/src/Tile.coffee @@ -72,7 +72,7 @@ class Tile # TODO: monkey patching test case for tiles with a reduced extent 4096 / 8 -> 512 # use feature.loadGeometry() again as soon as we got a 512 extent tileset - geometries = feature.loadGeometry() #@_reduceGeometry feature, 8 + geometries = feature.@_reduceGeometry feature, 8 if style.type is "fill" nodes.push @_addBoundaries true,