Class ImageTransform

java.lang.Object
noaa.coastwatch.render.ImageTransform

public class ImageTransform extends Object
The ImageTransform class translates between 2D data coordinates and image coordinates in x and y.
Since:
3.1.1
Author:
Peter Hollemans
  • Constructor Details

    • ImageTransform

      @Deprecated public ImageTransform(Dimension imageDims)
      Deprecated.
      As of 3.3.1, use the other constructors instead.
      Constructs a new default image transform set to unity.
      Parameters:
      imageDims - the image dimensions.
    • ImageTransform

      @Deprecated public ImageTransform(Dimension imageDims, DataLocation center, double[] scales) throws NoninvertibleTransformException
      Constructs a new image transform with the specified image dimensions, center data location, and scaling factors.
      Parameters:
      imageDims - the image dimensions.
      center - the center data location. This location transforms to the center of the image coordinates.
      scales - the image to data scaling factors as [row, column].
      Throws:
      NoninvertibleTransformException - if the image to data transform is not invertible.
    • ImageTransform

      public ImageTransform(Dimension imageDims, DataLocation center, double scale) throws NoninvertibleTransformException
      Constructs a new image transform with the specified image dimensions, center data location, and scaling factor.
      Parameters:
      imageDims - the image dimensions.
      center - the center data location. This location transforms to the center of the image coordinates.
      scale - the ratio of data pixels to view image pixels.
      Throws:
      NoninvertibleTransformException - if the image to data transform is not invertible.
      Since:
      3.3.1
    • ImageTransform

      public ImageTransform(Dimension imageDims, Dimension dataDims, DataLocation center, double scale, AffineTransform orientationAffine) throws NoninvertibleTransformException
      Constructs a new image transform with the specified image dimensions, center data location, scaling factors, and orientation affine.
      Parameters:
      imageDims - the image dimensions.
      dataDims - the data dimensions.
      center - the center data location. This location transforms to the center of the image coordinates.
      scale - the ratio of data pixels to view image pixels.
      orientationAffine - the affine transform that orients the data for display. This may be used for when data row and column coordinates do not correspond to the normal way that a data image is expected to be displayed. The affine can be TYPE_FLIP, TYPE_QUANDRANT_ROTATION, or TYPE_IDENTITY only. The orientation affine is used to rotate or flip the data about its center point in data coordinate space (ie: world coordinates versus viewport coordinates).
      Throws:
      NoninvertibleTransformException - if the data to image transform is not invertible.
      IllegalArgumentException - if the orientation affine is not a flip, quadrant rotation, or identity.
      Since:
      3.3.1
  • Method Details

    • transform

      public Point2D transform(DataLocation loc)
      Converts data coordinates to image coordinates.
      Parameters:
      loc - the data location.
      Returns:
      the image coordinates, or null if the location is invalid.
      See Also:
    • transform

      public DataLocation transform(Point2D point)
      Converts arbitrary precision image coordinates to data coordinates.
      Parameters:
      point - the image coordinates.
      Returns:
      the data location.
      See Also:
    • transform

      public DataLocation transform(Point point)
      Converts integer image coordinates to data coordinates.
      Parameters:
      point - the image coordinates.
      Returns:
      the data location.
      See Also:
    • getAffine

      public AffineTransform getAffine()
      Gets the data to image coordinate transform.
      Returns:
      the affine to transform data [row,column] to image [x,y].
    • getImageDimensions

      public Dimension getImageDimensions()
      Gets the current image dimensions.
      Returns:
      the image dimensions width and height in pixels.
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception