com.bbn.openmap.omGraphics.util
Class ImageWarp

java.lang.Object
  extended by com.bbn.openmap.omGraphics.util.ImageWarp

public class ImageWarp
extends java.lang.Object

The ImageTranslator is the object that takes a BufferedImage and creates an OMRaster from it based on a Projection object.


Field Summary
protected  GeoCoordTransformation geoTrans
          A transformation for the projection of the source image.
protected  double hor_upp
          Horizontal units/pixel in the source BufferedImage projection.
protected  double horOrigin
          The horizontal origin pixel location in the source image for the coordinate system origin.
protected  int iheight
          Image height,
protected  int iwidth
          Image width,
static java.util.logging.Logger logger
           
protected  int[] pixels
          Source image pixels.
protected  DataBounds projectedImageBounds
          The coordinate image bounds of the projected image on the map window.
protected  DataBounds sourceImageBounds
          The coordinate bounds of the image, represented in the coordinate system of the image.
protected  double ver_upp
          Vertical units/pixel in the source BufferedImage projection.
protected  double verOrigin
          The vertical origin pixel location in the source image for the coordinate system origin.
 
Constructor Summary
ImageWarp(java.awt.image.BufferedImage bi)
          Create an image warp for an image assumed to be world wide coverage, with the top at 90 degrees, the bottom at -90, the left side at -180 and the right side at 180.
ImageWarp(java.awt.image.BufferedImage bi, GeoCoordTransformation transform, DataBounds imageBounds)
          Create an image warp with some additional transform information.
ImageWarp(java.awt.image.BufferedImage bi, GeoCoordTransformation transform, WorldFile worldFile)
          Create an image warp with some additional transform information.
ImageWarp(int[] pix, int width, int height)
          Create an image warp for an image assumed to be world wide coverage, with the top at 90 degrees, the bottom at -90, the left side at -180 and the right side at 180.
ImageWarp(int[] pix, int width, int height, GeoCoordTransformation transform, DataBounds imageBounds)
          Create an image warp with some additional transform information.
ImageWarp(int[] pix, int width, int height, GeoCoordTransformation transform, WorldFile worldFile)
          Create an image warp with some additional transform information.
 
Method Summary
 DataBounds calculateProjectedImageBounds(Projection p)
          Returns the image bounds of the image as it would be warped to the provided projection.
 GeoCoordTransformation getGeoTrans()
           
 double getHor_dpp()
           
 double getHorOrigin()
           
 int getIheight()
           
 DataBounds getImageBounds()
           
 int[] getImagePixels(Projection p)
          Given a projection, return the pixels for an image that will cover the projection area.
 int getIwidth()
           
 OMRaster getOMRaster(Projection p)
          Return an OMRaster that covers the given projection, with the image warped for the projection.
protected  int[] getPixels(java.awt.Image img, int x, int y, int w, int h)
          Get the pixels from the BufferedImage.
 java.awt.Rectangle getProjectedImageBoundsForLastProjection()
          Convenience function to get projected image bounds for an image that has been warped for a given projection.
 double getVer_dpp()
           
 double getVerOrigin()
           
static void main(java.lang.String[] args)
           
 void setGeoTrans(GeoCoordTransformation geoTrans)
           
 void setHor_dpp(double hor_dpp)
           
 void setHorOrigin(double horOrigin)
           
 void setIheight(int iheight)
           
 void setImageBounds(DataBounds imageBounds)
           
 void setImageBounds(WorldFile worldFile)
           
 void setIwidth(int iwidth)
           
 void setVer_dpp(double ver_dpp)
           
 void setVerOrigin(double verOrigin)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger

pixels

protected int[] pixels
Source image pixels.


iwidth

protected int iwidth
Image width,


iheight

protected int iheight
Image height,


hor_upp

protected double hor_upp
Horizontal units/pixel in the source BufferedImage projection. Assumed to be constant across the image.


ver_upp

protected double ver_upp
Vertical units/pixel in the source BufferedImage projection. Assumed to be constant across the image.


verOrigin

protected double verOrigin
The vertical origin pixel location in the source image for the coordinate system origin.


horOrigin

protected double horOrigin
The horizontal origin pixel location in the source image for the coordinate system origin.


geoTrans

protected GeoCoordTransformation geoTrans
A transformation for the projection of the source image. If not set, the image is assumed to be equal arc projection.


sourceImageBounds

protected DataBounds sourceImageBounds
The coordinate bounds of the image, represented in the coordinate system of the image.


projectedImageBounds

protected DataBounds projectedImageBounds
The coordinate image bounds of the projected image on the map window.

Constructor Detail

ImageWarp

public ImageWarp(java.awt.image.BufferedImage bi)
Create an image warp for an image assumed to be world wide coverage, with the top at 90 degrees, the bottom at -90, the left side at -180 and the right side at 180. Assumes the origin point is in the middle of the image.


ImageWarp

public ImageWarp(java.awt.image.BufferedImage bi,
                 GeoCoordTransformation transform,
                 DataBounds imageBounds)
Create an image warp with some additional transform information.

Parameters:
bi - BufferedImage of the source
transform - the GeoCoordTransformation for the projection of the image.
imageBounds - the bounds of the image in the image's coordinate system.

ImageWarp

public ImageWarp(java.awt.image.BufferedImage bi,
                 GeoCoordTransformation transform,
                 WorldFile worldFile)
Create an image warp with some additional transform information.

Parameters:
bi - BufferedImage of the source
transform - the GeoCoordTransformation for the projection of the image.
worldFile - the WorldFile describing the image's location.

ImageWarp

public ImageWarp(int[] pix,
                 int width,
                 int height)
Create an image warp for an image assumed to be world wide coverage, with the top at 90 degrees, the bottom at -90, the left side at -180 and the right side at 180. Assumes the origin point is in the middle of the image.

Parameters:
pix - ARGB array of pixel values for image.
width - pixel width of image.
height - pixel height of image.

ImageWarp

public ImageWarp(int[] pix,
                 int width,
                 int height,
                 GeoCoordTransformation transform,
                 DataBounds imageBounds)
Create an image warp with some additional transform information.

Parameters:
pix - ARGB array of pixel values for image.
width - pixel width of image.
height - pixel height of image.
transform - the GeoCoordTransformation for the projection of the image.
imageBounds - the bounds of the image in the image's coordinate system.

ImageWarp

public ImageWarp(int[] pix,
                 int width,
                 int height,
                 GeoCoordTransformation transform,
                 WorldFile worldFile)
Create an image warp with some additional transform information.

Parameters:
pix - ARGB array of pixel values for image.
width - pixel width of image.
height - pixel height of image.
transform - the GeoCoordTransformation for the projection of the image.
worldFile - the WorldFile describing the image's location.
Method Detail

getOMRaster

public OMRaster getOMRaster(Projection p)
Return an OMRaster that covers the given projection, with the image warped for the projection.

Parameters:
p - map projection
Returns:
OMRaster or null if the image isn't within the current projection.

getImagePixels

public int[] getImagePixels(Projection p)
Given a projection, return the pixels for an image that will cover the projection area.

Parameters:
p - map projection
Returns:
int[] of ARGB pixels for an image covering the given projection.

calculateProjectedImageBounds

public DataBounds calculateProjectedImageBounds(Projection p)
Returns the image bounds of the image as it would be warped to the provided projection.

Parameters:
p - Projection the image will be displayed on
Returns:
DataBounds, in the projected coordinate space.

getProjectedImageBoundsForLastProjection

public java.awt.Rectangle getProjectedImageBoundsForLastProjection()
Convenience function to get projected image bounds for an image that has been warped for a given projection. If you've grabbed the pixel ints, this is how you get the projected image bounds for those ints.

Returns:
Rectangle for bounds

getPixels

protected int[] getPixels(java.awt.Image img,
                          int x,
                          int y,
                          int w,
                          int h)
Get the pixels from the BufferedImage. If anything goes wrong, returns a int[0].


getIwidth

public int getIwidth()

setIwidth

public void setIwidth(int iwidth)

getIheight

public int getIheight()

setIheight

public void setIheight(int iheight)

getHor_dpp

public double getHor_dpp()

setHor_dpp

public void setHor_dpp(double hor_dpp)

getVer_dpp

public double getVer_dpp()

setVer_dpp

public void setVer_dpp(double ver_dpp)

getVerOrigin

public double getVerOrigin()

setVerOrigin

public void setVerOrigin(double verOrigin)

getHorOrigin

public double getHorOrigin()

setHorOrigin

public void setHorOrigin(double horOrigin)

getGeoTrans

public GeoCoordTransformation getGeoTrans()

setGeoTrans

public void setGeoTrans(GeoCoordTransformation geoTrans)

getImageBounds

public DataBounds getImageBounds()

setImageBounds

public void setImageBounds(DataBounds imageBounds)

setImageBounds

public void setImageBounds(WorldFile worldFile)

main

public static void main(java.lang.String[] args)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details