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 available ILcdModelReferenceEncoder 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 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 the model reference encoders list.
    • TLcdCompositeModelReferenceEncoder

      public TLcdCompositeModelReferenceEncoder(Iterable<? extends ILcdModelReferenceEncoder> aModelReferenceEncoders)
      Creates a new composite model reference encoder that lazily uses the given Iterable to delegate to.
      Parameters:
      aModelReferenceEncoders - an Iterable of model reference encoders
    • TLcdCompositeModelReferenceEncoder

      public TLcdCompositeModelReferenceEncoder(ILcdModelReferenceEncoder... aModelReferenceEncoders)
      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

      public List<ILcdModelReferenceEncoder> getModelReferenceEncoders()
      Returns the list of delegate model reference encoders contained in this composite. If this instance was constructed using an Iterable, 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 interface ILcdModelReferenceEncoder
      Parameters:
      aModelReference - the ILcdModelReference to be encoded.
      aDataDestinationName - the destination name of the model to which the specified model reference belongs.
      Throws:
      IOException - if the ILcdModelReference cannot be encoded.
    • setOutputStreamFactory

      public void setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
      If not null, overrides the output stream factory of the contained model encoders with the given factory.
      Specified by:
      setOutputStreamFactory in interface ILcdOutputStreamFactoryCapable
      Parameters:
      aOutputStreamFactory - the output stream factory to be used.
    • getOutputStreamFactory

      public ILcdOutputStreamFactory getOutputStreamFactory()
      Description copied from interface: ILcdOutputStreamFactoryCapable
      Returns the output stream factory that is used.
      Specified by:
      getOutputStreamFactory in interface ILcdOutputStreamFactoryCapable
      Returns:
      the output stream factory that is used.