1use std::collections::BTreeMap;
4
5use crate::value::Value;
6
7#[derive(Debug, Clone, Default)]
9pub struct Feature {
10 pub id: Option<Value>,
11 pub properties: BTreeMap<String, Value>,
12 pub geometry_type: Option<String>,
13 pub state: BTreeMap<String, Value>,
15 pub geometry: Vec<Vec<(f64, f64)>>,
18}
19
20#[derive(Debug, Clone, Default)]
24pub struct EvaluationContext {
25 pub zoom: Option<f64>,
26 pub feature: Feature,
27 pub global_state: BTreeMap<String, Value>,
28 pub available_images: Vec<String>,
30 pub canonical: Option<(u32, u32, u32)>,
32 pub heatmap_density: Option<f64>,
34 pub elevation: Option<f64>,
36 pub line_progress: Option<f64>,
38}
39
40impl EvaluationContext {
41 pub fn new() -> EvaluationContext {
42 EvaluationContext::default()
43 }
44
45 pub fn with_zoom(mut self, zoom: f64) -> EvaluationContext {
46 self.zoom = Some(zoom);
47 self
48 }
49
50 pub fn with_feature(mut self, feature: Feature) -> EvaluationContext {
51 self.feature = feature;
52 self
53 }
54
55 pub fn with_global_state(mut self, state: BTreeMap<String, Value>) -> EvaluationContext {
56 self.global_state = state;
57 self
58 }
59}