|
| 1 | +using MapboxMaui.Expressions; |
| 2 | + |
| 3 | +namespace MapboxMaui.Annotations; |
| 4 | + |
| 5 | +public class ClusterOptions |
| 6 | +{ |
| 7 | + /// The circle radius of the cluster items, 18 by default. Units in pixels. |
| 8 | + public PropertyValue<double> CircleRadius { get; set; } |
| 9 | + |
| 10 | + /// The circle color, black by default. |
| 11 | + public PropertyValue<Color> CircleColor { get; set; } |
| 12 | + |
| 13 | + /// The text color of cluster item, white by default |
| 14 | + public PropertyValue<Color> TextColor { get; set; } |
| 15 | + |
| 16 | + /// The text size of cluster item, 12 by default. Units in pixels. |
| 17 | + public PropertyValue<double> TextSize { get; set; } |
| 18 | + |
| 19 | + /// Value to use for a text label of the cluster. `get("point_count")` by default which |
| 20 | + /// will show the count of points in the cluster |
| 21 | + public PropertyValue<string> TextField { get; set; } |
| 22 | + |
| 23 | + /// Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal |
| 24 | + /// to the width of a tile, 50 by default. Value must be greater than or equal to 0. |
| 25 | + public double ClusterRadius { get; set; } |
| 26 | + |
| 27 | + /// Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less |
| 28 | + /// than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom |
| 29 | + /// levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15. |
| 30 | + public double ClusterMaxZoom { get; set; } |
| 31 | + |
| 32 | + /// An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from |
| 33 | + /// clustered points. Has the form `{"property_name": [operator, map_expression]}`. |
| 34 | + /// `operator` is any expression function that accepts at |
| 35 | + /// least 2 operands (e.g. `"+"` or `"max"`) — it accumulates the property value from clusters/points the |
| 36 | + /// cluster contains; `map_expression` produces the value of a single point. Example: |
| 37 | + /// |
| 38 | + /// ``Expression`` syntax: |
| 39 | + /// ``` |
| 40 | + /// let expression = Exp(.sum) { |
| 41 | + /// Exp(.get) { "scalerank" } |
| 42 | + /// } |
| 43 | + /// clusterProperties: ["sum": expression] |
| 44 | + /// ``` |
| 45 | + /// |
| 46 | + /// JSON syntax: |
| 47 | + /// `{"sum": ["+", ["get", "scalerank"]]}` |
| 48 | + /// |
| 49 | + /// For more advanced use cases, in place of `operator`, you can use a custom reduce expression that references a special `["accumulated"]` value. Example: |
| 50 | + /// |
| 51 | + /// ``Expression`` syntax: |
| 52 | + /// ``` |
| 53 | + /// let expression = Exp { |
| 54 | + /// Exp(.sum) { |
| 55 | + /// Exp(.accumulated) |
| 56 | + /// Exp(.get) { "sum" } |
| 57 | + /// } |
| 58 | + /// Exp(.get) { "scalerank" } |
| 59 | + /// } |
| 60 | + /// clusterProperties: ["sum": expression] |
| 61 | + /// ``` |
| 62 | + /// |
| 63 | + /// JSON syntax: |
| 64 | + /// `{"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}` |
| 65 | + public IDictionary<string, DslExpression> ClusterProperties { get; set; } |
| 66 | +} |
| 67 | + |
0 commit comments