Skip to content
Permalink
Browse files
馃弮 optimizing draw order based on zoom level
  • Loading branch information
rastapasta committed Nov 9, 2016
1 parent d10ed91 commit e3f42e46c9e9ee6cf0a0e518668a6eecaee31a42
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 915 deletions.
@@ -88,8 +88,6 @@ module.exports = class BrailleBuffer

output.push if @charBuffer[idx]
@charBuffer[idx]
else if @pixelBuffer[idx] is 0
' '
else
String.fromCharCode 0x2800+@pixelBuffer[idx]

@@ -17,54 +17,15 @@ utils = require './utils'
#simplify = require 'simplify-js'

module.exports = class Renderer
cache: {}
config:
language: 'de'
language: 'en'

labelMargin: 5

tileSize: 4096
projectSize: 256
maxZoom: 14

#"poi_label", "water",
drawOrder: [
"landuse"
"water"
"marine_label"
"building"
"road"
"admin"

"country_label"
"state_label"
"water_label"
"place_label"
"rail_station_label"
"poi_label"
"road_label"
"housenum_label"
]

icons:
car: "馃殫"
school: "S" #{}"馃彨"
marker: ""
'art-gallery': "A" #"馃帹"
attraction: ""
stadium: "馃張"
toilet: "馃毥"
cafe: ""
laundry: "馃憵"
bus: "馃殞"
restaurant: "R" #馃崨"
lodging: "B" #馃洀"
'fire-station': "馃殥"
shop: "馃泹"
pharmacy: "馃拪"
beer: "H" #"馃嵑"
cinema: "C" #"馃帵"

layers:
housenum_label:
margin: 4
@@ -178,7 +139,7 @@ module.exports = class Renderer

features = {}

for layer in @config.drawOrder
for layer in @_generateDrawOrder zoom
continue unless tile.data.layers?[layer]
features[layer] = tile.data.layers[layer].search box

@@ -188,7 +149,7 @@ module.exports = class Renderer
_renderTiles: (tiles) ->
drawn = {}

for layer in @config.drawOrder
for layer in @_generateDrawOrder tiles[0].xyz.z
for tile in tiles
continue unless tile.features[layer]?.length
for feature in tile.features[layer]
@@ -236,7 +197,6 @@ module.exports = class Renderer
feature.properties["name_en"] or
feature.properties["name"] or
feature.properties.house_num or
#@config.icons[feature.properties.maki] or
""

points = @_scaleAndReduce tile, feature, feature.points
@@ -308,3 +268,30 @@ module.exports = class Renderer
# @_seen[ka] = @_seen[kb] = true

scaled

_generateDrawOrder: (zoom) ->
if zoom < 2
[
"admin"
"water"
"country_label"
"marine_label"
]
else
[
"landuse"
"water"
"marine_label"
"building"
"road"
"admin"

"country_label"
"state_label"
"water_label"
"place_label"
"rail_station_label"
"poi_label"
"road_label"
"housenum_label"
]

0 comments on commit e3f42e4

Please sign in to comment.