summaryrefslogtreecommitdiff
path: root/scripts/generate-style-code.js
diff options
context:
space:
mode:
authorLauren Budorick <lauren@mapbox.com>2018-05-08 16:26:19 -0700
committerLauren Budorick <lauren@mapbox.com>2018-05-08 16:26:19 -0700
commit79b276882e86d9f45ebfd87e993502b88cb594d5 (patch)
tree99f08b42c89013a23ea823aafe3a6d0321626dfd /scripts/generate-style-code.js
parent5f27a90d0b5adc5b71d272064a10bf1d89b5dc68 (diff)
downloadqtlocation-mapboxgl-upstream/lbud-expression-spec.tar.gz
Remove some isDataDriven uses/definitionsupstream/lbud-expression-spec
Diffstat (limited to 'scripts/generate-style-code.js')
-rwxr-xr-xscripts/generate-style-code.js42
1 files changed, 22 insertions, 20 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js
index 7fdaac20a9..0059863e05 100755
--- a/scripts/generate-style-code.js
+++ b/scripts/generate-style-code.js
@@ -15,10 +15,6 @@ function parseCSSColor(str) {
];
}
-global.isDataDriven = function (property) {
- return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven';
-};
-
global.isLightProperty = function (property) {
return property['light-property'] === true;
};
@@ -77,30 +73,36 @@ function attributeUniformType(property, type) {
}
global.layoutPropertyType = function (property) {
- if (isDataDriven(property)) {
- return `DataDrivenLayoutProperty<${evaluatedType(property)}>`;
- } else {
- return `LayoutProperty<${evaluatedType(property)}>`;
+ switch (property['property-type']) {
+ case 'data-driven':
+ case 'cross-faded-data-driven':
+ return `DataDrivenLayoutProperty<${evaluatedType(property)}>`;
+ default:
+ return `LayoutProperty<${evaluatedType(property)}>`;
}
};
global.paintPropertyType = function (property, type) {
- if (isDataDriven(property)) {
- return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeUniformType(property, type)}>`;
- } else if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') {
- return `CrossFadedPaintProperty<${evaluatedType(property)}>`;
- } else {
- return `PaintProperty<${evaluatedType(property)}>`;
+ switch (property['property-type']) {
+ case 'data-driven':
+ case 'cross-faded-data-driven':
+ return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeUniformType(property, type)}>`;
+ case 'cross-faded':
+ return `CrossFadedPaintProperty<${evaluatedType(property)}>`;
+ default:
+ return `PaintProperty<${evaluatedType(property)}>`;
}
};
global.propertyValueType = function (property) {
- if (isDataDriven(property)) {
- return `DataDrivenPropertyValue<${evaluatedType(property)}>`;
- } else if (property.name === 'heatmap-color') {
- return `HeatmapColorPropertyValue`;
- } else {
- return `PropertyValue<${evaluatedType(property)}>`;
+ switch (property['property-type']) {
+ case 'data-driven':
+ case 'cross-faded-data-driven':
+ return `DataDrivenPropertyValue<${evaluatedType(property)}>`;
+ case 'color-ramp':
+ return `HeatmapColorPropertyValue`;
+ default:
+ return `PropertyValue<${evaluatedType(property)}>`;
}
};