|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ka2ddo.yaac.gui.rastermap.RasterMapEntry
public class RasterMapEntry
This class describes one raster map image file and the translation information needed to render it on the screen with the correct registration.
Because of the distortion caused by projecting a nearly-spherical Earth onto a
flat map panel view, the image re-registration algorithm assumes a trapezoidal
distortion as a good-enough approximation for rasters in units of meters (or other linear length),
so the Java AffineTransform is insufficient
to project raster map images into the map viewport. Instead, the following equations
are used to map viewport pixel coordinates into raster map image pixel coordinates:
xi = x0 + x1 * xv + x2 * yv + x3 * xv * yv
yi = y0 + y1 * yv + y2 * xv + y3 * yv * xv
To compute the coefficients of the above equations, the least squares method is used to fit a series of pinpoints (associations between image pixels and geographical map coordinates) into the mapping between viewport pixel coordinates and image pixel coordinates.
If the raster image pixel step is in units of fractional degrees (for example, US National Weather Service radar maps), the full Mercator projection is needed to convert between degree-based image coordinates and linear pixel-based viewport coordinates.
xi = x0 + x1 * xv
yi = y0 + y1 * atan(sinh(y3 * yv + y2))
and, unlike the linear formula, the Mercator formula does not
allow for any relative rotation of coordinate systems.
Nested Class Summary | |
---|---|
static class |
RasterMapEntry.PinPoint
This class contains one association between a pixel in the image and its latitude/longitude position on the planet. |
Field Summary | |
---|---|
boolean |
enabled
Flag indicating whether this particular raster overlay should be displayed in the map. |
int |
height
Height of raster image in pixels. |
java.awt.image.BufferedImage |
img
The image as a renderable object (assuming it can be loaded successfully). |
java.util.Date |
imgCreationDate
Timestamp when the image was created (used to detect an updated image for automatic refreshing). |
boolean |
isLinear
Indicates that the steps between pixels are in units of linear distance (meters), rather than in angular distance (degrees) across the approximately spherical Earth. |
java.lang.String |
pathname
Pathname to where the image file is stored on this computer. |
java.util.ArrayList<RasterMapEntry.PinPoint> |
pinpointList
The list of PinPoints matching image pixels with global lat/lon positions. |
int |
transparency
The level of transparency fading to apply to the raster map (alpha component). |
java.awt.Color |
transparentColor
The color of the raster image that is to be replaced with full transparency, so the map behind the raster image can still be seen. |
int |
width
Width of raster image in pixels. |
Constructor Summary | |
---|---|
RasterMapEntry()
|
Method Summary | |
---|---|
void |
computeTransform(Projection proj)
|
RasterMapEntry.PinPoint |
getPinPointAt(int vx,
int vy,
Projection proj)
Find which (if any) PinPoint that the specified viewport coordinates are upon. |
java.awt.geom.Rectangle2D.Float |
getViewportBounds2DOfImage(int vWidth,
int vHeight,
Mercator projection)
Get the coordinates within the viewport that intersect the raster image. |
void |
read(java.io.DataInput dis)
Read a serialized dump of this object from an input stream for restoration. |
java.lang.String |
toString()
Returns a string representation of the object. |
java.awt.geom.Point2D.Float |
transformImageToViewport(float xi,
float yi,
java.awt.geom.Point2D.Float dstPt,
Mercator projection)
Convert coordinates within an image into viewport coordinates. |
java.awt.geom.Point2D.Float |
transformViewportToImage(float vx,
float vy,
java.awt.geom.Point2D.Float dstPt,
Mercator projection)
Convert viewport coordinates into a position within the raster image. |
void |
write(java.io.DataOutput dos)
Write a serialized dump of this object to an output stream for storage and later restoration. |
void |
writeToPreferences(java.util.prefs.Preferences prefs)
Write a serialized dump of this object to Java Preferences. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String pathname
public transient java.awt.image.BufferedImage img
public int width
public int height
public java.awt.Color transparentColor
public int transparency
public boolean enabled
public transient java.util.Date imgCreationDate
public boolean isLinear
public final java.util.ArrayList<RasterMapEntry.PinPoint> pinpointList
Constructor Detail |
---|
public RasterMapEntry()
Method Detail |
---|
public void computeTransform(Projection proj)
public java.awt.geom.Point2D.Float transformViewportToImage(float vx, float vy, java.awt.geom.Point2D.Float dstPt, Mercator projection)
vx
- X coordinate of point in the viewportvy
- Y coordinate of point in the viewportdstPt
- Point2D.Float object to contain the answer, or null to allocate a new Point2D.Float objectprojection
- Mercator projection used to translate coordinates (only needed for degree-scaled rasters)
public java.awt.geom.Point2D.Float transformImageToViewport(float xi, float yi, java.awt.geom.Point2D.Float dstPt, Mercator projection)
xi
- X coordinate of pixel within the raster imageyi
- Y coordinate of pixel within the raster imagedstPt
- Point2D.Float object to contain the answer, or null to allocate a new Point2D.Float objectprojection
- Mercator projection used to translate coordinates (only needed for degree-scaled rasters)
public java.awt.geom.Rectangle2D.Float getViewportBounds2DOfImage(int vWidth, int vHeight, Mercator projection)
vWidth
- viewport width in pixelsvHeight
- viewport height in pixelsprojection
- Mercator projection used to translate coordinates (only needed for degree-scaled rasters)
public RasterMapEntry.PinPoint getPinPointAt(int vx, int vy, Projection proj)
vx
- viewport X coordinatevy
- viewport Y coordinateproj
- Projection of the current viewport
public void read(java.io.DataInput dis) throws java.io.IOException
dis
- DataInput object to read the object data from
java.io.IOException
- if read fails for any reasonpublic void write(java.io.DataOutput dos) throws java.io.IOException
dos
- DataOutput object to write the RasterMapEntry to
java.io.IOException
- if write fails for any reasonpublic void writeToPreferences(java.util.prefs.Preferences prefs)
prefs
- Preferences object to store this objectpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |