@LcdService(service=ILcdModelEncoder.class, priority=20000) public class TLcdGeoPackageModelEncoder extends Object implements ILcdModelEncoder, ILcdStatusSource
The export(com.luciad.model.ILcdModel, java.lang.String)
method exports the contents of a model to an OGC GeoPackage file.
isDeleteExistingFile()
is true
, the file is deleted first, and then re-created.spatially
if necessary.
ILcdRaster
, ILcdMultilevelRaster
or ILcdEarthTileSet
elements.
This includes models produced by almost all raster model decoders. Only the first element of a model
will be encoded. If the element is an ILcdEarthTileSet
containing multiple coverages only
one of those coverages will be encoded.
Both image and elevation data are supported by OGC GeoPackage.
Tiles are automatically generated. For image data you can override:
image format
image quality
target reference
number of levels
For elevation data you can override:
elevation image format
elevation image quality
compression mode
target reference
number of levels
Area sampling is used as sampling mode for elevation data. |
Fusion elevation coverage export follows a code path that preserves the sampling mode, when the target reference is equal to the source reference. |
ILcdDataObject
or ILcdFeatured
, the model descriptor must be ILcdDataModelDescriptor
or ILcdFeaturedDescriptor
.ILcdShape
objects that can be mapped to GeoPackage geometry types, see table below.TLcdPrimaryKeyAnnotation
, that property is used as primary key.
Otherwise, a new column _id
is used which has auto-generated values.
ILcdShape
objects are mapped to GeoPackage geometry as follows:
FROMILcdShape | TOGeoPackage geometry |
---|---|
ILcdPoint | POINT |
ILcdPolypoint | MULTIPOINT |
ILcdPolyline | POLYLINE |
ILcdPolygon | POLYGON |
ILcdComplexPolygon | POLYGON |
ILcdCircularArcBy3Points | CIRCULARARCSTRING |
ILcdArc | LCDELLIPTICALARC |
ILcdCircle | LCDCIRCLE |
ILcdEllipse | LCDELLIPSE |
ILcdShapeList containing
multiple ILcdPoint instances | MULTIPOINT |
ILcdShapeList containing
multiple ILcdPolyline instances | MULTIPOLYLINE |
ILcdShapeList containing
multiple ILcdPolygon instances | MULTIPOLYGON |
ILcdShapeList containing
multiple ILcdComplexPolygon instances | MULTIPOLYGON |
ILcdShapeList containing one of the above (recursive) instances | GEOMETRYCOLLECTION |
TLcdGeoPackageModelDecoder
.
You can then add, update or remove elements in the decoded model and make the changes persistent
with TLcdDatabaseModel.commit()
.
Alternatively, you can use save(com.luciad.model.ILcdModel)
.
Without committing or saving, any changes are present in the in-memory model only, not persisted in the database.
setExportVersion(ELcdGeoPackageSpecificationVersion)
.Modifier and Type | Class and Description |
---|---|
static class |
TLcdGeoPackageModelEncoder.CompressionMode
Enumeration of the supported compression mode.
|
static class |
TLcdGeoPackageModelEncoder.ElevationCompressionFormat
Enumeration of the supported elevation compression formats.
|
Modifier and Type | Field and Description |
---|---|
static String |
IMAGE_FORMAT_JPEG
Constant for JPEG image compression.
|
static String |
IMAGE_FORMAT_PNG
Constant for PNG image compression.
|
Constructor and Description |
---|
TLcdGeoPackageModelEncoder()
Creates a new GeoPackage model encoder
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aListener)
Registers the given listener so it will receive status events from this source.
|
boolean |
canExport(ILcdModel aModel,
String aDestination)
Returns whether this encoder can export the specified model to the specified destination.
|
boolean |
canSave(ILcdModel aModel)
Returns whether this model encoder can save the specified model to the location it originally came from.
|
void |
export(ILcdModel aModel,
String aDestination)
Exports the specified model to the specified destination.
|
ILcdBounds |
getAreaOfInterest()
Returns the bounds of the area to encode.
|
ILcdGeoReference |
getAreaOfInterestReference()
Returns the reference the current area to encode is defined in.
|
TLcdGeoPackageModelEncoder.CompressionMode |
getCompressionMode()
Returns the compression mode.
|
float |
getCompressionQuality()
Returns the current image compression quality setting.
|
String |
getDisplayName()
Returns a short, displayable name for the format this
ILcdModelEncoder encodes to. |
TLcdGeoPackageModelEncoder.ElevationCompressionFormat |
getElevationCompressionFormat()
Returns the current elevation compression format.
|
ELcdGeoPackageSpecificationVersion |
getExportVersion()
Returns the GeoPackage specification version configured for exporting models.
|
String |
getImageCompressionFormat()
Returns the current image compression format.
|
int |
getMaximumTileLevel()
Returns the maximum tile level.
|
ILcdGeoReference |
getTileTargetReference()
Returns the reference rasters will be encoded in.
|
boolean |
isDeleteExistingFile()
When the target file already exists it can either be removed first or the model can be added
to the existing file.
|
void |
removeStatusListener(ILcdStatusListener aListener)
Removes the specified listener so it is no longer notified.
|
void |
save(ILcdModel aModel)
Saves the model to the location where it originally came from.
|
void |
setAreaOfInterest(ILcdBounds aAreaOfInterest,
ILcdGeoReference aAreaOfInterestReference)
Sets the bounds to encode.
|
void |
setCompressionMode(TLcdGeoPackageModelEncoder.CompressionMode aCompressionMode)
Sets the compression mode of the encoded images.
|
void |
setCompressionQuality(float aCompressionQuality)
Sets the image compression quality setting between 0.0 and 1.0.
|
void |
setDeleteExistingFile(boolean aDeleteExistingFile)
When the target file already exists it can either be removed first or the model can be added
to the existing file.
|
void |
setElevationCompressionFormat(TLcdGeoPackageModelEncoder.ElevationCompressionFormat aElevationCompressionFormat)
Sets the format to use when compressing elevation data.
|
void |
setExportVersion(ELcdGeoPackageSpecificationVersion aExportVersion)
Sets the GeoPackage specification to use for exporting a model to a GeoPackage file.
|
void |
setImageCompressionFormat(String aImageCompressionFormat)
Sets the format to use when compressing imagery data.
|
void |
setMaximumTileLevel(int aMaximumTileLevel)
Sets the maximum tile level for raster data.
|
void |
setTileTargetReference(ILcdGeoReference aTargetReference)
Sets the reference to encode rasters in.
|
public static final String IMAGE_FORMAT_PNG
public static final String IMAGE_FORMAT_JPEG
public TLcdGeoPackageModelEncoder()
public float getCompressionQuality()
setCompressionQuality(float)
public void setCompressionQuality(float aCompressionQuality)
The default quality is 0.75
.
aCompressionQuality
- the new compression quality setting.getCompressionQuality()
public String getImageCompressionFormat()
setImageCompressionFormat(String)
public TLcdGeoPackageModelEncoder.ElevationCompressionFormat getElevationCompressionFormat()
setElevationCompressionFormat(ElevationCompressionFormat)
public TLcdGeoPackageModelEncoder.CompressionMode getCompressionMode()
setCompressionMode(CompressionMode)
public void setDeleteExistingFile(boolean aDeleteExistingFile)
true
indicates that the existing file will be deleted and a new one created when exporting a model.false
indicates that the model will be added to the existing file. If the file already contains the dataset, it will be overwritten.Disabled by default.
aDeleteExistingFile
- true if any existing file needs to be deleted first, false otherwise.isDeleteExistingFile()
public boolean isDeleteExistingFile()
setDeleteExistingFile(boolean)
public void setImageCompressionFormat(String aImageCompressionFormat)
aImageCompressionFormat
- the new image compression formatpublic void setElevationCompressionFormat(TLcdGeoPackageModelEncoder.ElevationCompressionFormat aElevationCompressionFormat)
aElevationCompressionFormat
- the new elevation compression formatpublic void setCompressionMode(TLcdGeoPackageModelEncoder.CompressionMode aCompressionMode)
COMPRESSION_LZW
.aCompressionMode
- one of the supported TIFF compression schemes:
COMPRESSION_NONE
,
COMPRESSION_LZW
,public ELcdGeoPackageSpecificationVersion getExportVersion()
public void setExportVersion(ELcdGeoPackageSpecificationVersion aExportVersion)
aExportVersion
- the GeoPackage specification value.public void addStatusListener(ILcdStatusListener aListener)
ILcdStatusSource
Registers the given listener so it will receive status events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source,
you can use a ALcdWeakStatusListener
instance as status listener.
addStatusListener
in interface ILcdStatusSource
aListener
- The listener to be notified when the status has changed.public void removeStatusListener(ILcdStatusListener aListener)
ILcdStatusSource
removeStatusListener
in interface ILcdStatusSource
aListener
- The listener to remove.public ILcdGeoReference getTileTargetReference()
setTileTargetReference(com.luciad.reference.ILcdGeoReference)
public void setTileTargetReference(ILcdGeoReference aTargetReference)
Rasters that are defined in another reference than the input model's will be converted to the target reference before being encoded.
By default, this is not set, meaning the input model's reference it used.
aTargetReference
- the new target reference.public ILcdBounds getAreaOfInterest()
setAreaOfInterest(com.luciad.shape.ILcdBounds, com.luciad.reference.ILcdGeoReference)
public ILcdGeoReference getAreaOfInterestReference()
setAreaOfInterest(com.luciad.shape.ILcdBounds, com.luciad.reference.ILcdGeoReference)
public void setAreaOfInterest(ILcdBounds aAreaOfInterest, ILcdGeoReference aAreaOfInterestReference)
By default, no bounds are set.
Use null
bounds if no bounds should be set.
aAreaOfInterest
- the new bounds to encode, or null
if no bounds should be set.aAreaOfInterestReference
- the reference the bounds are defined in.public int getMaximumTileLevel()
setMaximumTileLevel(int)
public void setMaximumTileLevel(int aMaximumTileLevel)
If a multilevel raster or tile set with a higher number of levels is encoded only up to aMaximumTileLevel of the least detailed levels will be encoded.
Default is unlimited.
aMaximumTileLevel
- the new maximum tile level.public String getDisplayName()
ILcdModelEncoder
ILcdModelEncoder
encodes to.getDisplayName
in interface ILcdModelEncoder
ILcdModelEncoder
.public boolean canSave(ILcdModel aModel)
canSave
in interface ILcdModelEncoder
aModel
- the model to be verified.true
if this encoder can save to the GeoPackage database.save(com.luciad.model.ILcdModel)
public void save(ILcdModel aModel) throws IllegalArgumentException, IOException
This is only supported for GeoPackage feature data. Raster data is simply ignored.
To do the actual save, this method calls TLcdDatabaseModel.commit()
.
Note: any settings you configure on this model encoder are ignored. The changes
are stored into the original database using the settings from the decoder
.
save
in interface ILcdModelEncoder
aModel
- the model to be saved.IllegalArgumentException
IOException
public boolean canExport(ILcdModel aModel, String aDestination)
ILcdModelEncoder
canExport
in interface ILcdModelEncoder
aModel
- the model to be verified.aDestination
- the location where the model should be exported to.true
if this encoder can export the specified model to the
specified location, false
otherwise.ILcdModelEncoder.export(com.luciad.model.ILcdModel, java.lang.String)
public void export(ILcdModel aModel, String aDestination) throws IllegalArgumentException, IOException
ILcdModelEncoder
export
in interface ILcdModelEncoder
aModel
- the model to be exported.aDestination
- the location where the model should be saved. Typically, this is a name for the output
file, but it can also point to a file containing the required properties to create a set
of data files.IllegalArgumentException
- if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)
).IOException
- if an I/O error occurs during encoding.