Package gov.nasa.worldwind.util
Class GeographicImageInterpolator
- java.lang.Object
-
- gov.nasa.worldwind.util.ImageInterpolator
-
- gov.nasa.worldwind.util.GeographicImageInterpolator
-
public class GeographicImageInterpolator extends ImageInterpolator
GeographicImageInterpolator extends the functionality ofImageInterpolator
to correctly map from geographic coordinates to image coordinates. Unlike its superclass, which works in Cartesian coordinates, GeographicImageInterpolator handles the singularities of geographic coordinates. For example, GeographicImageInterpolator can map images which cross the international dateline.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GeographicImageInterpolator.GeographicCell
GeographicCell extendsImageInterpolator.Cell
to correctly handle image cells which have geographic coordinates.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.util.ImageInterpolator
ImageInterpolator.Cell, ImageInterpolator.ContainingCell
-
-
Constructor Summary
Constructors Constructor Description GeographicImageInterpolator(java.awt.Dimension gridSize, float[] xs, float[] ys, int depth, int cellSize)
Creates a new GeographicImageInterpolator, initializing this interpolator's internal image cell tree with root cell dimensions of(gridSize.width * gridSize.height)
and with the specifieddepth
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double[]
computeBilinearCoordinates(float x, float y, ImageInterpolator.Cell cell)
Overridden to correctly compute bilinear interpolation coordinates for image cells which cross the international dateline.Sector
getSector()
Returns the sector containing the image's geographic coordinates.protected ImageInterpolator.Cell
makeRootCell(int m0, int m1, int n0, int n1)
Overridden to create aGeographicImageInterpolator.GeographicCell
.-
Methods inherited from class gov.nasa.worldwind.util.ImageInterpolator
checkContainment, findContainingCell, findContainingCell, getFieldIndices
-
-
-
-
Constructor Detail
-
GeographicImageInterpolator
public GeographicImageInterpolator(java.awt.Dimension gridSize, float[] xs, float[] ys, int depth, int cellSize)
Creates a new GeographicImageInterpolator, initializing this interpolator's internal image cell tree with root cell dimensions of(gridSize.width * gridSize.height)
and with the specifieddepth
.- Parameters:
gridSize
- the image's dimensions.xs
- the x-coordinates of the image's pixels. Must contain at leastgridSize.width * gridSize.height
elements.ys
- the y-coordinates of the image's pixels. Must contain at leastgridSize.width * gridSize.height
elements.depth
- the initial depth of this interpolator's image cell tree.cellSize
- the size of a leaf cell in this interpolator's image cell tree, in pixels.- Throws:
java.lang.IllegalStateException
- if any of the the gridSize, x-coordinates, or y-coordinates are null, if either the x-coordinates or y-coordinates contain less thangridSize.width * gridSize.height
elements, if the depth is less than zero, or if the cell size is less than one.
-
-
Method Detail
-
makeRootCell
protected ImageInterpolator.Cell makeRootCell(int m0, int m1, int n0, int n1)
Overridden to create aGeographicImageInterpolator.GeographicCell
.- Overrides:
makeRootCell
in classImageInterpolator
- Parameters:
m0
- the root cell's left image coordinate.m1
- the root cell's right image coordinate.n0
- the root cell's bottom image coordinate.n1
- the root cell's top image coordinate.- Returns:
- a new GeographicCell with the specified image coordinates.
-
getSector
public Sector getSector()
Returns the sector containing the image's geographic coordinates. This returns a sector which spans the longitude range [-180, 180] if the image crosses the international dateline.- Returns:
- the image's bounding sector.
-
computeBilinearCoordinates
protected double[] computeBilinearCoordinates(float x, float y, ImageInterpolator.Cell cell)
Overridden to correctly compute bilinear interpolation coordinates for image cells which cross the international dateline. If the specified cell does not cross the dateline, this invokes the superclass' functionality. This returns null if the specified (x, y) point does not intersect the cell.- Overrides:
computeBilinearCoordinates
in classImageInterpolator
- Parameters:
x
- the x-component of the point to compute bilinear coordinate for.y
- the y-component of the point to compute bilinear coordinate for.cell
- the cell to compute bilinear coordinates for.- Returns:
- the bilinear coordinates of the specified (x, y) point in the specified cell, or null if the point does not intersect the cell.
-
-