pub struct Tile01Encoder {
pub sort_strategy: Option<SortStrategy>,
}Expand description
Entry-point encoder that converts a TileLayer01 into a StagedLayer01 and
optionally reorders features according to a SortStrategy.
For automatic sort-strategy selection, use Tile01Encoder::encode_auto.
Fields§
§sort_strategy: Option<SortStrategy>How to reorder features before columnar staging. None preserves the
original input order.
Implementations§
Source§impl Tile01Encoder
impl Tile01Encoder
Sourcepub fn encode(&self, data: &mut TileLayer01) -> StagedLayer01
pub fn encode(&self, data: &mut TileLayer01) -> StagedLayer01
Reorder features in data according to the configured sort strategy
(no-op when sort_strategy is None), then convert to StagedLayer01.
Sourcepub fn encode_auto(
source: &TileLayer01,
) -> Result<(EncodedLayer01, StagedLayer01Encoder), MltError>
pub fn encode_auto( source: &TileLayer01, ) -> Result<(EncodedLayer01, StagedLayer01Encoder), MltError>
Automatically select the best sort strategy and stream-level encoders by competitive trialing.
§Algorithm
- Build a candidate set:
[None, Some(Spatial(Morton)), Some(Id)].- When
N >= 512, apply a bounding-box heuristic: if the vertex spread covers more than 80% of the tile extent on both axes, spatial sorting is unlikely to cluster features and is dropped from the candidates.
- When
- For each candidate strategy:
- Clone the source layer.
- Apply
reorder_featuresto the clone. - Convert the clone to
StagedLayer01and run automatic stream-level optimisation on id, geometry, and properties. - Serialise the fully-encoded clone to a scratch buffer and record its byte count.
- Return the trial that produced the smallest byte count.
Trait Implementations§
Source§impl Clone for Tile01Encoder
impl Clone for Tile01Encoder
Source§fn clone(&self) -> Tile01Encoder
fn clone(&self) -> Tile01Encoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Tile01Encoder
impl Debug for Tile01Encoder
Source§impl Default for Tile01Encoder
impl Default for Tile01Encoder
Source§fn default() -> Tile01Encoder
fn default() -> Tile01Encoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Tile01Encoder
impl RefUnwindSafe for Tile01Encoder
impl Send for Tile01Encoder
impl Sync for Tile01Encoder
impl Unpin for Tile01Encoder
impl UnsafeUnpin for Tile01Encoder
impl UnwindSafe for Tile01Encoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more