Skip to content

Commit 75c0477

Browse files
committed
feat: Convert MP case expressions to Select
1 parent 86f670e commit 75c0477

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

galileo-maplibre/src/layer/vector_tile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn fill_rule(fill: &FillLayer, tile_schema: &TileSchema) -> Option<StyleRule> {
237237

238238
if !fill.paint.fill_antialias {
239239
log::debug!(
240-
"{} not-antialised polygons are not supported yet",
240+
"{} not-antialiased polygons are not supported yet",
241241
crate::layer::UNSUPPORTED,
242242
);
243243
}

galileo-maplibre/src/style/expression.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,9 @@ impl MlExpr {
751751

752752
Some(Expr::Get(property_name.clone()))
753753
} else {
754-
log::debug!("{UNSUPPORTED} Expected '{prop:?}' to be a property name");
755-
None
754+
// If LHS of an expression is not a string literal, it should be some kind of
755+
// expression
756+
prop.to_galileo_expr()
756757
}
757758
}
758759

@@ -912,6 +913,18 @@ impl MlExpr {
912913
fallback: default_output.to_galileo_expr()?,
913914
}))
914915
}
916+
MlExpr::Case { branches, fallback } => Expr::Select(Box::new(SelectExpr {
917+
cases: branches
918+
.iter()
919+
.map(|(condition, out)| {
920+
Some(SelectCase {
921+
condition: condition.to_galileo_expr()?,
922+
out: out.to_galileo_expr()?,
923+
})
924+
})
925+
.collect::<Option<Vec<_>>>()?,
926+
fallback: fallback.to_galileo_expr()?,
927+
})),
915928
_ => {
916929
log::debug!("{UNSUPPORTED} Expression {self:?} is not supported yet");
917930
return None;

0 commit comments

Comments
 (0)