diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-10 21:17:58 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-13 17:22:05 -0700 |
commit | 3f5ea169f5d617455b21467fbd12a812c6aa2972 (patch) | |
tree | 63163d4ba45f7a88b6c7bb6cc681d9eda16ec868 /scripts/generate-style-code.js | |
parent | 6cc2f8a3a52d0c375458c7da4fe51e8160e38a88 (diff) | |
download | qtlocation-mapboxgl-3f5ea169f5d617455b21467fbd12a812c6aa2972.tar.gz |
[node] Partial implementation of runtime styling API for node bindings
Diffstat (limited to 'scripts/generate-style-code.js')
-rw-r--r-- | scripts/generate-style-code.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 21654117b8..6469cf55fd 100644 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -81,7 +81,7 @@ const layerCpp = ejs.compile(fs.readFileSync('src/mbgl/style/layers/layer.cpp.ej const propertiesHpp = ejs.compile(fs.readFileSync('src/mbgl/style/layers/layer_properties.hpp.ejs', 'utf8'), {strict: true}); const propertiesCpp = ejs.compile(fs.readFileSync('src/mbgl/style/layers/layer_properties.cpp.ejs', 'utf8'), {strict: true}); -for (const type of spec.layer.type.values) { +const layers = spec.layer.type.values.map((type) => { const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => { if (name !== 'visibility') { spec[`layout_${type}`][name].name = name; @@ -96,15 +96,20 @@ for (const type of spec.layer.type.values) { return memo; }, []); - const layer = { + return { type: type, layoutProperties: layoutProperties, paintProperties: paintProperties, }; +}); - fs.writeFileSync(`include/mbgl/style/layers/${type}_layer.hpp`, layerHpp(layer)); - fs.writeFileSync(`src/mbgl/style/layers/${type}_layer.cpp`, layerCpp(layer)); +for (const layer of layers) { + fs.writeFileSync(`include/mbgl/style/layers/${layer.type}_layer.hpp`, layerHpp(layer)); + fs.writeFileSync(`src/mbgl/style/layers/${layer.type}_layer.cpp`, layerCpp(layer)); - fs.writeFileSync(`src/mbgl/style/layers/${type}_layer_properties.hpp`, propertiesHpp(layer)); - fs.writeFileSync(`src/mbgl/style/layers/${type}_layer_properties.cpp`, propertiesCpp(layer)); + fs.writeFileSync(`src/mbgl/style/layers/${layer.type}_layer_properties.hpp`, propertiesHpp(layer)); + fs.writeFileSync(`src/mbgl/style/layers/${layer.type}_layer_properties.cpp`, propertiesCpp(layer)); } + +const nodeStyleCpp = ejs.compile(fs.readFileSync('platform/node/src/node_style_properties.hpp.ejs', 'utf8'), {strict: true}); +fs.writeFileSync('platform/node/src/node_style_properties.hpp', nodeStyleCpp({layers: layers})); |