Class ImageMetadataBuilder

java.lang.Object
org.apache.sis.internal.storage.MetadataBuilder
org.apache.sis.storage.geotiff.ImageMetadataBuilder

final class ImageMetadataBuilder extends MetadataBuilder
A temporary object for building the metadata for a single GeoTIFF image. Fields in the class are used only for information purposes; they do not have incidence on the way Apache SIS will handle the GeoTIFF image.
Note: if those fields become useful to ImageFileDirectory in a future version, we can move them into that class. Otherwise keeping those fields here allow to discard them (which save a little bit of space) when no longer needed.
Since:
1.2
Version:
1.3
  • Field Details

    • resolution

      private double resolution
      The number of pixels per resolutionUnit in the image width and Height directions, or Double.NaN is unspecified. Since ISO 19115 does not have separated resolution fields for image width and height, Apache SIS stores only the maximal value.
    • resolutionUnit

      private javax.measure.Unit<javax.measure.quantity.Length> resolutionUnit
      The unit of measurement for the resolution value, or null if none. A null value is used for images that may have a non-square aspect ratio, but no meaningful absolute dimensions. Default value for TIFF files is inch.
    • cellWidth

      private short cellWidth
      The size of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should be present only if Threshholding tag is 2 (an ordered dither or halftone technique has been applied to the image data). Special values:
      • -1 means that Threshholding is 1 or unspecified.
      • -2 means that Threshholding is 2 but the matrix size has not yet been specified.
      • -3 means that Threshholding is 3 (randomized process such as error diffusion).
    • cellHeight

      private short cellHeight
      The size of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should be present only if Threshholding tag is 2 (an ordered dither or halftone technique has been applied to the image data). Special values:
      • -1 means that Threshholding is 1 or unspecified.
      • -2 means that Threshholding is 2 but the matrix size has not yet been specified.
      • -3 means that Threshholding is 3 (randomized process such as error diffusion).
    • complement

      private XMLMetadata complement
      Metadata specified in GEO_METADATA or GDAL_METADATA tags, or null if none.
  • Constructor Details

    • ImageMetadataBuilder

      ImageMetadataBuilder()
      Creates an initially empty metadata builder.
  • Method Details

    • setThreshholding

      Integer setThreshholding(int value)
      Encodes the value of Threshholding TIFF tag into the cellWidth and cellHeight fields. Recognized values are:
      • 1 = No dithering or halftoning has been applied to the image data.
      • 2 = An ordered dither or halftone technique has been applied to the image data.
      • 3 = A randomized process such as error diffusion has been applied to the image data.
      Parameters:
      value - the threshholding value.
      Returns:
      null on success, or the given value if not recognized.
    • setCellSize

      void setCellSize(short size, boolean w)
      Sets the width or height of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. Meaningful only if Threshholding = 2.
      Parameters:
      size - the new size.
      w - true for setting cell width, or false for setting cell height.
    • setResolution

      void setResolution(double r)
      Sets the resolution to the maximal of current value and given value.
    • setResolutionUnit

      Integer setResolutionUnit(int unit)
      Sets the unit of measurement for XResolution and YResolution. Recognized values are:
      • 1 = None. Used for images that may have a non-square aspect ratio.
      • 2 = Inch (default).
      • 3 = Centimeter.
      Parameters:
      value - the threshholding value.
      Returns:
      null on success, or the given value if not recognized.
    • addXML

      void addXML(XMLMetadata xml)
      Adds metadata in XML format. Those metadata are defined in GEO_METADATA or GDAL_METADATA tags.
    • finish

      void finish(ImageFileDirectory image, StoreListeners listeners) throws DataStoreException
      Completes the metadata with the information stored in the fields of the IFD. This method is invoked only if the user requested the ISO 19115 metadata. It should be invoked last, after all other metadata have been set.
      Throws:
      DataStoreException - if an error occurred while reading metadata from the data store.