public class TLcdEarthTileRepositoryPreprocessor extends Object
ILcdEarthEditableTileSet
based on its
corresponding ILcdEarthAsset
s. This implementation uses multiple threads to increase the
preprocessing performance.Constructor and Description |
---|
TLcdEarthTileRepositoryPreprocessor()
Constructs a multithreaded preprocessor that uses a single thread and the default commit
frequency.
|
TLcdEarthTileRepositoryPreprocessor(int aNumThreads)
Constructs a multithreaded preprocessor that uses the specified number of threads and the
default commit frequency.
|
TLcdEarthTileRepositoryPreprocessor(int aNumThreads,
int aCommitFrequency)
Constructs a multithreaded preprocessor that uses the specified number of threads and commit
frequency.
|
Modifier and Type | Method and Description |
---|---|
void |
addAssetCodec(ILcdEarthAssetCodec aCodec)
Registers a codec for the preprocessed assets.
|
void |
addTileCombiner(ILcdEarthTileCombiner aCombiner)
Registers a tile combiner to be used during preprocessing.
|
protected boolean |
getCombinableTilesSFCT(ILcdEarthEditableTileSet aTargetTileSet,
ILcdEarthTileSetCoverage aTargetCoverage,
int aLevel,
long aTileX,
long aTileY,
TLcdEarthTileFormat aTargetFormat,
ALcdEarthTile[][] aTilesSFCT)
Collects four tiles to be used with an
ILcdEarthTileCombiner . |
int |
getCommitFrequency()
Returns the number of tiles to produce before committing.
|
int |
getNumberOfThreads()
Returns the number of threads used for preprocessing.
|
int |
getThreadPriority()
Returns the priority of the preprocessing threads.
|
boolean |
isPreprocessing()
Returns whether this preprocessor is currently preprocessing.
|
void |
setCommitFrequency(int aCommitFrequency)
Sets the number of tiles to produce before committing.
|
void |
setNumberOfThreads(int aNumThreads)
Sets the number of threads used for preprocessing.
|
void |
setThreadPriority(int aThreadPriority)
sets the priority of the preprocessing threads.
|
void |
synchronizeRepository(ILcdModel aAssetModel,
ILcdEarthTileSet aSourceTileSet,
ILcdEarthTileSetCoverage[] aSourceCoverages,
String[] aTargetCoverageNames,
ILcdGeoReference[] aTargetReferences,
TLcdEarthTileFormat[] aTargetFormats,
ILcdEarthEditableTileSet aTargetTileSet,
String aTargetDirectory,
ILcdEarthPreprocessorProgressListener aProgressListener)
Synchronizes a repository with the specified metadata.
|
public TLcdEarthTileRepositoryPreprocessor()
public TLcdEarthTileRepositoryPreprocessor(int aNumThreads)
aNumThreads
- the number of threads to use for preprocessingpublic TLcdEarthTileRepositoryPreprocessor(int aNumThreads, int aCommitFrequency)
aNumThreads
- the number of threads to use for preprocessingaCommitFrequency
- the number of tiles to produce before committingpublic void addTileCombiner(ILcdEarthTileCombiner aCombiner)
aCombiner
- a tile combinerIllegalStateException
- if this preprocessor is preprocessingpublic void addAssetCodec(ILcdEarthAssetCodec aCodec)
aCodec
- an asset codec to use for storing the progressIllegalStateException
- if this preprocessor is preprocessingpublic int getNumberOfThreads()
public void setNumberOfThreads(int aNumThreads)
aNumThreads
- the number of threads used for preprocessing.IllegalStateException
- if this preprocessor is preprocessingpublic int getThreadPriority()
Thread.getPriority()
public void setThreadPriority(int aThreadPriority)
aThreadPriority
- the priority of the preprocessing threads.IllegalStateException
- if this preprocessor is preprocessingThread.getPriority()
public int getCommitFrequency()
public void setCommitFrequency(int aCommitFrequency)
aCommitFrequency
- the number of tiles to produce before committing.IllegalStateException
- if this preprocessor is preprocessingpublic boolean isPreprocessing()
public void synchronizeRepository(ILcdModel aAssetModel, ILcdEarthTileSet aSourceTileSet, ILcdEarthTileSetCoverage[] aSourceCoverages, String[] aTargetCoverageNames, ILcdGeoReference[] aTargetReferences, TLcdEarthTileFormat[] aTargetFormats, ILcdEarthEditableTileSet aTargetTileSet, String aTargetDirectory, ILcdEarthPreprocessorProgressListener aProgressListener) throws IOException
aAssetModel
- the metadata to synchronize the repository withaSourceTileSet
- the tileset whose tiles are being preprocessed. Its bounds must be
in the same reference as aAssetModel
.aSourceCoverages
- the coverages in the source tile set that must bepreprocessed. The
coverages must include an ILcdEarthRasterTileSetCoverage to compare
the asset's pixel density with.aTargetCoverageNames
- the names of the source coverages in the target tileset. It must
contain 1 entry for each element of aSourceCoverages
.aTargetReferences
- the georeferences in which to generate tiles for each of the
coverages. It must contain 1 entry for each element of
aSourceCoverages
.aTargetFormats
- the formats in which to generate tiles for each of the coverages.
It must contain 1 entry for each element of aSourceCoverages
.aTargetTileSet
- the tileset to be updated. It must have the same grid structure,
bounds and reference as aSourceTileSet
.aTargetDirectory
- the directory where the preprocessor can be store data to support
resuming. This directory should be unique for each preprocessing
session. Normally the directory where the target tileset stores its
data is a good choice.aProgressListener
- a listener that receives progress notificationsIOException
- if the tiles cannot be written to the repositoryIllegalStateException
- if this preprocessor is already preprocessingprotected boolean getCombinableTilesSFCT(ILcdEarthEditableTileSet aTargetTileSet, ILcdEarthTileSetCoverage aTargetCoverage, int aLevel, long aTileX, long aTileY, TLcdEarthTileFormat aTargetFormat, ALcdEarthTile[][] aTilesSFCT) throws IOException
ILcdEarthTileCombiner
. This
method is called during preprocessing and determines whether the tile
specified by aLevel
, aTileX
and aTileY
can be generated by a combiner or not. To do so, this method attempts to
retrieve the 2x2 block of tiles from the next higher level (i.e.
aLevel
+ 1) that corresponds to the desired tile. If all four
of these tiles are available, the method returns true and the tiles
themselves are stored in aTilesSFCT
. The preprocessor will
subsequently pass the tiles to a combiner and store the resulting combined
tile in the target terrain repository. If any of the four tiles are
missing, this method returns false and the preprocessor will request the
tile from the source tileset rather than creating it with a combiner.
Note that this method is only invoked if a suitable combiner for the required tile format has been registered. If this is not the case, all tiles are retrieved from the source tileset.
aTargetTileSet
- the target tile repositoryaTargetCoverage
- the target coverageaLevel
- the level of the tile that is to be generatedaTileX
- the column index of the tile that is to be generatedaTileY
- the row index of the tile that is to be generatedaTargetFormat
- the format of the tile that is to be generatedaTilesSFCT
- the four tiles that can be used as input to the combiner that will generate the requested tileIOException
- if an error occurs while retrieving the tiles