public abstract class MapProjection extends EarthTransform2D implements ProjectionConstants
MapProjection
class is the abstract parent of
all map projections that implement coordinate conversions for
the projection systems listed in ProjectionConstants
.Modifier and Type | Field and Description |
---|---|
protected Datum |
datum
The map projection datum.
|
static java.lang.String |
DESCRIPTION
Projection description string.
|
protected java.awt.geom.AffineTransform |
forwardAffine
Map
[x, y] to data [row, column] affine
transform. |
protected java.awt.geom.AffineTransform |
inverseAffine
Data
[row, column] to map [x, y] affine
transform. |
protected boolean |
positiveLon
The positive longitude flag for geographic projections, true to
convert longitudes to positive only in calls to
transform(EarthLocation).
|
protected int |
spheroid
The map projection spheroid code.
|
protected int |
system
The map projection system.
|
protected int |
zone
The map projection system zone.
|
dims
ALASKA, ALBERS, AZMEQD, EQRECT, EQUIDC, GEO, GNOMON, GOOD, GVNSP, HAMMER, HOM, IMOLL, LAMAZ, LAMCC, MAX_PROJECTIONS, MERCAT, MILLER, MOLL, OBEQA, ORTHO, POLYC, PROJECTION_NAMES, PS, ROBIN, SNSOID, SOM, SPCS, STEREO, TM, USDEF, UTM, VGRINT, WAGIV, WAGVII
AIRY, AUS_NAT, BESSEL, CLARKE1866, CLARKE1880, EVEREST, GRS1980, HOUGH, INT1909, INT1967, KRASS, MAX_SPHEROIDS, MERCURY1960, MOD_AIRY, MOD_EVEREST, MOD_MER1968, SE_ASIA, SPHERE, SPHEROID_INV_FLAT, SPHEROID_NAMES, SPHEROID_SEMI_MAJOR, SPHEROID_SEMI_MINOR, STD_RADIUS, WGS66, WGS72
Modifier | Constructor and Description |
---|---|
protected |
MapProjection(int system,
int zone,
int spheroid,
int[] dimensions,
java.awt.geom.AffineTransform affine)
Constructs a map projection from the specified projection and
affine transform.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this object.
|
java.lang.String |
describe()
Gets a string describing the earth transform type.
|
boolean |
equals(java.lang.Object obj)
Compares the specified object with this map projection for
equality.
|
java.awt.geom.AffineTransform |
getAffine()
Gets the data
[row, column] to map [x,
y] affine transform. |
Datum |
getDatum()
Gets the projection datum.
|
MapProjection |
getModified(EarthLocation centerLoc,
double[] pixelDims)
Gets a modified version of this map projection.
|
double[] |
getParameters()
Gets a set of GCTP-style projection parameters if available.
|
double[] |
getPixelDimensions()
Gets the pixel dimensions.
|
double |
getPixelSize()
Gets the pixel size indicated by the affine transform.
|
static int |
getProjection(java.lang.String name)
Gets the projection system that matches the specified name.
|
int |
getSpheroid()
Gets the projection spheroid code.
|
java.lang.String |
getSpheroidName()
Gets the projection spheroid name.
|
EarthTransform |
getSubset(DataLocation newOrigin,
int[] newDims)
Creates a subset version of this map projection.
|
MapProjection |
getSubset(int[] start,
int[] stride,
int[] length)
Creates a subset version of this map projection.
|
int |
getSystem()
Gets the projection system.
|
java.lang.String |
getSystemName()
Gets the projection system name.
|
int |
getZone()
Gets the projection zone.
|
boolean |
isOrientable()
Gets the orientation hint.
|
abstract void |
mapTransformFor(double[] lonLat,
double[] xy)
Performs a forward map transformation from (latitude,
longitude) coordinates to map (x, y).
|
abstract void |
mapTransformInv(double[] xy,
double[] lonLat)
Performs an inverse map transformation from map (x, y)
coordinates to (latitude, longitude).
|
protected void |
setAffine(EarthLocation centerLoc,
double[] pixelDims)
Sets the affines for this projection based on center and pixel
dimensions.
|
void |
setPositiveLon(boolean flag)
Sets the positive longitude flag for geographic projections.
|
protected void |
transformImpl(DataLocation dataLoc,
EarthLocation earthLoc)
Implements the data to geographic transform.
|
protected void |
transformImpl(EarthLocation earthLoc,
DataLocation dataLoc)
Implements the geographic to data transform.
|
get2DVersion, getBoundingBox, getWorldAxes, main, setPointTransform, transformToPoint
distance, getDimensions, getResolution, getSpheroid, getSpheroid, transform, transform, transform, transform
getMetadataMap
public static final java.lang.String DESCRIPTION
protected int system
protected int zone
protected int spheroid
protected java.awt.geom.AffineTransform inverseAffine
[row, column]
to map [x, y]
affine
transform.protected java.awt.geom.AffineTransform forwardAffine
[x, y]
to data [row, column]
affine
transform.protected Datum datum
protected boolean positiveLon
protected MapProjection(int system, int zone, int spheroid, int[] dimensions, java.awt.geom.AffineTransform affine) throws java.awt.geom.NoninvertibleTransformException
SpheroidConstants
and
ProjectionConstants
class should be consulted for
valid parameter constants.system
- the map projection system.zone
- the map projection zone for State Plane and UTM
projections.spheroid
- the spheroid code or -1 for user-defined.
If the spheroid is user-defined, the datum should be set
manually by the subclass.dimensions
- the dimensions of the data grid as [rows,
columns]
.affine
- the affine transform for translating data
[row, column]
to map [x, y]
.java.awt.geom.NoninvertibleTransformException
- if the map
projection to data coordinate affine transform is not
invertible.public boolean isOrientable()
EarthTransform2D
isOrientable
in class EarthTransform2D
public java.lang.String getSystemName()
public int getSystem()
public int getZone()
public java.lang.String getSpheroidName()
public int getSpheroid()
public Datum getDatum()
getDatum
in class EarthTransform
public java.awt.geom.AffineTransform getAffine()
[row, column]
to map [x,
y]
affine transform.public java.lang.String describe()
EarthTransform
describe
in class EarthTransform
public MapProjection getModified(EarthLocation centerLoc, double[] pixelDims) throws java.awt.geom.NoninvertibleTransformException
centerLoc
- the new earth center location of the map
center.pixelDims
- the new pixel dimensions in meters at the
projection reference point as [height, width]
.java.awt.geom.NoninvertibleTransformException
- if the map
projection to data coordinate affine transform is not
invertible.protected void setAffine(EarthLocation centerLoc, double[] pixelDims) throws java.awt.geom.NoninvertibleTransformException
centerLoc
- the earth location at the map center.pixelDims
- the pixel dimensions in meters at the projection
reference point as [height, width]
.java.awt.geom.NoninvertibleTransformException
- if the map
projection to data coordinate affine transform is not
invertible.public double getPixelSize()
public double[] getPixelDimensions()
[height, width]
.public EarthTransform getSubset(DataLocation newOrigin, int[] newDims)
getSubset
in class EarthTransform
newOrigin
- the new data location origin.newDims
- the new data location dimensions.EarthTransform.getSubset(noaa.coastwatch.util.DataLocation, int[])
public MapProjection getSubset(int[] start, int[] stride, int[] length)
start
- the 2D starting data coordinates.stride
- the 2D data stride.length
- the total number of values in each dimension.public java.lang.Object clone()
EarthTransform
clone
in class EarthTransform
protected void transformImpl(DataLocation dataLoc, EarthLocation earthLoc)
EarthTransform
transformImpl
in class EarthTransform
EarthTransform.transform(DataLocation,EarthLocation)
protected void transformImpl(EarthLocation earthLoc, DataLocation dataLoc)
EarthTransform
transformImpl
in class EarthTransform
EarthTransform.transform(EarthLocation,DataLocation)
public abstract void mapTransformFor(double[] lonLat, double[] xy)
lonLat
- the longitude and latitude in radians.xy
- the x and y in meters or Double.NaN if the
transform could not be computed (modified).public abstract void mapTransformInv(double[] xy, double[] lonLat)
xy
- the x and y in meters.lonLat
- the longitude and latitude in radians or Double.NaN
if the transform could not be computed (modified).public void setPositiveLon(boolean flag)
transform(EarthLocation)
. By default, the
positive longitude flag is false and longitudes are not modified.flag
- the positive longitude flag.public double[] getParameters()
java.lang.UnsupportedOperationException
- if the map projection
properties cannot be represented using GCTP parameters.public static int getProjection(java.lang.String name)
name
- the projection system name.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to be compared for equality.getParameters()