public class CoordinateFormat extends Format
AngleFormat
.
DateFormat
.
NumberFormat
.
Format.Field
Constructor and Description |
---|
CoordinateFormat()
Constructs a new coordinate format with default locale and a two-dimensional geographic (WGS 1984) coordinate reference system.
|
CoordinateFormat(Locale locale)
Construct 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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the coordinate reference system for points to be formatted.
|
Format |
getFormat(int dimension)
Returns the format to use for formatting an ordinate at the given dimension.
|
String |
getSeparator()
Returns the separator between each coordinate (number, angle or date).
|
DirectPosition |
parseObject(String source,
ParsePosition position)
Not yet implemented.
|
void |
setAnglePattern(String pattern)
Set the pattern for angles fields.
|
void |
setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
Set the coordinate reference system for points to be formatted.
|
void |
setDatePattern(String pattern)
Set the pattern for dates fields.
|
void |
setNumberPattern(String pattern)
Set the pattern for numbers fields.
|
void |
setSeparator(String separator)
Set the separator between each coordinate.
|
void |
setTimeZone(TimeZone timezone)
Set the time zone for dates fields.
|
clone, format, formatToCharacterIterator, parseObject
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.public CoordinateReferenceSystem getCoordinateReferenceSystem()
public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
crs
- The new coordinate system.public String getSeparator()
public void setSeparator(String separator)
separator
- The new coordinate separator.public void setNumberPattern(String pattern)
pattern
- The number pattern as specified in DecimalFormat
.public void setAnglePattern(String pattern)
pattern
- The angle pattern as specified in AngleFormat
.public void setDatePattern(String pattern)
pattern
- The date pattern as specified in SimpleDateFormat
.public void setTimeZone(TimeZone timezone)
timezone
- The time zone for dates.public Format getFormat(int dimension) throws IndexOutOfBoundsException
Format
object will change the formatting
for this CoordinateFormat
object.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
object.public StringBuffer format(Object object, StringBuffer toAppendTo, FieldPosition position) throws IllegalArgumentException
format
in class Format
object
- 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 Format
source
- The string to parse.position
- The position of the first character to parse.Copyright © 1996–2019 Geotools. All rights reserved.