supercluster_rs/
options.rs1#[derive(Debug, Clone, Copy)]
3pub struct SuperclusterOptions {
4 pub min_zoom: usize,
8
9 pub max_zoom: usize,
13
14 pub min_points: usize,
18
19 pub radius: f64,
23
24 pub extent: f64,
28
29 pub node_size: usize,
33}
34
35impl SuperclusterOptions {
36 pub fn new() -> Self {
37 Default::default()
38 }
39
40 pub fn with_min_zoom(self, min_zoom: usize) -> Self {
41 SuperclusterOptions { min_zoom, ..self }
42 }
43 pub fn with_max_zoom(self, max_zoom: usize) -> Self {
44 SuperclusterOptions { max_zoom, ..self }
45 }
46 pub fn with_min_points(self, min_points: usize) -> Self {
47 SuperclusterOptions { min_points, ..self }
48 }
49 pub fn with_radius(self, radius: f64) -> Self {
50 SuperclusterOptions { radius, ..self }
51 }
52 pub fn with_extent(self, extent: f64) -> Self {
53 SuperclusterOptions { extent, ..self }
54 }
55 pub fn with_node_size(self, node_size: usize) -> Self {
56 SuperclusterOptions { node_size, ..self }
57 }
58}
59
60impl Default for SuperclusterOptions {
61 fn default() -> Self {
62 Self {
63 min_zoom: 0,
64 max_zoom: 16,
65 min_points: 2,
66 radius: 40.0,
67 extent: 512.0,
68 node_size: 64,
69 }
70 }
71}