Struct h3ron::H3DirectedEdge
source · #[repr(transparent)]pub struct H3DirectedEdge(_);
Expand description
H3 Index representing an directed H3 edge
Implementations§
source§impl H3DirectedEdge
impl H3DirectedEdge
sourcepub fn from_cells(
origin_cell: H3Cell,
destination_cell: H3Cell
) -> Result<Self, Error>
pub fn from_cells(
origin_cell: H3Cell,
destination_cell: H3Cell
) -> Result<Self, Error>
Gets the unidirectional edge from origin_cell
to destination_cell
pub fn is_edge_valid(&self) -> bool
sourcepub fn edge_length_avg_km(resolution: u8) -> Result<f64, Error>
pub fn edge_length_avg_km(resolution: u8) -> Result<f64, Error>
Gets the average length of an edge in kilometers at resolution
.
This is the length of the cell boundary segment represented by the edge.
sourcepub fn edge_length_avg_m(resolution: u8) -> Result<f64, Error>
pub fn edge_length_avg_m(resolution: u8) -> Result<f64, Error>
Gets the average length of an edge in meters at resolution
.
This is the length of the cell boundary segment represented by the edge.
sourcepub fn cell_centroid_distance_avg_m_at_resolution(
resolution: u8
) -> Result<f64, Error>
pub fn cell_centroid_distance_avg_m_at_resolution(
resolution: u8
) -> Result<f64, Error>
The approximate distance between the centroids of two neighboring cells
at the given resolution
.
Based on the approximate edge length. See H3DirectedEdge::cell_centroid_distance_m
for a
more exact variant of this function.
sourcepub fn cell_centroid_distance_m(&self) -> Result<f64, Error>
pub fn cell_centroid_distance_m(&self) -> Result<f64, Error>
The approximate distance between the centroids of two neighboring cells
at the given resolution
.
Based on the exact edge length. See H3DirectedEdge::cell_centroid_distance_avg_m_at_resolution
for a resolution based variant.
sourcepub fn destination_cell(&self) -> Result<H3Cell, Error>
pub fn destination_cell(&self) -> Result<H3Cell, Error>
sourcepub fn origin_cell(&self) -> Result<H3Cell, Error>
pub fn origin_cell(&self) -> Result<H3Cell, Error>
sourcepub fn cells(&self) -> Result<H3EdgeCells, Error>
pub fn cells(&self) -> Result<H3EdgeCells, Error>
Retrieves a H3EdgeCells
of the origin and destination cell of the
edge.
Returns
If the built indexes are invalid, returns an Error.
sourcepub fn reversed(&self) -> Result<Self, Error>
pub fn reversed(&self) -> Result<Self, Error>
Retrieves the corresponding edge in the reversed direction.
Returns
If the built edge is invalid, returns an Error.
sourcepub fn boundary_linestring(&self) -> Result<LineString<f64>, Error>
pub fn boundary_linestring(&self) -> Result<LineString<f64>, Error>
Retrieves the LineString
which forms the boundary between
two cells.
sourcepub fn length_m(&self) -> Result<f64, Error>
pub fn length_m(&self) -> Result<f64, Error>
Retrieves the exact length of self
in meters
This is the length of the cell boundary segment represented by the edge.
sourcepub fn length_km(&self) -> Result<f64, Error>
pub fn length_km(&self) -> Result<f64, Error>
Retrieves the exact length of self
in kilometers
This is the length of the cell boundary segment represented by the edge.
sourcepub fn length_rads(&self) -> Result<f64, Error>
pub fn length_rads(&self) -> Result<f64, Error>
Retrieves the exact length of self
in radians
This is the length of the cell boundary segment represented by the edge.
Trait Implementations§
source§impl Clone for H3DirectedEdge
impl Clone for H3DirectedEdge
source§fn clone(&self) -> H3DirectedEdge
fn clone(&self) -> H3DirectedEdge
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for H3DirectedEdge
impl Debug for H3DirectedEdge
source§impl Deref for H3DirectedEdge
impl Deref for H3DirectedEdge
source§impl<'de> Deserialize<'de> for H3DirectedEdge
impl<'de> Deserialize<'de> for H3DirectedEdge
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl FromH3Index for H3DirectedEdge
impl FromH3Index for H3DirectedEdge
fn from_h3index(h3index: H3Index) -> Self
source§impl FromStr for H3DirectedEdge
impl FromStr for H3DirectedEdge
source§impl Hash for H3DirectedEdge
impl Hash for H3DirectedEdge
source§impl Index for H3DirectedEdge
impl Index for H3DirectedEdge
source§fn resolution(&self) -> u8
fn resolution(&self) -> u8
source§fn direction(&self) -> H3Direction
fn direction(&self) -> H3Direction
source§fn direction_checked(&self) -> Result<H3Direction, Error>
fn direction_checked(&self) -> Result<H3Direction, Error>
source§fn direction_to_parent_resolution(
&self,
target_resolution: u8
) -> Result<H3Direction, Error>
fn direction_to_parent_resolution(
&self,
target_resolution: u8
) -> Result<H3Direction, Error>
target_resolution
source§impl Ord for H3DirectedEdge
impl Ord for H3DirectedEdge
source§fn cmp(&self, other: &H3DirectedEdge) -> Ordering
fn cmp(&self, other: &H3DirectedEdge) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<H3DirectedEdge> for H3DirectedEdge
impl PartialEq<H3DirectedEdge> for H3DirectedEdge
source§fn eq(&self, other: &H3DirectedEdge) -> bool
fn eq(&self, other: &H3DirectedEdge) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<H3DirectedEdge> for H3DirectedEdge
impl PartialOrd<H3DirectedEdge> for H3DirectedEdge
source§fn partial_cmp(&self, other: &H3DirectedEdge) -> Option<Ordering>
fn partial_cmp(&self, other: &H3DirectedEdge) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for H3DirectedEdge
impl Serialize for H3DirectedEdge
source§impl ToLine for H3DirectedEdge
impl ToLine for H3DirectedEdge
source§fn to_line(&self) -> Result<Line<f64>, Self::Error>
fn to_line(&self) -> Result<Line<f64>, Self::Error>
Create a line geometry from the origin index to the destination index
use h3ron::{H3DirectedEdge, Index};
use h3ron::to_geo::{ToLine, ToCoordinate};
let edge = H3DirectedEdge::new(0x149283080ddbffff);
let l = edge.to_line().unwrap();
assert_eq!(l.start, edge.origin_cell().unwrap().to_coordinate().unwrap());
assert_eq!(l.end, edge.destination_cell().unwrap().to_coordinate().unwrap());
type Error = Error
source§impl ToLineString for H3DirectedEdge
impl ToLineString for H3DirectedEdge
source§fn to_linestring(&self) -> Result<LineString<f64>, Self::Error>
fn to_linestring(&self) -> Result<LineString<f64>, Self::Error>
Create a linestring from the origin index to the destination index
use h3ron::{H3DirectedEdge, Index};
use h3ron::to_geo::{ToLineString, ToCoordinate};
let edge = H3DirectedEdge::new(0x149283080ddbffff);
let ls = edge.to_linestring().unwrap();
assert_eq!(ls.0.len(), 2);
assert_eq!(ls.0[0], edge.origin_cell().unwrap().to_coordinate().unwrap());
assert_eq!(ls.0[1], edge.destination_cell().unwrap().to_coordinate().unwrap());
type Error = Error
source§impl ToString for H3DirectedEdge
impl ToString for H3DirectedEdge
source§impl TryFrom<u64> for H3DirectedEdge
impl TryFrom<u64> for H3DirectedEdge
convert to index including validation
impl Copy for H3DirectedEdge
impl Eq for H3DirectedEdge
impl StructuralEq for H3DirectedEdge
impl StructuralPartialEq for H3DirectedEdge
Auto Trait Implementations§
impl RefUnwindSafe for H3DirectedEdge
impl Send for H3DirectedEdge
impl Sync for H3DirectedEdge
impl Unpin for H3DirectedEdge
impl UnwindSafe for H3DirectedEdge
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.