HiRISE

HiRISE.HiCat.HiTList
Class Region_Of_Interest

java.lang.Object
  extended by HiRISE.HiCat.HiTList.Region_Of_Interest

public class Region_Of_Interest
extends Object

Region_Of_Interest : A small class for manipulating Region Of Interest strings from HiCat. The format of an roi string is a comma separated list of numbers. Elements of the list are paired up in order such that each pair in the list defines a vertex in the region of interest. For example, the first pair of numbers in the list indicates the longitude and latitude of the first vertex respectively. The next pair of numbers defines the second vertex, and so on. These vertices are planetocentric coordinates in HiCat, so the constructor of this class expects the input string to also contain a list of planetocentric coordinates.

Version:
1.29
Author:
Rodney Heyd UA/PIRL

Field Summary
static String ID
          Class identification name with source code version and date.
 
Constructor Summary
Region_Of_Interest(String planetocentric_roi)
          Construct a new region of interest object.
 
Method Summary
 String cipp_vertices()
          Get the region of interest formatted as expected for CIPP output, longitude first, latitude second in planetographic coordinates.
 boolean Contains(double longitude, double latitude, boolean shift_longitude_domain)
          A containment test, to see if a given point lies within the region of interest.
 Point2D getCenter()
          Get the center coordinates of the ROI.
 String getWKT180180CenterPoint()
           
static void main(String[] args)
          A very simple main method for testing the class functionality.
 double Maximum_Longitude(boolean shift_longitude_domain)
          Get the maximum longitude of the Region of Interest
 double Maximum_Planetocentic_Latitude()
          Get the maximum planetocentric latitude of the Region of Interest
 double Minimum_Longitude(boolean shift_longitude_domain)
          Get the minimum longitude of the Region of Interest
 double Minimum_Planetocentric_Latitude()
          Get the minimum planetocentric latitude of the Region of Interest
 String Planetocentric_ROI_String()
          Return the region of interest vertexes in planetocentric coordinates as a comma separated string of coordinates.
 Vector<Vector<Double>> planetocentricROIVector()
          Return the ROI as a vector of vectors in planetocentric coordinates.
 String Planetographic_ROI_String()
          Return the region of interest vertexes in planetographic coordinates as a comma separated string of coordinates.
 Vector<Vector<Double>> planetographicROIVector()
          Return the ROI as vector of vectors in planetographic coordinates.
 boolean redundantPointsRemoved()
          Indicates if any points were removed from the getCenter() calculation due to being below the separationThreshold
 double ROI_Area()
          Get the area of the ROI, unsigned.
 Vector<Double> ROI_Centroid()
          Get the centroid coordinates of the Region Of Interest.
 boolean ROI_Crosses_0_Longitude()
          A test to determine if an ROI crosses 0 degrees longitude.
static String roi_string(Vector<Vector<Double>> vertices)
          Convert the given vector into an ROI string suitable for input into the ROI_VERTICES field in Suggested_Observations.
 String roif_polygon()
          Get the region of interest vertexes formatted for a region of interest file (roif)
 Vector<Vector<Double>> shift_longitude_domain(Vector<Vector<Double>> roi)
          This method will shift an roi from the 0,360 longitude domain to the -180,180 longitude domain.
 Region_Of_Interest shift(double longitude_shift, double latitude_shift)
          Shift the region of interest by the amount specified by the method arguments, and return a shifted Region_Of_Interest.
 double Signed_ROI_Area()
          Get the signed area of the ROI.
 String toString()
           
 String WKT_180180_Centroid_Point()
          Get the "Well Known Text" (WKT) representation of the centroid converted to 180,-180 longitude format.
 String WKT_180180_ROI_Polygon()
          Get the "Well Known Text" (WKT) representation of the region of interest polygon converted to 180,-180 longitude foramt.
 String WKT_Centroid_Point()
          Get the "Well Known Text" (WKT) representation of the centroid.
 String WKT_ROI_Polygon()
          Get the "Well Known Text" (WKT) representation of the region of interest polygon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values
Constructor Detail

Region_Of_Interest

public Region_Of_Interest(String planetocentric_roi)
Construct a new region of interest object. The coordinates of the input string should be planetocentric.

Method Detail

ROI_Crosses_0_Longitude

public boolean ROI_Crosses_0_Longitude()
A test to determine if an ROI crosses 0 degrees longitude. Note: this test isn't necessarily foolproof, especially if the ROI is close to the poles.

Returns:
a boolean indicating if the ROI crosses 0 degrees longitude.

roi_string

public static String roi_string(Vector<Vector<Double>> vertices)
Convert the given vector into an ROI string suitable for input into the ROI_VERTICES field in Suggested_Observations.

Parameters:
vertices - A Vector of Vectors containing longitude and latitude pairs
Returns:
returns a string conversion of the supplied vector.

shift

public Region_Of_Interest shift(double longitude_shift,
                                double latitude_shift)
Shift the region of interest by the amount specified by the method arguments, and return a shifted Region_Of_Interest.

Parameters:
longitude_shift - The amount of longitude each point should be shifted
latitude_shift - The amount of latitude each point should be shifted
Returns:
a shifted Region_Of_Interest

shift_longitude_domain

public Vector<Vector<Double>> shift_longitude_domain(Vector<Vector<Double>> roi)
This method will shift an roi from the 0,360 longitude domain to the -180,180 longitude domain.

Parameters:
roi -
Returns:
a Vector of Vector's containing the shifted longitudes. The longitude value is the 0th element of the Vector and the 1 element is the latitude.

Minimum_Longitude

public double Minimum_Longitude(boolean shift_longitude_domain)
Get the minimum longitude of the Region of Interest

Parameters:
shift_longitude_domain - - a boolean indicating if the longitude domain should be shifted into the -180 to 180 domain prior to determining the minimum longitude value.
Returns:
A double precision number that is the minimum longitude in the roi.

Maximum_Longitude

public double Maximum_Longitude(boolean shift_longitude_domain)
Get the maximum longitude of the Region of Interest

Parameters:
shift_longitude_domain - - a boolean indicating if the longitude domain should be shifted into the -180 to 180 domain prior to determining the minimum longitude value.
Returns:
A double precision number that is the maximum longitude in the roi.

Minimum_Planetocentric_Latitude

public double Minimum_Planetocentric_Latitude()
Get the minimum planetocentric latitude of the Region of Interest

Returns:
A double precision number that is the minimum latitude in the roi.

Maximum_Planetocentic_Latitude

public double Maximum_Planetocentic_Latitude()
Get the maximum planetocentric latitude of the Region of Interest

Returns:
A double precision number that is the maximum latitude in the roi.

Signed_ROI_Area

public double Signed_ROI_Area()
Get the signed area of the ROI. Note: This uses Green's theorem to calculate the area, so depending on the ordering of the points, the area could be negative.

Returns:
a double value containing the signed area of the polygon.

ROI_Area

public double ROI_Area()
Get the area of the ROI, unsigned.

Returns:
a double value containing the area of the polygon.
See Also:
Signed_ROI_Area()

ROI_Centroid

public Vector<Double> ROI_Centroid()
Get the centroid coordinates of the Region Of Interest. Within HiCat, the "center" coordinates are actually the centroid of the ROI.

Returns:
a Vector. The first element is the longitude coordinate of the centroid, the second element is the latitude coordinate of the centroid.

getCenter

public Point2D getCenter()
Get the center coordinates of the ROI. This method utilizes JMars' capability for working with shapes to compute the center coordinates.

Returns:
a Vector of two Doubles. The first is the longitude, the second is the latitude.

redundantPointsRemoved

public boolean redundantPointsRemoved()
Indicates if any points were removed from the getCenter() calculation due to being below the separationThreshold

Returns:
true if points were removed, false otherwise

getWKT180180CenterPoint

public String getWKT180180CenterPoint()

WKT_Centroid_Point

public String WKT_Centroid_Point()
Get the "Well Known Text" (WKT) representation of the centroid. In this case the returned string will be formatted like so: "POINT(Longitude Latitude)" Note the lack of a comma between the Longitude and Latitude. The point returned will be in planetocentric coordinates. The WKT format is part of the OpenGIS standard.

Returns:
a WKT point string

WKT_180180_Centroid_Point

public String WKT_180180_Centroid_Point()
Get the "Well Known Text" (WKT) representation of the centroid converted to 180,-180 longitude format. In this case the returned string will be formatted like so: "POINT(Longitude Latitude)" Note the lack of a comma between the Longitude and Latitude. The point returned will be in planetocentric coordinates. The WKT format is part of the OpenGIS standard.

Returns:
a WKT point string

WKT_ROI_Polygon

public String WKT_ROI_Polygon()
Get the "Well Known Text" (WKT) representation of the region of interest polygon. The text representation will be of the form: "Polygon((long1 lat1, long2 lat2, ...., longN latN))"

Returns:
a string containing the WKT representation of the region of interest.

WKT_180180_ROI_Polygon

public String WKT_180180_ROI_Polygon()
Get the "Well Known Text" (WKT) representation of the region of interest polygon converted to 180,-180 longitude foramt. The text representation will be of the form: "Polygon((long1 lat1, long2 lat2, ...., longN latN))"

Returns:
a string containing the WKT representation of the region of interest.

Planetocentric_ROI_String

public String Planetocentric_ROI_String()
Return the region of interest vertexes in planetocentric coordinates as a comma separated string of coordinates. The first pair of coordinates will be the longitude and latitude of the first vertex, and the rest of the vertexes will follow in the same fashion.

Returns:
a string of coordinates, longitude first, latitude second.

Planetographic_ROI_String

public String Planetographic_ROI_String()
Return the region of interest vertexes in planetographic coordinates as a comma separated string of coordinates. The first pair of coordinates will be the longitude and latitude of the first vertex, and the rest of the vertexes will follow in the same fashion.

Returns:
a string of coordinate pairs, longitude first, latitude second.

roif_polygon

public String roif_polygon()
Get the region of interest vertexes formatted for a region of interest file (roif)

Returns:
A string formatted similarly to the Planetocentric and Planetographic ROI string methods, except the ordering of the longitude and latitude is reversed. Latitutude is first, longitude second. The latitudes are output in planetographic.

planetocentricROIVector

public Vector<Vector<Double>> planetocentricROIVector()
Return the ROI as a vector of vectors in planetocentric coordinates. Each Vector element of the return vector is the coordinates of a vertex in the polygon. The first element is the longitude of the vertex and the second element is the latitude.

Returns:
a Vector> containing the vertexes of the ROI polygon.

planetographicROIVector

public Vector<Vector<Double>> planetographicROIVector()
Return the ROI as vector of vectors in planetographic coordinates. Each Vector element of the return vector is the coordinates of a vertex in the polygon. The first element is the longitude of the vertex and the second element is the latitude.

Returns:
a Vector> containing the vertexes of the ROI polygon.

cipp_vertices

public String cipp_vertices()
Get the region of interest formatted as expected for CIPP output, longitude first, latitude second in planetographic coordinates.

Returns:
a cipp formatted region of interest string.

toString

public String toString()
Overrides:
toString in class Object

Contains

public boolean Contains(double longitude,
                        double latitude,
                        boolean shift_longitude_domain)
A containment test, to see if a given point lies within the region of interest.

Parameters:
longitude - of the test point
latitude - of the test point
shift_longitude_domain - should the longitude domain be shifted from 0-360 to -180-180, useful if the roi straddles 0 degrees longitude.
Returns:
true if the test point lies within the roi, otherwise false

main

public static void main(String[] args)
A very simple main method for testing the class functionality.


HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona