Skip to main content

De9im

Struct De9im 

Source
pub struct De9im { /* private fields */ }
Expand description

A DE-9IM (Dimensionally Extended 9-Intersection Model) matrix.

The nine cells are stored in row-major order:

[II, IB, IE,  BI, BB, BE,  EI, EB, EE]

where I = Interior, B = Boundary, E = Exterior, and the first letter refers to geometry a, the second to geometry b.

Implementations§

Source§

impl De9im

Source

pub const II: usize = 0

Interior-Interior

Source

pub const IB: usize = 1

Interior-Boundary

Source

pub const IE: usize = 2

Interior-Exterior

Source

pub const BI: usize = 3

Boundary-Interior

Source

pub const BB: usize = 4

Boundary-Boundary

Source

pub const BE: usize = 5

Boundary-Exterior

Source

pub const EI: usize = 6

Exterior-Interior

Source

pub const EB: usize = 7

Exterior-Boundary

Source

pub const EE: usize = 8

Exterior-Exterior

Source

pub const fn new(cells: [Dimension; 9]) -> Self

Create a matrix from an explicit 9-element array.

Source

pub fn from_str(s: &str) -> Result<Self>

Parse a 9-character DE-9IM string such as "212101212".

Source

pub fn get(&self, index: usize) -> Dimension

Access a single cell by index (0..9).

Source

pub fn set(&mut self, index: usize, dim: Dimension)

Set a single cell by index (0..9).

Source

pub fn to_string_repr(&self) -> String

Return the 9-character string form (e.g. "212101212").

Source

pub fn transpose(&self) -> Self

Return the transposed matrix (swap a <-> b).

Source

pub fn matches(&self, pattern: &str) -> bool

Test whether this matrix matches a 9-character pattern string.

Pattern characters: T (non-empty), F (empty), * (any), 0 (Point), 1 (Line), 2 (Area).

Source

pub fn is_equals(&self) -> bool

OGC Equals: T*F**FFF*

Two geometries are topologically equal when their interiors intersect and no part of either geometry lies in the exterior of the other.

Source

pub fn is_disjoint(&self) -> bool

OGC Disjoint: FF*FF****

Two geometries are disjoint when they share no points in common.

Source

pub fn is_intersects(&self) -> bool

OGC Intersects: NOT Disjoint.

Source

pub fn is_touches(&self) -> bool

OGC Touches: the geometries share boundary but not interior.

Matches FT******* OR F**T***** OR F***T****.

Source

pub fn is_crosses(&self, dim_a: u8, dim_b: u8) -> bool

OGC Crosses (requires the topological dimensions of the two geometries).

  • Point/Line, Point/Area, Line/Area (dim_a < dim_b): pattern T*T******
  • Line/Line (dim_a == dim_b == 1): pattern 0********
  • Polygon/Polygon (dim_a == dim_b == 2): always false (undefined)
Source

pub fn is_within(&self) -> bool

OGC Within: T*F**F***

Geometry a is within geometry b when every point of a lies inside (interior or boundary of) b and the interiors intersect.

Source

pub fn is_contains(&self) -> bool

OGC Contains: T*****FF*

Geometry a contains geometry b when within(b, a) is true.

Source

pub fn is_overlaps(&self, dim_a: u8, dim_b: u8) -> bool

OGC Overlaps (requires the topological dimensions of the two geometries).

  • Point/Point or Area/Area (dim_a == dim_b, both != 1): T*T***T**
  • Line/Line (dim_a == dim_b == 1): 1*T***T**
  • Different dimensions: always false
Source

pub fn is_covers(&self) -> bool

OGC Covers: T*****FF* OR *T****FF* OR ***T**FF* OR ****T*FF*

Geometry a covers geometry b when every point of b is a point of a.

Source

pub fn is_covered_by(&self) -> bool

OGC CoveredBy: T*F**F*** OR *TF**F*** OR **FT*F*** OR **F*TF***

Geometry a is covered by geometry b when every point of a is a point of b.

Trait Implementations§

Source§

impl Clone for De9im

Source§

fn clone(&self) -> De9im

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for De9im

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for De9im

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for De9im

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for De9im

Source§

fn eq(&self, other: &De9im) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for De9im

Source§

impl Eq for De9im

Source§

impl StructuralPartialEq for De9im

Auto Trait Implementations§

§

impl Freeze for De9im

§

impl RefUnwindSafe for De9im

§

impl Send for De9im

§

impl Sync for De9im

§

impl Unpin for De9im

§

impl UnsafeUnpin for De9im

§

impl UnwindSafe for De9im

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.