|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormat
CoordinateFormat
public class CoordinateFormat
Formats a direct position in an arbitrary coordinate reference system. The format for each ordinate is inferred from the coordinate system units using the following rules:
AngleFormat.DateFormat.NumberFormat.
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Format |
|---|
Format.Field |
| Constructor Summary | |
|---|---|
CoordinateFormat()
Constructs a new coordinate format with default locale and a two-dimensional geographic (WGS 1984) coordinate reference system. |
|
CoordinateFormat(Locale locale)
Constructs a new coordinate format for the specified locale and a two-dimensional geographic (WGS 1984) coordinate reference system. |
|
CoordinateFormat(Locale locale,
CoordinateReferenceSystem crs)
Constructs a new coordinate format for the specified locale and coordinate reference system. |
|
| Method Summary | |
|---|---|
String |
format(DirectPosition point)
Formats a direct position. |
StringBuffer |
format(DirectPosition point,
StringBuffer toAppendTo,
FieldPosition position)
Formats a direct position and appends the resulting text to a given string buffer. |
StringBuffer |
format(Object object,
StringBuffer toAppendTo,
FieldPosition position)
Formats a direct position and appends the resulting text to a given string buffer. |
String |
getAnglePattern()
Returns the pattern for angle fields. |
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the coordinate reference system for points to be formatted. |
String |
getDatePattern()
Returns the pattern for date fields. |
Format |
getFormat(int dimension)
Returns the format to use for formatting an ordinate at the given dimension. |
String |
getNumberPattern()
Returns the pattern for number fields. |
String |
getSeparator()
Returns the separator between each coordinate (number, angle or date). |
TimeZone |
getTimeZone()
Returns the time zone for dates fields. |
DirectPosition |
parseObject(String source,
ParsePosition position)
Not yet implemented. |
void |
setAnglePattern(String pattern)
Sets the pattern for angles fields. |
void |
setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
Sets the coordinate reference system for points to be formatted. |
void |
setDatePattern(String pattern)
Sets the pattern for dates fields. |
void |
setNumberPattern(String pattern)
Sets the pattern for numbers fields. |
void |
setSeparator(String separator)
Sets the separator between each coordinate. |
void |
setTimeZone(TimeZone timezone)
Sets the time zone for dates fields. |
| Methods inherited from class Format |
|---|
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CoordinateFormat()
public CoordinateFormat(Locale locale)
locale - The locale for formatting coordinates and numbers.
public CoordinateFormat(Locale locale,
CoordinateReferenceSystem crs)
locale - The locale for formatting coordinates and numbers.crs - The output coordinate reference system, or null if unknown.| Method Detail |
|---|
public CoordinateReferenceSystem getCoordinateReferenceSystem()
public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
crs - The new coordinate reference system, or null if unknown.public String getSeparator()
public void setSeparator(String separator)
separator - The new coordinate separator.public String getNumberPattern()
null if the underlying
number format can not provide a pattern.
null if not applicable.public void setNumberPattern(String pattern)
pattern - The number pattern as specified in DecimalFormat.public String getAnglePattern()
null if the underlying
angle format can not provide a pattern.
null if not applicable.public void setAnglePattern(String pattern)
pattern - The angle pattern as specified in AngleFormat.public String getDatePattern()
null if the underlying
date format can not provide a pattern.
null if not applicable.public void setDatePattern(String pattern)
pattern - The date pattern as specified in SimpleDateFormat.public TimeZone getTimeZone()
public void setTimeZone(TimeZone timezone)
timezone - The time zone for dates.
public Format getFormat(int dimension)
throws IndexOutOfBoundsException
Note: This method returns a direct reference to the internal format. Any change to the returnedFormatobject will impact the formatting performed by thisCoordinateFormatobject. We recommend to avoid such changes for now since it may not be compatible with future versions. Use the public setter methods instead.
dimension - The dimension for the ordinate to format.
IndexOutOfBoundsException - if dimension is out of range.public String format(DirectPosition point)
point - The position to format.
IllegalArgumentException - if this CoordinateFormat cannot format the given object.
public StringBuffer format(DirectPosition point,
StringBuffer toAppendTo,
FieldPosition position)
throws IllegalArgumentException
point - The position to format.toAppendTo - Where the text is to be appended.position - A FieldPosition identifying a field in the formatted text, or null if none.
toAppendTo, with formatted text appended.
IllegalArgumentException - If this CoordinateFormat cannot format the given position.
public StringBuffer format(Object object,
StringBuffer toAppendTo,
FieldPosition position)
throws IllegalArgumentException
format in class Formatobject - The DirectPosition to format.toAppendTo - Where the text is to be appended.position - A FieldPosition identifying a field in the formatted text,
or null if none.
toAppendTo, with formatted text appended.
NullPointerException - if toAppendTo is null.
IllegalArgumentException - if this CoordinateFormat
cannot format the given object.
public DirectPosition parseObject(String source,
ParsePosition position)
parseObject in class Formatsource - The string to parse.position - The position of the first character to parse.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||