| java.lang.Object java.text.Format org.geotools.measure.CoordinateFormat
CoordinateFormat | public class CoordinateFormat extends Format (Code) | | Formats a
in an arbitrary
.
The format for each ordinate is infered from the coordinate system units using the
following rules:
- Ordinate values in
are formated as angles
using
AngleFormat .
- Ordinate values in any unit compatible with
are formated as dates using
DateFormat .
- All other values are formatted as numbers using
NumberFormat .
Note: parsing is not yet implemented in this version.
since: 2.0 version: $Id: CoordinateFormat.java 24925 2007-03-27 20:12:08Z jgarnett $ author: Martin Desruisseaux |
Constructor Summary | |
public | CoordinateFormat() Constructs a new coordinate format with default locale and a two-dimensional
coordinate reference system. | public | CoordinateFormat(Locale locale) Construct a new coordinate format for the specified locale and a two-dimensional
coordinate reference system. | public | CoordinateFormat(Locale locale, CoordinateReferenceSystem crs) Constructs a new coordinate format for the specified locale and coordinate reference system. |
Method Summary | |
public String | format(DirectPosition point) Formats a direct position. | public StringBuffer | format(DirectPosition point, StringBuffer toAppendTo, FieldPosition position) Formats a direct position and appends the resulting text to a given string buffer.
The position's dimension must matches the
dimension.
Parameters: point - The position to format. Parameters: toAppendTo - Where the text is to be appended. Parameters: position - A FieldPosition identifying a field in the formatted text,or null if none. | public StringBuffer | format(Object object, StringBuffer toAppendTo, FieldPosition position) Formats a direct position and appends the resulting text to a given string buffer.
The position's dimension must matches the
dimension.
Parameters: object - The DirectPosition to format. Parameters: toAppendTo - Where the text is to be appended. Parameters: position - A FieldPosition identifying a field in the formatted text,or null if none. | public CoordinateReferenceSystem | getCoordinateReferenceSystem() Returns the coordinate reference system for points to be formatted. | public Format | getFormat(int dimension) Returns the format to use for formatting an ordinate at the given dimension.
The dimension parameter range from 0 inclusive to the
's dimension,
exclusive. | public String | getSeparator() Returns the separator between each coordinate (number, angle or date). | public Object | parseObject(String source, ParsePosition position) Not yet implemented. | public void | setAnglePattern(String pattern) Set the pattern for angles fields. | public void | setCoordinateReferenceSystem(CoordinateReferenceSystem crs) Set the coordinate reference system for points to be formatted. | public void | setDatePattern(String pattern) Set the pattern for dates fields. | public void | setNumberPattern(String pattern) Set the pattern for numbers fields. | public void | setSeparator(String separator) Set the separator between each coordinate. | public void | setTimeZone(TimeZone timezone) Set the time zone for dates fields. |
CoordinateFormat | public CoordinateFormat()(Code) | | Constructs a new coordinate format with default locale and a two-dimensional
coordinate reference system.
|
CoordinateFormat | public CoordinateFormat(Locale locale)(Code) | | Construct a new coordinate format for the specified locale and a two-dimensional
coordinate reference system.
Parameters: locale - The locale for formatting coordinates and numbers. |
CoordinateFormat | public CoordinateFormat(Locale locale, CoordinateReferenceSystem crs)(Code) | | Constructs a new coordinate format for the specified locale and coordinate reference system.
Parameters: locale - The locale for formatting coordinates and numbers. Parameters: crs - The output coordinate reference system. |
format | public String format(DirectPosition point)(Code) | | Formats a direct position. The position's dimension must matches the
dimension.
Parameters: point - The position to format. The formatted position. throws: IllegalArgumentException - if this CoordinateFormat cannot format the given object. |
format | public StringBuffer format(DirectPosition point, StringBuffer toAppendTo, FieldPosition position) throws IllegalArgumentException(Code) | | Formats a direct position and appends the resulting text to a given string buffer.
The position's dimension must matches the
dimension.
Parameters: point - The position to format. Parameters: toAppendTo - Where the text is to be appended. Parameters: position - A FieldPosition identifying a field in the formatted text,or null if none. The string buffer passed in as toAppendTo , with formatted text appended. throws: IllegalArgumentException - if this CoordinateFormat cannot format the given object. |
format | public StringBuffer format(Object object, StringBuffer toAppendTo, FieldPosition position) throws IllegalArgumentException(Code) | | Formats a direct position and appends the resulting text to a given string buffer.
The position's dimension must matches the
dimension.
Parameters: object - The DirectPosition to format. Parameters: toAppendTo - Where the text is to be appended. Parameters: position - A FieldPosition identifying a field in the formatted text,or null if none. The string buffer passed in as toAppendTo , with formatted text appended. throws: NullPointerException - if toAppendTo is null. throws: IllegalArgumentException - if this CoordinateFormat cannot format the given object. |
getCoordinateReferenceSystem | public CoordinateReferenceSystem getCoordinateReferenceSystem()(Code) | | Returns the coordinate reference system for points to be formatted.
The output coordinate reference system. |
getFormat | public Format getFormat(int dimension) throws IndexOutOfBoundsException(Code) | | Returns the format to use for formatting an ordinate at the given dimension.
The dimension parameter range from 0 inclusive to the
's dimension,
exclusive. This method returns a direct reference to the internal format; any change
to the returned
Format object will change the formatting for this
CoordinateFormat object.
Parameters: dimension - The dimension for the ordinate to format. The format for the given dimension. throws: IndexOutOfBoundsException - if dimension is out of range. |
getSeparator | public String getSeparator()(Code) | | Returns the separator between each coordinate (number, angle or date).
since: 2.2 |
setAnglePattern | public void setAnglePattern(String pattern)(Code) | | Set the pattern for angles fields. If some ordinates are formatted as angle
(for example in
), then those angles will be formatted using
this pattern.
Parameters: pattern - The angle pattern as specified in AngleFormat. |
setCoordinateReferenceSystem | public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)(Code) | | Set the coordinate reference system for points to be formatted. The number
of dimensions must matched the dimension of points to be formatted.
Parameters: crs - The new coordinate system. |
setDatePattern | public void setDatePattern(String pattern)(Code) | | Set the pattern for dates fields. If some ordinates are formatted as date (for example in
), then
those dates will be formatted using this pattern.
Parameters: pattern - The date pattern as specified in SimpleDateFormat. |
setNumberPattern | public void setNumberPattern(String pattern)(Code) | | Set the pattern for numbers fields. If some ordinates are formatted as plain number
(for example in
), then those numbers will be formatted using this pattern.
Parameters: pattern - The number pattern as specified in DecimalFormat. |
setSeparator | public void setSeparator(String separator)(Code) | | Set the separator between each coordinate.
since: 2.2 |
setTimeZone | public void setTimeZone(TimeZone timezone)(Code) | | Set the time zone for dates fields. If some ordinates are formatted as date (for example in
), then
those dates will be formatted using the specified time zone.
Parameters: timezone - The time zone for dates. |
|
|