Enum Area

Source
pub enum Area {}
Expand description

An area, as the name suggests, is some mapped area with tags.

§Way or Relation?

An “area” is actually not a type of object defined by osm. It is more like a meta object. In osm an “area” is ether a single way or a relation of ways with appropriated tags.

Use is_from_way to check what a given area is actually saved as and original_id to get the underlying object’s is.

§Multipolygon

A multipolygon consists of multiple polygons named “outer rings” which contain “inner rings”. These are polygons as well, which are “cut out” from their outer ring. Use outer_rings and inner_rings to access the area’s rings.

Each ring i.e. polygon is just a list of points.

While the general shape of an area is a multipolygon, most areas are just a single outer ring without any inner ones. For example most residential buildings are just a single polygon. Use is_multipolygon and num_rings to check an area’s shape.

Implementations§

Source§

impl Area

Source

pub fn is_from_way(&self) -> bool

Was this area created from a way? (In contrast to areas created from a relation and their members.)

Source

pub fn original_id(&self) -> i64

Return the Id of the way or relation this area was created from.

Source

pub fn num_rings(&self) -> (usize, usize)

Count the number of outer and inner rings of this area.

Source

pub fn is_multipolygon(&self) -> bool

Check whether this area is a multipolygon, ie. whether it has more than one outer ring.

Source

pub fn outer_rings(&self) -> impl Iterator<Item = &OuterRing>

Return an iterator over all outer rings.

Source

pub fn inner_rings<'a>( &'a self, outer: &'a OuterRing, ) -> impl Iterator<Item = &'a InnerRing> + 'a

Return an iterator over all inner rings in the given outer ring.

Methods from Deref<Target = OSMObject>§

Source

pub fn id(&self) -> i64

Get ID of this object.

Source

pub fn positive_id(&self) -> u64

Get absolute value of the ID of this object.

Source

pub fn deleted(&self) -> bool

Is this object marked as deleted?

Source

pub fn visible(&self) -> bool

Is this object marked visible (ie not deleted)?

Source

pub fn version(&self) -> u32

Get version of this object.

Source

pub fn uid(&self) -> u32

Get user id of this object.

Source

pub fn user_is_anonymous(&self) -> bool

Is this user anonymous?

Source

pub fn timestamp(&self) -> u32

Get timestamp when this object last changed.

Source

pub fn user(&self) -> &CStr

Get user name for this object.

Source

pub fn tags(&self) -> &TagList

Get the list of tags for this object.

Trait Implementations§

Source§

impl AsMut<Item> for Area

Source§

fn as_mut(&mut self) -> &mut Item

Cast to an [$crate :: item :: Item] reference

Source§

impl AsMut<OSMObject> for Area

Source§

fn as_mut(&mut self) -> &mut OSMObject

Cast to an [$crate :: object :: OSMObject] reference

Source§

impl AsRef<Item> for Area

Source§

fn as_ref(&self) -> &Item

Cast to an [$crate :: item :: Item] reference

Source§

impl AsRef<OSMObject> for Area

Source§

fn as_ref(&self) -> &OSMObject

Cast to an [$crate :: object :: OSMObject] reference

Source§

impl Deref for Area

Source§

fn deref(&self) -> &Self::Target

Cast to an [$crate :: object :: OSMObject] reference

Source§

type Target = OSMObject

The resulting type after dereferencing.
Source§

impl DerefMut for Area

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Cast to an [$crate :: object :: OSMObject] reference

Auto Trait Implementations§

§

impl Freeze for Area

§

impl RefUnwindSafe for Area

§

impl Send for Area

§

impl Sync for Area

§

impl Unpin for Area

§

impl UnwindSafe for Area

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.