public class LocationFormat extends TabularFormat<AbstractLocation>
Location
instances in a tabular format.
This format assumes a monospaced font and an encoding supporting drawing box characters (e.g. UTF-8).
Locale.ENGLISH
:
┌─────────────────────────────────────────────────────────────┐ │ Location type: Grid zone designator │ │ Geographic identifier: 32TNL83 │ │ West bound: 580,000 m — 9°57′00″E │ │ Representative value: 585,000 m — 10°00′36″E │ │ East bound: 590,000 m — 10°04′13″E │ │ South bound: 4,530,000 m — 40°54′58″N │ │ Representative value: 4,535,000 m — 40°57′42″N │ │ North bound: 4,540,000 m — 41°00′27″N │ │ Coordinate reference system: WGS 84 / UTM zone 32N │ └─────────────────────────────────────────────────────────────┘
Limitations:
LocationFormat
, like most java.text.Format
subclasses, is not thread-safe.Defined in the sis-referencing-by-identifiers
module
Format.Field
beforeFill, columnSeparator, fillCharacter, lineSeparator, omitTrailingNulls
Constructor and Description |
---|
LocationFormat(Locale locale,
TimeZone timezone)
Creates a new format for the given locale.
|
Modifier and Type | Method and Description |
---|---|
LocationFormat |
clone()
Returns a clone of this format.
|
protected Format |
createFormat(Class<?> valueType)
Creates the format to use for formatting a latitude, longitude or projected coordinate.
|
void |
format(AbstractLocation location,
Appendable toAppendTo)
Writes a textual representation of the given location in the given stream or buffer.
|
Class<AbstractLocation> |
getValueType()
Returns the type of values formatted by this
Format instance. |
AbstractLocation |
parse(CharSequence text,
ParsePosition pos)
Unsupported operation.
|
getColumnSeparatorMatcher, getColumnSeparatorPattern, getLineSeparator, setColumnSeparatorPattern, setLineSeparator
format, getFormat, getLocale, getLocale, getTimeZone, parseObject, parseObject
format, formatToCharacterIterator
public LocationFormat(Locale locale, TimeZone timezone)
null
or Locale.ROOT
if this format shall format "unlocalized" strings.locale
- the locale for the new Format
, or null
for Locale.ROOT
.timezone
- the timezone, or null
for UTC.public Class<AbstractLocation> getValueType()
Format
instance.getValueType
in class CompoundFormat<AbstractLocation>
Format
instance.public void format(AbstractLocation location, Appendable toAppendTo) throws IOException
location
parameter may be generalized
to the org.opengis.referencing.gazetteer.Location
interface.
This change is pending GeoAPI revision.format
in class CompoundFormat<AbstractLocation>
location
- the location to format.toAppendTo
- where to format the location.IOException
- if an error occurred while writing to the given appendable.protected Format createFormat(Class<?> valueType)
format(Location, Appendable)
when first needed.createFormat
in class CompoundFormat<AbstractLocation>
valueType
- Angle.class
. Number.class
or Unit.class
.AngleFormat
, NumberFormat
or UnitFormat
instance
depending on the argument value.public AbstractLocation parse(CharSequence text, ParsePosition pos) throws ParseException
parse
in class CompoundFormat<AbstractLocation>
text
- the character sequence for the location to parse.pos
- the position where to start the parsing.null
if the text is not recognized.ParseException
- if an error occurred while parsing the location.public LocationFormat clone()
clone
in class TabularFormat<AbstractLocation>
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.