Class RasterGenerator<T>

Object
RasterGenerator<T>
Type Parameters:
T - the type of entity that is transformed to a Stack
All Implemented Interfaces:
Generator<T>, TransformingGenerator<T,Stack>, ElementWriter<T>
Direct Known Subclasses:
RasterGeneratorSelectFormat

public abstract class RasterGenerator<T> extends Object implements TransformingGenerator<T,Stack>
Transforms an entity to a Stack and writes it to the file-system.
Author:
Owen Feehan
  • Constructor Details

    • RasterGenerator

      public RasterGenerator()
  • Method Details

    • write

      public void write(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException
      Description copied from interface: ElementWriter
      Writes a non-indexable output (an output that isn't part of a collection of other similar items).
      Specified by:
      write in interface ElementWriter<T>
      Parameters:
      element - the element to write.
      outputNameStyle - how to write output-names.
      outputter - how the element is outputted.
      Throws:
      OutputWriteFailedException - if the write operation fails.
    • writeWithIndex

      public void writeWithIndex(T element, String index, IndexableOutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException
      As only a single-file is involved, this methods delegates to a simpler virtual method.
      Specified by:
      writeWithIndex in interface ElementWriter<T>
      Parameters:
      element - the element to write.
      index - a string that uniquely identifies this element compared to others in the same write operation.
      outputNameStyle - how to write output-names.
      outputter - how the element is outputted.
      Throws:
      OutputWriteFailedException - if the write operation fails.
    • guaranteedImageAttributes

      public abstract StackWriteAttributes guaranteedImageAttributes()
      Guarantees on the attributes of all images created by the generator.
      Returns:
      options that are guaranteed to be true of all images by the generator.
    • selectFileExtension

      protected abstract String selectFileExtension(Stack stack, StackWriteOptions options, OutputWriteSettings settings, Optional<Logger> logger) throws OperationFailedException
      Selects the file-extension to use for a particular stack.
      Parameters:
      stack - the stack to select a file-extension for
      options - options that describe how stack should be written
      settings - general settings for writing output
      logger - logger for information messages or warnings associated with writing outputs
      Returns:
      the file extension without any leading period
      Throws:
      OperationFailedException - if the operation could not be successfully completed.
    • writeToFile

      protected abstract void writeToFile(T untransformedElement, Stack transformedElement, StackWriteOptions options, OutputWriteSettings settings, Path filePath) throws OutputWriteFailedException
      Writes a stack to the file-system.
      Parameters:
      untransformedElement - the element for the generator before transforming to a Stack
      transformedElement - the Stack that element was transformed into
      options - options that describe how stack should be written
      settings - general settings for writing output.
      filePath - the file-path to write too including the extension.
      Throws:
      OutputWriteFailedException - if the image could not be be successfully written to the file-system.