[−][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<u8>
.
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()?;
Implementations
impl Tile
[src]
pub fn new(extent: u32) -> Self
[src]
Create a new tile.
extent
Height / width of tile bounds.
pub fn extent(&self) -> u32
[src]
Get extent, or height / width of tile bounds.
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.
pub fn compute_size(&self) -> usize
[src]
Compute the encoded size in bytes.
Auto Trait Implementations
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,