1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use crate::;
use FromIterator;
/// A HexTreeSet is a structure for representing geographical regions
/// and efficiently testing performing hit-tests on that region. Or,
/// in other words: I have a region defined; does it contain this
/// point on earth?
///
///
/// # Usage
///
/// <iframe src="https://kepler.gl/demo?mapUrl=https://gist.githubusercontent.com/JayKickliter/8f91a8437b7dd89321b22cde50e71c3a/raw/a60c83cb15e75aba660fb6535d8e0061fa504205/monaco.kepler.json" width="100%" height="600"></iframe>
///
/// ----
///
/// Let's create a HexTreeSet for Monaco as visualized in the map
///
/// ```
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use geo::coord;
/// use hextree::{Cell, HexTreeSet};
/// #
/// # use byteorder::{LittleEndian as LE, ReadBytesExt};
/// # let idx_bytes = include_bytes!("../assets//monaco.res12.h3idx");
/// # let rdr = &mut idx_bytes.as_slice();
/// # let mut cells = Vec::new();
/// # while let Ok(idx) = rdr.read_u64::<LE>() {
/// # cells.push(Cell::from_raw(idx)?);
/// # }
///
/// // `cells` is a slice of `Index`s
/// let monaco: HexTreeSet = cells.iter().collect();
///
/// // You can see in the map above that our set covers Point 1 (green
/// // check) but not Point 2 (red x), let's test that.
/// // Lat/lon 43.73631, 7.42418 @ res 12
/// let point_1 = Cell::from_raw(0x8c3969a41da15ff)?;
/// // Lat/lon 43.73008, 7.42855 @ res 12
/// let point_2 = Cell::from_raw(0x8c3969a415065ff)?;
///
/// assert!(monaco.contains(point_1));
/// assert!(!monaco.contains(point_2));
///
/// # Ok(())
/// # }
/// ```
pub type HexTreeSet = ;