Permalink
Browse files

πŸƒ optimizing draw order based on zoom level

  • Loading branch information...
rastapasta committed Nov 9, 2016
1 parent d10ed91 commit e3f42e46c9e9ee6cf0a0e518668a6eecaee31a42
Showing with 33 additions and 915 deletions.
  1. +0 βˆ’2 src/BrailleBuffer.coffee
  2. +30 βˆ’43 src/Renderer.coffee
  3. +0 βˆ’867 styles/basic.json
  4. +3 βˆ’3 styles/dark.json
View
@@ -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]
View
@@ -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"
]
Oops, something went wrong.

0 comments on commit e3f42e4

Please sign in to comment.