com.pb.lisdk.maptiling

## Class TileGridBuilder

- java.lang.Object
- - com.pb.lisdk.maptiling.TileGridBuilder

    public final class TileGridBuilder
    extends Object

A builder class for `ITileGrid` instances. Various semantics of the resulting tile grid - like the tile size, bounds and supported zoom levels - can be customized. To create a new tile grid instance, call `TileGridBuilder.build()`.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`ITileGrid` `build()` Creates a new tile grid with the semantics defined by any previous method calls on this builder instance.
`static TileGridBuilder` `customGrid(Envelope bounds)` Creates a new tile grid builder for tile grids with custom grid bounds.
`static TileGridBuilder` `webMercatorGrid()` Creates a new tile grid builder for tile grids with web mercator bounds.
`static TileGridBuilder` `wgs84Grid()` Creates a new tile grid builder for tile grids with WGS84 bounds.
`TileGridBuilder` `withLevels(int minLevel, int maxLevel)` Sets the minimum and maximum grid levels for the tile grid created with this builder.
`TileGridBuilder` `withTileSize(int width, int height)` Sets the tile width and height in screen coordinate units for the tile grid created with this builder.
`TileGridBuilder` `withTileWidth(int width)` Sets the tile width in screen coordinate units for the tile grid created with this builder.
`TileGridBuilder` `zeroBased()` Defines if the tile grid created with this builder uses 0 or 1-based indexes.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### webMercatorGrid

    public static TileGridBuilder webMercatorGrid()

Creates a new tile grid builder for tile grids with web mercator bounds.

#### wgs84Grid

    public static TileGridBuilder wgs84Grid()

Creates a new tile grid builder for tile grids with WGS84 bounds.

#### customGrid

    public static TileGridBuilder customGrid(Envelope bounds)

Creates a new tile grid builder for tile grids with custom grid bounds.

Parameters:
  `bounds` - custom grid bounds to be used

#### withTileSize

    public TileGridBuilder withTileSize(int width,
                                        int height)

Sets the tile width and height in screen coordinate units for the tile grid created with this builder.

Parameters:
  `width` - the width of each tile in screen coordinate units.
  `height` - height of each tile in screen coordinate units.
Returns:
  this builder instance.

#### withTileWidth

    public TileGridBuilder withTileWidth(int width)

Sets the tile width in screen coordinate units for the tile grid created with this builder. The tile height will be calculated to match the aspect ratio of the tile grid bounds.

Parameters:
  `width` - the width of each tile in screen coordinate units.
Returns:
  this builder instance.

#### withLevels

    public TileGridBuilder withLevels(int minLevel,
                                      int maxLevel)

Sets the minimum and maximum grid levels for the tile grid created with this builder.

Parameters:
  `minLevel` - the minimum level supported by the created tile grid.
  `maxLevel` - the maximum level supported by the created tile grid.
Returns:
  this builder instance.

#### zeroBased

    public TileGridBuilder zeroBased()

Defines if the tile grid created with this builder uses 0 or 1-based indexes. This applies to tile rows, columns and zoom levels. It doesn't apply to screen coordinates, which are always 0-based.

Returns:
  this builder instance.

#### build

    public ITileGrid build()

Creates a new tile grid with the semantics defined by any previous method calls on this builder instance.