diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-06-04 10:58:11 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-06-04 10:58:11 +0200 |
commit | 580527a16c22fe41df8368492193980acc979b5a (patch) | |
tree | 4d43c243428b037d738dd8b24156c063823c521f | |
parent | ef76be64a2e176ce7b985b3666eca1d8ec02b105 (diff) | |
download | qtlocation-mapboxgl-580527a16c22fe41df8368492193980acc979b5a.tar.gz |
use token replacement for icon property as well
fixes #300
-rw-r--r-- | bin/style.js | 12 | ||||
-rw-r--r-- | src/renderer/icon_bucket.cpp | 13 |
2 files changed, 10 insertions, 15 deletions
diff --git a/bin/style.js b/bin/style.js index 4157e1e8fe..ca42214ba0 100644 --- a/bin/style.js +++ b/bin/style.js @@ -917,7 +917,7 @@ module.exports = { "poi": { "source": "outdoors", "layer": "poi_label", - "icon": "maki", + "icon": "{{maki}}", "field": "scalerank", "value": [1, 2], "size": 12, @@ -926,7 +926,7 @@ module.exports = { "poi_3": { "source": "outdoors", "layer": "poi_label", - "icon": "maki", + "icon": "{{maki}}", "field": "scalerank", "value": 3, "size": 12, @@ -935,7 +935,7 @@ module.exports = { "poi_4_4": { "source": "outdoors", "layer": "poi_label", - "icon": "maki", + "icon": "{{maki}}", "filter": [ "and", { "field": "scalerank", "value": 4 }, @@ -947,7 +947,7 @@ module.exports = { "poi_4_16": { "source": "outdoors", "layer": "poi_label", - "icon": "maki", + "icon": "{{maki}}", "filter": [ "and", { "field": "scalerank", "value": 4 }, @@ -960,7 +960,7 @@ module.exports = { "poi_4_all": { "source": "outdoors", "layer": "poi_label", - "icon": "maki", + "icon": "{{maki}}", "field": "scalerank", "value": 4, "size": 12, @@ -969,7 +969,7 @@ module.exports = { "poi_aerodrome": { "source": "outdoors", "layer": "poi_label", - "icon": "maki", + "icon": "{{maki}}", "field": "maki", "value": "airport", "size": 24, diff --git a/src/renderer/icon_bucket.cpp b/src/renderer/icon_bucket.cpp index 11999a6089..fd43f69514 100644 --- a/src/renderer/icon_bucket.cpp +++ b/src/renderer/icon_bucket.cpp @@ -10,6 +10,7 @@ #include <llmr/platform/gl.hpp> #include <llmr/util/constants.hpp> +#include <llmr/util/token.hpp> #include <cassert> @@ -28,16 +29,10 @@ void IconBucket::addFeature(const VectorTileFeature &feature, SpriteAtlas &sprit std::string field; if (geometry.field.size()) { - auto field_it = feature.properties.find(geometry.field); - if (field_it == feature.properties.end()) { - if (debug::tileParseWarnings) { - fprintf(stderr, "[WARNING] feature doesn't contain field '%s'\n", geometry.field.c_str()); - } - return; - } + field = util::replaceTokens(geometry.field, feature.properties); + } - field = toString(field_it->second); - } else { + if (!field.size()) { field = "<circle>"; } |