com.pb.lisdk.vectortile

## Interface IVectorTileWriter

All Known Implementing Classes:
  MVTWriter

    public interface IVectorTileWriter

An IVectorTileWriter is used to construct map tiles made of vector features. Each tile can have one or more named layers and each layer can have one or more vector features. A writer is typically in one of three states - `initial`, `writing tile`, or `writing layer`. All method invocations require the writer to be in a particular state in order to be successful. The state transitions can be seen in the diagram below:

To start writing a tile, call `startTile()`. It takes an envelope as a parameter to indicate to the writer what geographic region the generated tile is for. The way the coordinate system is interpreted by the underlying writer is implementation dependent, but in general, subsequently added features are typically within that region. Once a tile is started, `startLayer()` has to be called with a unique layer name. After starting a layer, one or more features can be added with the `addFeature()` method. At this point it is possible to continue adding features, or add new layers, following the state constraints outlined above. In order to complete the tile writing process, `endTile()` has to be invoked. Note that this can only be done after completing any previously started layers with `endLayer()`. The `endTile()` method returns a byte array that encodes the tile contents in a specific vector tile format. See `MVTWriter` for an example of a specific output format.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addFeature(Long key, IFeatureGeometry geometry, Map attributes)` Adds a new feature to the current layer.
`void` `endLayer()` Ends the process of writing to the layer.
`byte[]` `endTile()` Ends the process of creating a new tile.
`void` `startLayer(String name)` Starts the process of creating a new layer within the current tile.
`void` `startTile(Envelope mbr)` Starts the process of creating a new tile for the given bounds.

### Method Detail

#### startTile

    void startTile(Envelope mbr)

Starts the process of creating a new tile for the given bounds.

Parameters:
  `mbr` - the bounds of the tile to be created.
Throws:
  `IllegalStateException` - if this writer is not in the `initial` state.

#### endTile

    byte[] endTile()

Ends the process of creating a new tile.

Returns:
  The vector tile
Throws:
  `IllegalStateException` - if the writer is not in the `writing tile` state.

#### startLayer

    void startLayer(String name)

Starts the process of creating a new layer within the current tile.

Parameters:
  `name` - A unique layer name
Throws:
  `IllegalStateException` - if the writer is not in the `writing tile` state.

#### addFeature

    void addFeature(Long key,
                    IFeatureGeometry geometry,
                    Map attributes)

Adds a new feature to the current layer.

Parameters:
  `key` - A unique feature key
  `geometry` - Geometry for the feature
  `attributes` - Attributes for the feature
Throws:
  `IllegalStateException` - if the writer is not in the `writing layer` state.

#### endLayer

    void endLayer()

Ends the process of writing to the layer. Once called, no more features can be written to the current layer.

Throws:
  `IllegalStateException` - if the writer is not in the `writing layer` state.