HexTreeSet

Type Alias HexTreeSet 

Source
pub type HexTreeSet = HexTreeMap<(), SetCompactor>;
Expand description

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


Let’s create a HexTreeSet for Monaco as visualized in the map

use geo::coord;
use hextree::{Cell, HexTreeSet};

// `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));

Aliased Type§

pub struct HexTreeSet { /* private fields */ }

Trait Implementations§

Source§

impl<'a> FromIterator<&'a Cell> for HexTreeSet

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = &'a Cell>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<Cell> for HexTreeSet

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Cell>,

Creates a value from an iterator. Read more