Package com.luciad.model
Class TLcdCompositeModelReferenceEncoder
java.lang.Object
com.luciad.model.TLcdCompositeModelReferenceEncoder
- All Implemented Interfaces:
ILcdOutputStreamFactoryCapable
,ILcdModelReferenceEncoder
public final class TLcdCompositeModelReferenceEncoder
extends Object
implements ILcdModelReferenceEncoder, ILcdOutputStreamFactoryCapable
Composite implementation of ILcdModelReferenceEncoder
.
Any number of model reference encoders can be added to this composite.
The save(ILcdModelReference, String)
delegates, in order, to the encoders in the list.
See the save(ILcdModelReference, String)
for details.
Example usage:
To create a composite instance which uses all default availableILcdModelReferenceEncoder
instances, you can use:
ILcdModelReferenceEncoder encoder =
new TLcdCompositeModelReferenceEncoder(TLcdServiceLoader.getInstance(ILcdModelReferenceEncoder.class));
This will use all model reference encoders annotated with the @LcdService
annotation.
As this is the case for the default available reference encoders,
you end up with a encoder which can encode to *.epsg
, *.prj
and *.ref
files.- Since:
- 2018.0
-
Constructor Summary
ConstructorDescriptionCreates a new, empty composite model reference encoder.TLcdCompositeModelReferenceEncoder
(ILcdModelReferenceEncoder... aModelReferenceEncoders) Creates a new composite model reference encoder containing the supplied delegatesTLcdCompositeModelReferenceEncoder
(Iterable<? extends ILcdModelReferenceEncoder> aModelReferenceEncoders) Creates a new composite model reference encoder that lazily uses the givenIterable
to delegate to. -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of delegate model reference encoders contained in this composite.Returns the output stream factory that is used.void
save
(ILcdModelReference aModelReference, String aDataDestinationName) Saves the specified model reference to a location, next to the data destination.void
setOutputStreamFactory
(ILcdOutputStreamFactory aOutputStreamFactory) If not null, overrides the output stream factory of the contained model encoders with the given factory.
-
Constructor Details
-
TLcdCompositeModelReferenceEncoder
public TLcdCompositeModelReferenceEncoder()Creates a new, empty composite model reference encoder. This encoder will not be able to encode any model references until delegate model reference encoders are added to themodel reference encoders list
. -
TLcdCompositeModelReferenceEncoder
public TLcdCompositeModelReferenceEncoder(Iterable<? extends ILcdModelReferenceEncoder> aModelReferenceEncoders) Creates a new composite model reference encoder that lazily uses the givenIterable
to delegate to.- Parameters:
aModelReferenceEncoders
- anIterable
of model reference encoders
-
TLcdCompositeModelReferenceEncoder
Creates a new composite model reference encoder containing the supplied delegates- Parameters:
aModelReferenceEncoders
- delegate model reference encoders to be added to the composite
-
-
Method Details
-
getModelReferenceEncoders
Returns the list of delegate model reference encoders contained in this composite. If this instance was constructed using anIterable
, the returned list is unmodifiable. If not, delegates can be added or removed by modifying this list.- Returns:
- the list of the delegate model reference encoders in this composite
-
save
public void save(ILcdModelReference aModelReference, String aDataDestinationName) throws IOException Saves the specified model reference to a location, next to the data destination. Notes:- Tries all delegate encoders in order
- Looping over the delegates is stopped as soon as a model encoder does not throw an IOException.
- If no encoder can encode the reference,an
IOException
is thrown. - If a delegate encoder throws a
InterruptedIOException
, the encoding stops and that error is re-thrown.
- Specified by:
save
in interfaceILcdModelReferenceEncoder
- Parameters:
aModelReference
- theILcdModelReference
to be encoded.aDataDestinationName
- the destination name of the model to which the specified model reference belongs.- Throws:
IOException
- if theILcdModelReference
cannot be encoded.
-
setOutputStreamFactory
If not null, overrides the output stream factory of the contained model encoders with the given factory.- Specified by:
setOutputStreamFactory
in interfaceILcdOutputStreamFactoryCapable
- Parameters:
aOutputStreamFactory
- the output stream factory to be used.
-
getOutputStreamFactory
Description copied from interface:ILcdOutputStreamFactoryCapable
Returns the output stream factory that is used.- Specified by:
getOutputStreamFactory
in interfaceILcdOutputStreamFactoryCapable
- Returns:
- the output stream factory that is used.
-