|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PIRL.Image_Tools.Projection
public class Projection
A Projection is used to algorithmically map, or "project", from one image coordinate system to another while maintaining the spatial relationships of all coordinates.
Spatial projections are used in many contexts. The typical example is when a camera image of curved surface is to be mapped as if the surface were flat. The commonly known Mercator projection of a map of the Earth is such a projection. There are many map projections. See Snyder, John P., "Map Projections - A Working Manual", U.S Geological Survey Professional Paper 1395, 1987 for a discussion of the map projection algorithm used in these classes.
The core projection characteristic is an algorithm that maps coordinates from one coordinate system to another. The specific projection algorithms used - the implementation of a set of equations - will, of course, vary from one type of projection to another to achieve the desired mapping effect. In addition, the choice of projection is likey to depend on the range of coordinate values to be mapped - projections are likely to have increasing visual distortion effects as boundary conditions are approached - or the accuracy to be achieved - the implementing equations are like to make various simplifying assumptions. Nevertheless, all projections are expected to map coordinates between image and world coordinate systems. The former is in image pixel units of sample - horizontal distance from the left-most pixel - and and line - vertical distance from the top-most line - of a rectangular array of pixels. The latter is typically in planetary longitude - angular angular distance about the center of the planet relative to a zero-reference longitude - and latitude - angular angular distance about the center of the planet relative to the equator - usually measured in decimal degrees. However, other "world" coordinate systems are quite possible. In order to accommodate images of arbitrary location, an intermediate projeciton coordinate system is typically used by the projection equations, with a simple translational equation used to map between the projection coordinate system and the location of the image raster in that system.
A specific projection, implemented as a subclass of Projection, will require various parameters need by the projection equations. These are supplied by a PVL Parameter Aggregate. Because this Projection implementation assumes that planetary projections are to be implemented by subclasses, the Parameter group used to construct a Projection collects the common set of parameter values required by the specific projection algorithms. If all the required parameters are not provided the default identity projection - in which coordinate values are not changed - is used.
Constructor Summary | |
---|---|
Projection()
Constructs a default identity Projection. |
|
Projection(Parameter parameters)
Constructs a Projection from a Parameter Aggregate. |
Method Summary | |
---|---|
double |
Center_Latitude()
|
double |
Center_Longitude()
|
static Projection |
Create(Parameter parameters)
Creates a Projection object that uses an appropriate specific Projection subclass projection implementation. |
static double |
Decimal_Degrees(String parts)
|
static String |
Degrees_Minutes_Seconds(double angle)
Converts an angle in decimal degrees, to a degrees, minutes, seconds representation. |
double |
Eccentricity()
|
static double |
Eccentricity(double polar_radius,
double equitorial_radius)
Calculate the planet eccentricity. |
double |
Equitorial_Radius()
|
protected static Parameter |
Find_Parameter(Parameter label,
String name)
Find a named parameter in PDS label parameters. |
static String |
Hours_Minutes_Seconds(double angle)
Converts an angle in decimal degrees, to an hours, minutes, seconds representation. |
boolean |
Is_Identity()
|
double |
Line_Offset()
|
protected double |
Line_to_Projection_Y(double line)
|
double |
Local_Radius(double latitude)
Calculate the radius of the planet at some latitude. |
static void |
main(String[] args)
|
String |
Name()
|
double |
Planetocentric_to_Planetographic(double latitude)
Convert planetocentric latitude to planetographic latitude. |
boolean |
Planetocentric()
|
Projection |
Planetocentric(boolean planetocentric)
|
double |
Planetographic_to_Planetocentric(double latitude)
Convert planetographic latitude to planetocentric latitude. |
double |
Polar_Radius()
|
boolean |
Positive_West()
|
Projection |
Positive_West(boolean positive_west)
|
static String |
Projection_Class_Name(String projection_name)
Produce a class name for a projection name. |
protected double |
Projection_X_to_Sample(double projection_x)
|
protected double |
Projection_Y_to_Line(double projection_y)
|
double |
Resolution()
|
double |
Sample_Offset()
|
protected double |
Sample_to_Projection_X(double sample)
|
static double |
To_180(double longitude)
Ensure that a longitude value is in the range -180 to 180 degrees. |
static double |
To_360(double longitude)
Ensure that a longitude value is in the range 0 to 360 degrees. |
Point |
to_Image(Point2D world_coordinate)
Get the image sample,line coordinate for a world longitude,latitude coordinate. |
Point2D.Double |
to_World(Point2D image_coordinate)
Get the world longitude,latitude coordinate for an image sample.line coordinate. |
static void |
Usage()
|
static boolean |
Use_Spherical(boolean enabled)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String PROJECTION_PARAMETER_NAME
public static final String EQUIRECTANGULAR_PROJECTION_NAME
public static final String POLAR_STEREOGRAPHIC_PROJECTION_NAME
public static final String POLARSTEREOGRAPHIC_PROJECTION_NAME
public static final String PROJECTION_LATITUDE_PARAMETER_NAME
public static final String PLANETOCENTRIC_PROJECTION_NAME
public static final String EQUITORIAL_RADIUS_PARAMETER_NAME
public static final String POLAR_RADIUS_PARAMETER_NAME
public static final String METERS_PER_PIXEL_PARAMETER_NAME
public static final String POSITIVE_LONGITUDE_PARAMETER_NAME
public static final String POSITIVE_LONGITUDE_EAST_NAME
public static final String POSITIVE_LONGITUDE_WEST_NAME
public static final String CENTER_LATITUDE_PARAMETER_NAME
public static final String CENTER_LONGITUDE_PARAMETER_NAME
public static final String SAMPLE_OFFSET_PARAMETER_NAME
public static final String LINE_OFFSET_PARAMETER_NAME
public static final String NOT_APPLICABLE_CONSTANT_PARAMETER_NAME
protected boolean Not_Identity
protected boolean Positive_West
protected boolean Planetocentric
public static final double DEFAULT_NA
protected double Meters_per_Pixel
protected double Equitorial_Radius
protected double Polar_Radius
protected double NA
protected double Center_Latitude
protected double Center_Longitude
protected double Sample_Offset
protected double Line_Offset
protected double Eccentricity
public static final double PI_OVER_2
public static final double PI_OVER_4
public static final double DBL_EPSILON
public static final boolean DEFAULT_USE_SPHERICAL
Constructor Detail |
---|
public Projection(Parameter parameters) throws PVL_Exception
parameters
- The Parameter Aggregate containing (at least) the
minimally required parameter values. If all required parameters
are not provided - including if the argument is null - the identity projection flag
is set.
PVL_Exception
- If there is a problem reading the parameters
or a parameter is found to have an invalid value.public Projection()
The identity projection flag
is set.
Method Detail |
---|
public static Projection Create(Parameter parameters) throws PVL_Exception, NoSuchElementException, UnsupportedOperationException, Throwable
The choice of specific projection implementation is based on the
value of the Parameter having the PROJECTION_PARAMETER_NAME
.
This name is used to assemble a projection specific class name
to be loaded. Once loaded, a new
instance is constructed using the parameters argument.
As a special case, if the projection name is POLAR_STEREOGRAPHIC_PROJECTION_NAME
the "_Spherical" suffix is
appended if Use_Spherical(boolean)
is enabled so the faster but
slightly less accurate spherical form of the projection will be used;
otherwise the "_Elliptical" suffix is appended so the elliptical form
will be used. Also, if the name is POLARSTEREOGRAPHIC_PROJECTION_NAME
it will be converted to the
POLAR_STEREOGRAPHIC_PROJECTION_NAME
parameters
- The Parameter Aggregate containing the projection
definition parameter values. These parameters will be passed to
the specific projection class to be constructed. If null, not an
Aggregate Parameter, or there is no PROJECTION_PARAMETER_NAME
parameter a default Projection is
constructed which will have the identity
projection flag
set.
PVL_Exception
- If there is a problem reading the parameters
or a parameter is found to have an invalid value.
NoSuchElementException
- If any required parameter was missing
from the provided parameters.
UnsupportedOperationException
- If the expected Projection
subclass could not be loaded or instantiated.
Throwable
- If the constructor of the loaded projection class
throws an unexpected exception.Equirectangular_Projection
,
Polar_Stereographic_Elliptical_Projection
,
Polar_Stereographic_Spherical_Projection
public String Name()
public boolean Is_Identity()
public double Resolution()
public double Equitorial_Radius()
public double Polar_Radius()
public double Eccentricity()
public double Sample_Offset()
public double Line_Offset()
public boolean Positive_West()
public Projection Positive_West(boolean positive_west)
public boolean Planetocentric()
public Projection Planetocentric(boolean planetocentric)
public double Center_Latitude()
public double Center_Longitude()
public static boolean Use_Spherical(boolean enabled)
public Point2D.Double to_World(Point2D image_coordinate)
This method simply returns a copy of the coordinate argument. A projection specific subclass will override this method.
image_coordinate
- The image sample,line coordinate.
public Point to_Image(Point2D world_coordinate)
This method simply returns a copy of the coordinate argument. A projection specific subclass will override this method.
world_coordinate
- The world longitude,latitude coordinate.
public static String Degrees_Minutes_Seconds(double angle)
The format of the degrees, minutes, seconds String representation is:
angle
- The angle in degrees to be represented.
public static String Hours_Minutes_Seconds(double angle)
The format of the hours, minutes, seconds String representation is:
angle
- The angle in degrees to be represented.
public static double Decimal_Degrees(String parts) throws IllegalArgumentException, NumberFormatException
IllegalArgumentException
NumberFormatException
public double Planetocentric_to_Planetographic(double latitude)
latitude
- The latitude, in radians, to convert.
public double Planetographic_to_Planetocentric(double latitude)
latitude
- The latitude, in radians, to convert.
protected double Projection_X_to_Sample(double projection_x)
protected double Projection_Y_to_Line(double projection_y)
protected double Sample_to_Projection_X(double sample)
protected double Line_to_Projection_Y(double line)
public static double Eccentricity(double polar_radius, double equitorial_radius)
E = sqrt (1 - polar_radius**2 / equitorial_radius**2)
equitorial_radius
- The planet equitorial radius.polar_radius
- The planet polar radius.
public double Local_Radius(double latitude)
R = Re * Rp / sqrt (a**2 + b**2)where:
Re =Equitorial_Radius
Rp =Polar_Radius
a = Re * sin (latitude)
b = Rp * cos (latitude)
latitude
- The latitude, in radians, at which the local
radius is to be calculated.
public static double To_360(double longitude)
A negative longitude value is repeatedly increased by 360 until it is no longer negative. A longitude value greater than or equal to 360 is repeatedly decreased by 360 until it is less than 360.
longitude
- The longitude value to map to the 0 to 360 degree
domain.
public static double To_180(double longitude)
A longitude value less than -180 is repeatedly increased by 360 until it is greater than or equal to -180. A longitude value greater than or equal to 180 is repeatedly decreased by 360 until it is less than 180.
longitude
- The longitude value to map to the -180 to 180
degree domain.
public static String Projection_Class_Name(String projection_name)
The projection name is first trimmed of leading and trailing whitespace and all characters are set to lowercase. If the result starts with "polar" but is not followed by a space (' ') or underbar ('_') character an underbar is inserted following the "polar" prefix. Then any remaining space characters are changed to '_' characters. The first character and every character following an underbar character is set to uppercase. Finally the "_Projection" String is appended.
projection_name
- The projection name String.
protected static Parameter Find_Parameter(Parameter label, String name) throws NoSuchElementException
label
- The PDS label parameters.name
- The name of the parameter to find.
NoSuchElementException
- If the parameter was not found.public static void main(String[] args)
public static void Usage()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |