core: Update Hillshade Algorithms and add Color-Relief Layer support (#3965)

This commit is contained in:
Andrew Calcutt
2026-02-25 20:50:06 -05:00
committed by GitHub
parent 9682e09ae4
commit 369af13ead
187 changed files with 8804 additions and 2352 deletions

View File

@@ -53,6 +53,10 @@ function expressionType(property) {
case 'number':
case 'enum':
return 'NumberType';
case 'numberArray':
return 'Array<NumberType>';
case 'colorArray':
return 'Array<ColorType>';
case 'image':
return 'ImageType';
case 'string':
@@ -104,6 +108,10 @@ function evaluatedType(property) {
return 'Rotation';
}
return /location$/.test(property.name) ? 'double' : 'float';
case 'numberArray':
return 'std::vector<float>';
case 'colorArray':
return 'std::vector<Color>';
case 'resolvedImage':
return 'expression::Image';
case 'formatted':
@@ -210,7 +218,7 @@ function propertyValueType(property) {
* @returns {string}
*/
function formatNumber(property, num = 0) {
if (evaluatedType(property) === "float") {
if (evaluatedType(property) === "float" || property.type === "number") {
const str = num.toString();
return str + (str.includes(".") ? "" : ".") + "f";
}
@@ -237,6 +245,23 @@ function defaultValue(property) {
switch (property.type) {
case 'number':
return formatNumber(property, property.default);
case 'numberArray':
// Default is a single number, wrap it in a vector
return `{${formatNumber({type: 'number'}, property.default)}}`;
case 'colorArray':
// Default is a single color string, parse it and wrap in a vector
const colorArray = parseCSSColor(property.default);
const colorStr = colorArray.join(', ');
switch (colorStr) {
case '0, 0, 0, 0':
return '{{}}';
case '0, 0, 0, 1':
return '{Color::black()}';
case '1, 1, 1, 1':
return '{Color::white()}';
default:
return `{{Color{${colorStr}}}}`;
}
case 'formatted':
case 'string':
case 'resolvedImage':

File diff suppressed because it is too large Load Diff