Browse Source

Twig function evaluate()

master
parent
commit
63b20e5c9f
  1. 2
      src/CategoryOverpass.js
  2. 16
      src/twigFunctions.js

2
src/CategoryOverpass.js

@ -207,7 +207,9 @@ CategoryOverpass.prototype.open = function () {
this.domInfo.classList.add('info')
var template = OverpassLayer.twig.twig({ data: this.data.info, autoescape: true })
global.currentCategory = this
this.domInfo.innerHTML = template.render(this.data)
global.currentCategory = null
}
}

16
src/twigFunctions.js

@ -44,3 +44,19 @@ OverpassLayer.twig.extendFunction('colorInterpolate', function (map, value) {
var colormap = colorInterpolate(map)
return colormap(value)
})
OverpassLayer.twig.extendFunction('evaluate', function (tags) {
var ob = {
id: 'x0',
isShown: true,
layer_id: global.currentCategory.id,
object: {
id: 'x0',
meta: {},
tags: tags,
type: 'special'
}
}
var d = global.currentCategory.layer.evaluate(ob)
return d
})
Loading…
Cancel
Save