Package mil.nga.geopackage.tiles
Class TileGenerator
java.lang.Object
mil.nga.geopackage.tiles.TileGenerator
- Direct Known Subclasses:
FeatureTileGenerator
,UrlTileGenerator
Creates a set of tiles within a GeoPackage
-
Field Summary
Modifier and TypeFieldDescriptionprotected BoundingBox
Tile bounding boxprotected final Context
Contextprotected Projection
Tiles projection -
Constructor Summary
ConstructorDescriptionTileGenerator
(Context context, GeoPackage geoPackage, String tableName, int[] zoomLevels, BoundingBox boundingBox, Projection projection) ConstructorTileGenerator
(Context context, GeoPackage geoPackage, String tableName, int minZoom, int maxZoom, BoundingBox boundingBox, Projection projection) ConstructorTileGenerator
(Context context, GeoPackage geoPackage, String tableName, int zoomLevel, BoundingBox boundingBox, Projection projection) ConstructorTileGenerator
(Context context, GeoPackage geoPackage, String tableName, Collection<Integer> zoomLevels, BoundingBox boundingBox, Projection projection) ConstructorTileGenerator
(Context context, GeoPackage geoPackage, String tableName, BoundingBox boundingBox, Projection projection) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
addZoomLevel
(int zoomLevel) Add a zoom levelboolean
addZoomLevels
(int[] zoomLevels) Add zoom levelsboolean
addZoomLevels
(int minZoom, int maxZoom) Add a range of zoom levelsboolean
addZoomLevels
(Collection<Integer> zoomLevels) Add zoom levelsvoid
close()
Close the GeoPackageprotected abstract byte[]
createTile
(int z, long x, long y) Create the tileint
Generate the tilesGet bounding boxgetBoundingBox
(int zoom) Get the bounding box, possibly expanded for the zoom levelGet the compress formatGet the compress qualityGet the GeoPackageint
Get the max zoomint
Get the min zoomGet the progress trackerGet the tile scaling settingsGet the table nameint
Get the tile count of tiles to be generatedGet the zoom levels (read only)boolean
Is skip existing tiles onboolean
Is the XYZ Tiles flag set to generate XYZ tile format tiles.protected abstract void
Called after set up and right before tile generation starts for the first zoom levelvoid
Set the Bitmap Compress Configvoid
setCompressFormat
(Bitmap.CompressFormat compressFormat) Set the compress formatvoid
setCompressQuality
(Integer compressQuality) Set the compress quality.void
setProgress
(GeoPackageProgress progress) Set the progress trackervoid
setScaling
(TileScaling scaling) Set the tile scaling settingsvoid
setSkipExisting
(boolean skipExisting) Set the skip existing tiles flagvoid
setXYZTiles
(boolean xyzTiles) Set the XYZ Tiles flag to true to generate XYZ tile format tiles.
-
Field Details
-
context
Context -
projection
Tiles projection -
boundingBox
Tile bounding box
-
-
Constructor Details
-
TileGenerator
public TileGenerator(Context context, GeoPackage geoPackage, String tableName, BoundingBox boundingBox, Projection projection) Constructor- Parameters:
context
- app contextgeoPackage
- GeoPackagetableName
- table nameboundingBox
- tiles bounding boxprojection
- tiles projection- Since:
- 6.2.0
-
TileGenerator
public TileGenerator(Context context, GeoPackage geoPackage, String tableName, int zoomLevel, BoundingBox boundingBox, Projection projection) Constructor- Parameters:
context
- app contextgeoPackage
- GeoPackagetableName
- table namezoomLevel
- zoom levelboundingBox
- tiles bounding boxprojection
- tiles projection- Since:
- 6.2.0
-
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
-
TileGenerator
public TileGenerator(Context context, GeoPackage geoPackage, String tableName, Collection<Integer> zoomLevels, BoundingBox boundingBox, Projection projection) Constructor- Parameters:
context
- app contextgeoPackage
- GeoPackagetableName
- table namezoomLevels
- zoom levelsboundingBox
- tiles bounding boxprojection
- tiles projection- Since:
- 6.2.0
-
TileGenerator
public TileGenerator(Context context, GeoPackage geoPackage, String tableName, int[] zoomLevels, BoundingBox boundingBox, Projection projection) Constructor- Parameters:
context
- app contextgeoPackage
- GeoPackagetableName
- table namezoomLevels
- zoom levelsboundingBox
- tiles bounding boxprojection
- tiles projection- Since:
- 6.2.0
-
-
Method Details
-
getGeoPackage
Get the GeoPackage- Returns:
- GeoPackage
- Since:
- 1.2.5
-
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
-
getZoomLevels
Get the zoom levels (read only)- Returns:
- zoom levels
- Since:
- 6.2.0
-
addZoomLevel
public boolean addZoomLevel(int zoomLevel) Add a zoom level- Parameters:
zoomLevel
- zoom level- Returns:
- true if zoom level added
- Since:
- 6.2.0
-
addZoomLevels
public boolean addZoomLevels(int minZoom, int maxZoom) Add a range of zoom levels- Parameters:
minZoom
- min zoom levelmaxZoom
- max zoom level- Returns:
- true if at least one zoom level added
- Since:
- 6.2.0
-
addZoomLevels
Add zoom levels- Parameters:
zoomLevels
- zoom levels- Returns:
- true if at least one zoom level added
- Since:
- 6.2.0
-
addZoomLevels
public boolean addZoomLevels(int[] zoomLevels) Add zoom levels- Parameters:
zoomLevels
- zoom levels- Returns:
- true if at least one zoom level added
- Since:
- 6.2.0
-
getBoundingBox
Get bounding box- Returns:
- bounding box
- Since:
- 3.2.0
-
getBoundingBox
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
Set the compress format- Parameters:
compressFormat
- compression format
-
getCompressFormat
Get the compress format- Returns:
- compress format
- Since:
- 1.2.5
-
setCompressQuality
Set the compress quality. The Compress format must be set for this to be used.- Parameters:
compressQuality
- compression quality
-
getCompressQuality
Get the compress quality- Returns:
- compress quality or null
- Since:
- 1.2.5
-
setProgress
Set the progress tracker- Parameters:
progress
- progress tracker
-
getProgress
Get the progress tracker- Returns:
- progress
- Since:
- 1.2.5
-
setBitmapCompressionConfig
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
Get the tile scaling settings- Returns:
- tile scaling
- Since:
- 2.0.2
-
setScaling
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
Generate 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
-