Package mil.nga.geopackage.tiles
Class TileGenerator
- java.lang.Object
-
- mil.nga.geopackage.tiles.TileGenerator
-
- Direct Known Subclasses:
FeatureTileGenerator,UrlTileGenerator
public abstract class TileGenerator extends Object
Creates a set of tiles within a GeoPackage
-
-
Field Summary
Fields Modifier and Type Field Description protected BoundingBoxboundingBoxTile bounding boxprotected ContextcontextContextprotected ProjectionprojectionTiles projection
-
Constructor Summary
Constructors Constructor Description TileGenerator(Context context, GeoPackage geoPackage, String tableName, int minZoom, int maxZoom, BoundingBox boundingBox, Projection projection)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Close the GeoPackageprotected abstract byte[]createTile(int z, long x, long y)Create the tileintgenerateTiles()Generate the tilesBoundingBoxgetBoundingBox()Get bounding boxBoundingBoxgetBoundingBox(int zoom)Get the bounding box, possibly expanded for the zoom levelBitmap.CompressFormatgetCompressFormat()Get the compress formatIntegergetCompressQuality()Get the compress qualityGeoPackagegetGeoPackage()Get the GeoPackageintgetMaxZoom()Get the max zoomintgetMinZoom()Get the min zoomGeoPackageProgressgetProgress()Get the progress trackerTileScalinggetScaling()Get the tile scaling settingsStringgetTableName()Get the table nameintgetTileCount()Get the tile count of tiles to be generatedbooleanisSkipExisting()Is skip existing tiles onbooleanisXYZTiles()Is the XYZ Tiles flag set to generate XYZ tile format tiles.protected abstract voidpreTileGeneration()Called after set up and right before tile generation starts for the first zoom levelvoidsetBitmapCompressionConfig(Bitmap.Config config)Set the Bitmap Compress ConfigvoidsetCompressFormat(Bitmap.CompressFormat compressFormat)Set the compress formatvoidsetCompressQuality(Integer compressQuality)Set the compress quality.voidsetProgress(GeoPackageProgress progress)Set the progress trackervoidsetScaling(TileScaling scaling)Set the tile scaling settingsvoidsetSkipExisting(boolean skipExisting)Set the skip existing tiles flagvoidsetXYZTiles(boolean xyzTiles)Set the XYZ Tiles flag to true to generate XYZ tile format tiles.
-
-
-
Field Detail
-
context
protected final Context context
Context
-
projection
protected Projection projection
Tiles projection
-
boundingBox
protected BoundingBox boundingBox
Tile bounding box
-
-
Constructor Detail
-
TileGenerator
public TileGenerator(Context context, GeoPackage geoPackage, String tableName, int minZoom, int maxZoom, BoundingBox boundingBox, Projection projection)
Constructor- Parameters:
context- app contextgeoPackage- GeoPackagetableName- table nameminZoom- min zoommaxZoom- max zoomboundingBox- tiles bounding boxprojection- tiles projection- Since:
- 1.3.0
-
-
Method Detail
-
getGeoPackage
public GeoPackage getGeoPackage()
Get the GeoPackage- Returns:
- GeoPackage
- Since:
- 1.2.5
-
getTableName
public String getTableName()
Get the table name- Returns:
- table name
- Since:
- 1.2.5
-
getMinZoom
public int getMinZoom()
Get the min zoom- Returns:
- min zoom
- Since:
- 1.2.5
-
getMaxZoom
public int getMaxZoom()
Get the max zoom- Returns:
- max zoom
- Since:
- 1.2.5
-
getBoundingBox
public BoundingBox getBoundingBox()
Get bounding box- Returns:
- bounding box
- Since:
- 3.2.0
-
getBoundingBox
public BoundingBox getBoundingBox(int zoom)
Get the bounding box, possibly expanded for the zoom level- Parameters:
zoom- zoom level- Returns:
- original or expanded bounding box
- Since:
- 3.2.0
-
setCompressFormat
public void setCompressFormat(Bitmap.CompressFormat compressFormat)
Set the compress format- Parameters:
compressFormat- compression format
-
getCompressFormat
public Bitmap.CompressFormat getCompressFormat()
Get the compress format- Returns:
- compress format
- Since:
- 1.2.5
-
setCompressQuality
public void setCompressQuality(Integer compressQuality)
Set the compress quality. The Compress format must be set for this to be used.- Parameters:
compressQuality- compression quality
-
getCompressQuality
public Integer getCompressQuality()
Get the compress quality- Returns:
- compress quality or null
- Since:
- 1.2.5
-
setProgress
public void setProgress(GeoPackageProgress progress)
Set the progress tracker- Parameters:
progress- progress tracker
-
getProgress
public GeoPackageProgress getProgress()
Get the progress tracker- Returns:
- progress
- Since:
- 1.2.5
-
setBitmapCompressionConfig
public void setBitmapCompressionConfig(Bitmap.Config config)
Set the Bitmap Compress Config- Parameters:
config- bitmap config
-
setXYZTiles
public void setXYZTiles(boolean xyzTiles)
Set the XYZ Tiles flag to true to generate XYZ tile format tiles. Default is false- Parameters:
xyzTiles- XYZ Tiles flag- Since:
- 3.5.0
-
isXYZTiles
public boolean isXYZTiles()
Is the XYZ Tiles flag set to generate XYZ tile format tiles.- Returns:
- true if XYZ Tiles format, false if GeoPackage
- Since:
- 3.5.0
-
getScaling
public TileScaling getScaling()
Get the tile scaling settings- Returns:
- tile scaling
- Since:
- 2.0.2
-
setScaling
public void setScaling(TileScaling scaling)
Set the tile scaling settings- Parameters:
scaling- tile scaling- Since:
- 2.0.2
-
isSkipExisting
public boolean isSkipExisting()
Is skip existing tiles on- Returns:
- true if skipping existing tiles
- Since:
- 3.5.0
-
setSkipExisting
public void setSkipExisting(boolean skipExisting)
Set the skip existing tiles flag- Parameters:
skipExisting- true to skip existing tiles- Since:
- 3.5.0
-
getTileCount
public int getTileCount()
Get the tile count of tiles to be generated- Returns:
- tile count
-
generateTiles
public int generateTiles() throws SQLException, IOExceptionGenerate the tiles- Returns:
- tiles created
- Throws:
SQLException- upon failureIOException- upon failure
-
close
public void close()
Close the GeoPackage
-
preTileGeneration
protected abstract void preTileGeneration()
Called after set up and right before tile generation starts for the first zoom level
-
createTile
protected abstract byte[] createTile(int z, long x, long y)Create the tile- Parameters:
z- zoom levelx- x coordinatey- y coordinate- Returns:
- tile bytes
-
-