Class GliderImage

  • All Implemented Interfaces:
    AVList

    public class GliderImage
    extends AVListImpl
    • Field Detail

      • GLIDER_REGIONS_OF_INTEREST

        public static final java.lang.String GLIDER_REGIONS_OF_INTEREST
        See Also:
        Constant Field Values
      • GLIDER_IMAGE_SOURCE

        public static final java.lang.String GLIDER_IMAGE_SOURCE
        See Also:
        Constant Field Values
      • GLIDER_IMAGE_OPACITY

        public static final java.lang.String GLIDER_IMAGE_OPACITY
        See Also:
        Constant Field Values
      • name

        protected java.lang.String name
      • sector

        protected Sector sector
      • corners

        protected java.util.List<LatLon> corners
      • altitude

        protected double altitude
      • opacity

        protected double opacity
      • imageSource

        protected java.lang.Object imageSource
      • regionListener

        protected java.beans.PropertyChangeListener regionListener
    • Constructor Detail

      • GliderImage

        public GliderImage​(java.lang.String imageSource,
                           java.lang.Iterable<? extends LatLon> corners,
                           double altitude)
        Construct an image from a file.
        Parameters:
        imageSource - The path to the source image. Images can be any of those supported by ImageIO, as well as uncompressed TIFF images..
        corners - The lat/lon locations of the region in which to map the image. The image will be stretched as necessary to fully fill the region. The locations must be specified in counterclockwise order beginning with the lower-left image corner.
        altitude - The altitude at which to display the image. Specify 0 to have the image draped over the globe's surface.
        Throws:
        java.lang.IllegalArgumentException - if any of the first three arguments are null.
      • GliderImage

        public GliderImage​(java.lang.String name,
                           ImageUtil.AlignedImage alignedImage,
                           double altitude)
        Construct an image from a file or BufferedImage and an arbitrary bounding region.
        Parameters:
        name - A unique name to identify the image. If the image source is a file, the file path can be used as the name.
        alignedImage - An aligned image containing a BufferedImage and a Sector specifying the image and the location to place it.The image will be stretched as necessary to fully fill the region.
        altitude - The altitude at which to display the image. Specify 0 to have the image draped over the globe's surface.
        Throws:
        java.lang.IllegalArgumentException - if any of the first three arguments are null.
      • GliderImage

        public GliderImage​(java.lang.String name,
                           java.lang.Object imageSource,
                           java.lang.Iterable<? extends LatLon> corners,
                           double altitude)
        Construct an image from a file or BufferedImage and an arbitrary bounding region.
        Parameters:
        name - A unique name to identify the image. If the image source is a file, the file path can be used as the name.
        imageSource - Either the file path to the source image or a reference to the BufferedImage containing it. Images can be any of those supported by ImageIO, as well as uncompressed TIFF images.
        corners - The lat/lon locations of the region in which to map the image. The image will be stretched as necessary to fully fill the region. The locations must be specified in counterclockwise order beginning with the lower-left image corner.
        altitude - The altitude at which to display the image. Specify 0 to have the image draped over the globe's surface.
        Throws:
        java.lang.IllegalArgumentException - if any of the first three arguments are null.
    • Method Detail

      • releaseImageSource

        public void releaseImageSource()
      • getName

        public java.lang.String getName()
        Returns the name of the image, as specified at construction. If no name was specified at construction the name is that of the image file path.
        Returns:
        the image name.
      • getSector

        public Sector getSector()
        Return the image's location.
        Returns:
        the image's location.
      • getCorners

        public java.util.List<LatLon> getCorners()
      • getAltitude

        public double getAltitude()
        Return the image's altitude.
        Returns:
        the image's altitude.
      • getImageSource

        public java.lang.Object getImageSource()
        Returns the image source.
        Returns:
        the image source.
      • getOpacity

        public double getOpacity()
      • setOpacity

        public void setOpacity​(double opacity)
      • addRegionOfInterest

        public void addRegionOfInterest​(GliderRegionOfInterest region)
        Adds a region of interest to display on the image.
        Parameters:
        region - the region of interest to add.
        Throws:
        java.lang.IllegalArgumentException - if region is null.
      • removeRegionOfInterest

        public void removeRegionOfInterest​(GliderRegionOfInterest region)
        Removes a region of interest.
        Parameters:
        region - the region of interest to remove.
        Throws:
        java.lang.IllegalArgumentException - if region is null.
      • alignImage

        public static ImageUtil.AlignedImage alignImage​(java.awt.image.BufferedImage sourceImage,
                                                        float[] latitudes,
                                                        float[] longitudes)
                                                 throws java.lang.InterruptedException
        Reprojects an image into an aligned image, one with edges of constant latitude and longitude.
        Parameters:
        sourceImage - the image to reproject, typically a non-aligned image
        latitudes - an array identifying the latitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
        longitudes - an array identifying the longitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
        Returns:
        a new image containing the original image but reprojected to align to the sector. Pixels in the new image that have no correspondence with the source image are transparent.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread while alignImage is running. The interrupted status of the current thread is cleared when this exception is thrown.
      • alignImageDump

        public static void alignImageDump​(java.awt.image.BufferedImage sourceImage,
                                          float[] latitudes,
                                          float[] longitudes)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object