Skip to main content

GeoLayout

Struct GeoLayout 

Source
pub struct GeoLayout {
    pub name: String,
    pub regions: Vec<GeoRegionLayout>,
    pub transform: Transform2D,
}
Expand description

A map, in pixel space.

Fields§

§name: String

The name of the map.

§regions: Vec<GeoRegionLayout>

The regions of the map, projected into the chart.

§transform: Transform2D

The transform that takes a longitude and a latitude to a point of the chart.

Implementations§

Source§

impl GeoLayout

Inherent implementation of GeoLayout.

Source

pub fn compute(data: &MapData, rect: BBox, aspect_scale: f64) -> Self

Projects a map into a rectangle of the chart.

The projection is the one ECharts uses: the longitude and the latitude are scaled evenly, and the height of the map is shortened by the aspect scale so that a map of the mid-latitudes does not look stretched sideways. The map is centred in the rectangle and takes most of it.

§Arguments
  • &MapData - Shared reference to a MapData.
  • BBox - A BBox parameter.
  • f64 - A 64-bit float (f64).
Source

pub fn region(&self, name: &str) -> Option<&GeoRegionLayout>

Returns the region with the given name.

§Arguments
  • &str - Shared reference to a str.
§Returns
  • Option<&GeoRegionLayout> - Some(...) on success, None otherwise.
Source§

impl GeoLayout

Source

pub fn get_name(&self) -> &String

Source

pub fn get_mut_name(&mut self) -> &mut String

Source

pub fn set_name(&mut self, val: String) -> &mut Self

Source

pub fn get_regions(&self) -> &Vec<GeoRegionLayout>

Source

pub fn get_mut_regions(&mut self) -> &mut Vec<GeoRegionLayout>

Source

pub fn set_regions(&mut self, val: Vec<GeoRegionLayout>) -> &mut Self

Source

pub fn get_transform(&self) -> &Transform2D

Source

pub fn get_mut_transform(&mut self) -> &mut Transform2D

Source

pub fn set_transform(&mut self, val: Transform2D) -> &mut Self

Trait Implementations§

Source§

impl Clone for GeoLayout

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GeoLayout

Source§

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

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

impl PartialEq for GeoLayout

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GeoLayout

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more