[−][src]Struct mvt::Tile
A tile represents a rectangular region of a map.
Each tile can contain any number of layers.
When all layers have been added to the tile, it can be
written out or
converted to a Vec
Example
use mvt::Tile; let mut tile = Tile::new(4096); let layer = tile.create_layer("First Layer"); // ... // set up the layer // ... tile.add_layer(layer)?; // ... // add more layers // ... let data = tile.to_bytes()?;
Methods
impl Tile
[src]
impl Tile
pub fn new(extent: u32) -> Self | [src] |
Create a new tile.
extent
Size in screen coördinates.
pub fn extent(&self) -> u32 | [src] |
Get extent in screen coördinates.
pub fn num_layers(&self) -> usize | [src] |
Get the number of layers.
pub fn create_layer(&self, name: &str) -> Layer | [src] |
Create a new layer.
name
Layer name.
pub fn add_layer(&mut self, layer: Layer) -> Result<(), Error> | [src] |
Add a layer.
layer
The layer.
Returns an error if:
- a layer with the same name already exists
- the layer extent does not match the tile extent
pub fn write_to(&self, out: &mut dyn Write) -> Result<(), Error> | [src] |
Write the tile.
out
Writer to output the tile.
pub fn to_bytes(&self) -> Result<Vec<u8>, Error> | [src] |
Encode the tile and return the bytes.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |