@LcdService(service=ILcdModelEncoder.class, priority=20000) public class TLcdLuciadPanoramaModelEncoder extends Object implements ILcdModelEncoder, ILcdStatusSource
See the Panorama guide for more information.
This encoder will create multi-leveled tiled cubemap panoramas, for optimal loading in the RIA scene.
This model encoder handles only models that contain panoramic imagery.
This encoder handles models whose model descriptor implements ILcdPanoramaModelDescriptor
.
This implies that its elements implement ILcdPanorama
.
The panoramic models that are created by our decoders (such as TLcdPegasusModelDecoder
)
fulfill these requirements.
For more information on how you can create your own decoder, see this article.
This encoder outputs a Luciad Panorama dataset. Specifically:
cubemap.json
file that holds the cubemap imagery information. See the
constructor parameters for more information.
// Load a Pegasus panoramic dataset
ILcdModelDecoder decoder = new TLcdPegasusModelDecoder();
ILcdModel model = decoder.decode("/path/to/pegasus/External Orientation.csv");
// Encode to GeoJSON
ILcdModelEncoder encoder = new TLcdLuciadPanoramaModelEncoder();
encoder.export(model, "/path/to/cubemap/cubemap.json");
This encoder is not thread-safe for concurrent writing.
stop()
, or even killing the process.
If you then restart export(com.luciad.model.ILcdModel, java.lang.String)
, this encoder will automatically try to resume processing from where it got interrupted.
When processing a model, this encoder will skip the generation of any cubemap image which already exists in the output location.
If you wish to restart processing from scratch, you must first clean the output directory.
plug in
your own encoder to save the cubemap position and metadata information.
For example, you can plug in a TLcdPostGISModelEncoder
to save the cubemap information in a database.
By default, the cubemap information is stored as GeoJSON.
primary key
of the input model, use ILcdOGCFeatureIDRetriever.createDefaultFeatureIDRetriever(ILcdModel)
.
Constructor and Description |
---|
TLcdLuciadPanoramaModelEncoder()
Create a default panorama encoder.
|
TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder aDelegateDecoder,
ILcdModelEncoder aDelegateEncoder)
Create a new Luciad Panorama encoder that saves the panorama feature properties using the decoder and encoder.
|
TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder aDelegateDecoder,
ILcdModelEncoder aDelegateEncoder,
int aSkip,
long aLimit,
int aEvery,
int aResampleGridSize,
boolean aDrawOrientation,
double aCompressionQuality)
Create a new encoder with the given parameters.
|
TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder aDelegateDecoder,
ILcdModelEncoder aDelegateEncoder,
int aSkip,
long aLimit,
int aEvery,
int aMaximumTileSize,
int aResampleGridSize,
boolean aDrawOrientation,
double aCompressionQuality)
Create a new encoder with the given parameters.
|
TLcdLuciadPanoramaModelEncoder(int aSkip,
long aLimit,
int aEvery,
int aResampleGridSize,
boolean aDrawOrientation,
double aCompressionQuality)
Create a new encoder with the given parameters.
|
TLcdLuciadPanoramaModelEncoder(int aSkip,
long aLimit,
int aEvery,
int aMaximumTileSize,
int aResampleGridSize,
boolean aDrawOrientation,
double aCompressionQuality)
Create a new encoder with the given parameters.
|
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 aDestinationName)
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 aDestinationName)
Exports the specified model to the specified destination.
|
String |
getDisplayName()
Returns a short, displayable name for the format this
ILcdModelEncoder encodes to. |
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 |
setFeatureIDRetriever(ILcdOGCFeatureIDRetriever aFeatureIDRetriever)
Override the default primary key provider.
|
void |
stop()
Abort processing.
|
public TLcdLuciadPanoramaModelEncoder()
See constructor TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder, ILcdModelEncoder, int, long, int, int, int, boolean, double)
with these default parameters:
TLcdGeoJsonModelDecoder
TLcdGeoJsonModelEncoder
public TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder aDelegateDecoder, ILcdModelEncoder aDelegateEncoder)
See constructor TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder, ILcdModelEncoder, int, long, int, int, int, boolean, double)
with these default parameters:
aDelegateDecoder
- the decoder that must be used when appending panorama metadata to an existing modelaDelegateEncoder
- the encoder that will be used for writing the panorama metadatapublic TLcdLuciadPanoramaModelEncoder(int aSkip, long aLimit, int aEvery, int aResampleGridSize, boolean aDrawOrientation, double aCompressionQuality)
See constructor TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder, ILcdModelEncoder, int, long, int, int, int, boolean, double) with these default parameters:
TLcdGeoJsonModelDecoder
TLcdGeoJsonModelEncoder
aSkip
- number of input model elements that will be skipped at the start, must be positiveaLimit
- maximum number of elements that the output panorama model will have, unlimited if negativeaEvery
- number of input model elements that will be skipped between two successive elements to be processed, must be strictly positiveaResampleGridSize
- the size of the grid that will be used when resampling the input images, must be 1 or largeraDrawOrientation
- a boolean indicating whether the output images should contain an orientation grid (N/E/S/W)aCompressionQuality
- the jpg compression quality that will be used for the output images, must be a value between 0 and 1public TLcdLuciadPanoramaModelEncoder(int aSkip, long aLimit, int aEvery, int aMaximumTileSize, int aResampleGridSize, boolean aDrawOrientation, double aCompressionQuality)
See constructor TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder, ILcdModelEncoder, int, long, int, int, int, boolean, double) with these default parameters:
TLcdGeoJsonModelDecoder
TLcdGeoJsonModelEncoder
aSkip
- number of input model elements that will be skipped at the start, must be positiveaLimit
- maximum number of elements that the output panorama model will have, unlimited if negativeaEvery
- number of input model elements that will be skipped between two successive elements to be processed, must be strictly positiveaResampleGridSize
- the size of the grid that will be used when resampling the input images, must be 1 or largeraDrawOrientation
- a boolean indicating whether the output images should contain an orientation grid (N/E/S/W)aCompressionQuality
- the jpg compression quality that will be used for the output images, must be a value between 0 and 1public TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder aDelegateDecoder, ILcdModelEncoder aDelegateEncoder, int aSkip, long aLimit, int aEvery, int aResampleGridSize, boolean aDrawOrientation, double aCompressionQuality)
See constructor TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder, ILcdModelEncoder, int, long, int, int, int, boolean, double) with these default parameters:
aDelegateDecoder
- the decoder that must be used when appending panorama metadata to an existing modelaDelegateEncoder
- the encoder that will be used for writing the panorama metadataaSkip
- number of input model elements that will be skipped at the start, must be positiveaLimit
- maximum number of elements that the output panorama model will have, unlimited if negativeaEvery
- number of input model elements that will be skipped between two successive elements to be processed, must be strictly positiveaResampleGridSize
- the size of the grid that will be used when resampling the input images, must be 1 or largeraDrawOrientation
- a boolean indicating whether the output images should contain an orientation grid (N/E/S/W)aCompressionQuality
- the jpg compression quality that will be used for the output images, must be a value between 0 and 1public TLcdLuciadPanoramaModelEncoder(ILcdModelDecoder aDelegateDecoder, ILcdModelEncoder aDelegateEncoder, int aSkip, long aLimit, int aEvery, int aMaximumTileSize, int aResampleGridSize, boolean aDrawOrientation, double aCompressionQuality)
aDelegateDecoder
: when appending panorama metadata to an existing model, this decoder will be used.
aDelegateEncoder
: when writing panorama metadata, this encoder will be used.
TLcdPostGISModelEncoder
to save the cubemap information in a database.
aSkip
: number of input model elements that will be skipped at the start.
100
will start processing
from the 101st element forward.
aLimit
: maximum number of input model elements that will be processed.
aEvery
: number of input model elements to jump from one processed element to the next
1
means that every element will be processed.
aMaximumTileSize
: the maximum size of a tile when creating the Luciad panoramas.
aResampleGridSize
: The grid size that will be used when remapping pixels from the input panoramic
images to the output images.
aDrawOrientation
: setting this value to true
will make the encoder paint an orientation
grid on the output panoramic images with N/E/S/W labels.
aCompressionQuality
: the jpg compression quality that will be used for the output images
A combination of the parameters aSkip
, aLimit
and aEvery
could be used to gain quick
insight in a specific large input dataset.
For example, if a dataset has 5000 panoramic images, processing all these image can take a long time. You could
use aSkip
and aLimit
if you only need a part of the dataset.
Or, if you need to take samples over the entire dataset to verify its quality, you can use aEvery = 20
to have only 5% of the dataset processed. In a second pass, you can add elements to the output dataset by
modifying the parameters, for exmple using a combination of aSkip = 10
and aEvery = 20
will again
process 5% of the dataset.
aDelegateDecoder
- the decoder that must be used when appending panorama metadata to an existing modelaDelegateEncoder
- the encoder that will be used for writing the panorama metadataaSkip
- number of input model elements that will be skipped at the start, must be positiveaLimit
- maximum number of elements that the output panorama model will have, unlimited if negativeaEvery
- number of input model elements that will be skipped between two successive elements to be processed, must be strictly positiveaMaximumTileSize
- the maximum size of a tile when creating the Luciad panoramas, must be strictly positiveaResampleGridSize
- the size of the grid that will be used when resampling the input images, must be 1 or largeraDrawOrientation
- a boolean indicating whether the output images should contain an orientation grid (N/E/S/W)aCompressionQuality
- the jpg compression quality that will be used for the output images, must be a value between 0 and 1public void setFeatureIDRetriever(ILcdOGCFeatureIDRetriever aFeatureIDRetriever)
export(com.luciad.model.ILcdModel, java.lang.String)
.
To use the primary key
of the input model, use ILcdOGCFeatureIDRetriever.createDefaultFeatureIDRetriever(ILcdModel)
.
aFeatureIDRetriever
- The new primary key provider, use null
to use the default.public String getDisplayName()
ILcdModelEncoder
ILcdModelEncoder
encodes to.getDisplayName
in interface ILcdModelEncoder
ILcdModelEncoder
.public boolean canSave(ILcdModel aModel)
ILcdModelEncoder
canSave
in interface ILcdModelEncoder
aModel
- the model to be verified.true
if this encoder can save the model in the location where it originally came from,
false
otherwise.ILcdModelEncoder.save(com.luciad.model.ILcdModel)
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 void save(ILcdModel aModel) throws IllegalArgumentException
ILcdModelEncoder
save
in interface ILcdModelEncoder
aModel
- the model to be saved.IllegalArgumentException
- if the model cannot be saved by this encoder (!canSave(aModel)
).public boolean canExport(ILcdModel aModel, String aDestinationName)
aModel
must have a ILcdPanoramaModelDescriptor
.aDestinationName
must contain "cubemap".canExport
in interface ILcdModelEncoder
aModel
- the model to be verified.aDestinationName
- the location where the model should be exported to.ILcdModelEncoder.export(com.luciad.model.ILcdModel, java.lang.String)
public void stop()
Saved results are not removed.
You can resume processing by simply starting another export(com.luciad.model.ILcdModel, java.lang.String)
.
Panoramas that were already processed will be skipped.
public void export(ILcdModel aModel, String aDestinationName) throws IllegalArgumentException, IOException
ILcdModelEncoder
export
in interface ILcdModelEncoder
aModel
- the model to be exported.aDestinationName
- 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.