@@ -23,7 +23,12 @@ pub struct VectorTileStyle {
2323
2424impl VectorTileStyle {
2525 /// Get a rule for the given feature.
26- pub fn get_style_rule ( & self , layer_name : & str , resolution_level : f64 , feature : & MvtFeature ) -> Option < & StyleRule > {
26+ pub fn get_style_rule (
27+ & self ,
28+ layer_name : & str ,
29+ resolution : f64 ,
30+ feature : & MvtFeature ,
31+ ) -> Option < & StyleRule > {
2732 self . rules . iter ( ) . find ( |& rule| {
2833 let correct_geometry_type = match feature. geometry {
2934 MvtGeometry :: Point ( _)
@@ -50,10 +55,10 @@ impl VectorTileStyle {
5055 if rule. layer_name . as_ref ( ) . is_some_and ( |v| v != layer_name) {
5156 return false ;
5257 }
53- if rule. max_resolution . is_some_and ( |v| v < resolution_level ) {
58+ if rule. max_resolution . is_some_and ( |v| v < resolution ) {
5459 return false ;
5560 }
56- if rule. min_resolution . is_some_and ( |v| v > resolution_level ) {
61+ if rule. min_resolution . is_some_and ( |v| v > resolution ) {
5762 return false ;
5863 }
5964
@@ -108,9 +113,9 @@ fn compare_numeric(a: &galileo_mvt::MvtValue, b: &str, cmp: impl Fn(f64, f64) ->
108113pub struct StyleRule {
109114 /// If set, a feature must belong to the set layer. If not set, layer is not checked.
110115 pub layer_name : Option < String > ,
111- /// Determins the maximum resolution
116+ /// If set, the rule will only be applied at resolutions lower than this value.
112117 pub max_resolution : Option < f64 > ,
113- /// Determins the minimum resolution
118+ /// If set, the rule will only be applied at resolutions higher than this value.
114119 pub min_resolution : Option < f64 > ,
115120 /// Specifies a set of attributes of a feature that must have the given values for this rule to be applied.
116121 #[ serde( default ) ]
@@ -341,8 +346,8 @@ mod tests {
341346 fn serialize_with_bincode ( ) {
342347 let rule = StyleRule {
343348 layer_name : None ,
344- min_resolution : None ,
345- max_resolution : None ,
349+ min_resolution : None ,
350+ max_resolution : None ,
346351 properties : vec ! [ ] ,
347352 symbol : VectorTileSymbol :: None ,
348353 } ;
0 commit comments