public interface IlvCoordinateFormatter extends IlvPersistentObject
// Get an instance of IlvCoordinateFormatter. IlvCoordinateFormatter coordinateFormat = ...; // Set the longitude and latitude of the point to convert. coordinateFormat.setLonLat(Math.PI/4,Math.PI/4); // Print the string representing the point in the new coordinate system. System.out.println(coordinateFormat.toString()); ...Conversely, you would use the following commands to convert a point whose representation in the coordinate format is defined by a string:
// Get the string representation of a point in the IlvCoordinateFormatter.
String pointRepresentation = "N12.5 E23.4";
// Set it on an instance of IlvCoordinateFormatter
coordinateFormat.parse(pointRepresentation);
// Print the string representing the point in the new coordinate format.
System.out.println("Longitude is : " + coordinateFormat.getLongitude()
+ "Latitude is : " + coordinateFormat.getLatitude());
| Modifier and Type | Method and Description |
|---|---|
String |
getAngleString(double angleRad)
This method formats a single angle.
|
double |
getLatitude()
Returns the latitude of current point.
|
double |
getLongitude()
Returns the longitude of current point.
|
String |
getOutputSeparator()
Returns the output separator.
|
void |
parse(String coordinatesString)
Parse a formatted string containing a point's coordinates in this format.
|
void |
setCoordinatePrecision(int precision)
Sets the Sets the maximum number of digits allowed in the fraction
portion of a coordinate.
|
void |
setEllipsoid(IlvEllipsoid ellipsoid)
Sets the ellipsoid associated with this coordinate format.
|
void |
setLonLat(double xlongitude,
double ylatitude)
Sets latitude and longitude of the current point.
|
void |
setOutputSeparator(String separator)
Changes the separator string that will be used to separate the different
parts of output string in the toString method.
|
void |
setParseSeparator(char separatorChar)
Changes the separator character that will be used to analyze the string
passed to the parse method.
|
String |
toString()
Returns the string representation of current point in this format
|
writedouble getLatitude()
throws IllegalStateException
IllegalStateException - if coordinates were not set first on the systemIllegalStateException - if formatter does not accept latitudes at this moment.double getLongitude()
throws IllegalStateException
IllegalStateException - if coordinates were not set first on the system.void parse(String coordinatesString) throws IllegalArgumentException
coordinatesString - string containing coordinate information.IllegalArgumentException - if string format is not valid.void setCoordinatePrecision(int precision)
precision - precision to use for displaying coordinates.void setEllipsoid(IlvEllipsoid ellipsoid)
ellipsoid - ellipsoid to use for conversions.void setLonLat(double xlongitude,
double ylatitude)
xlongitude - longitude in radians.ylatitude - latitude in radians.void setOutputSeparator(String separator)
separator - the separator string.void setParseSeparator(char separatorChar)
separatorChar - the separator characterString toString()
String getAngleString(double angleRad) throws UnsupportedOperationException
angleRad - angle in radians.UnsupportedOperationException - if the formatter does not support angles.String getOutputSeparator()
© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.