Java Doc for AngleFormat.java in  » GIS » GeoTools-2.4.1 » org » geotools » measure » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.measure 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.Format
      org.geotools.measure.AngleFormat

AngleFormat
public class AngleFormat extends Format (Code)
Parse and format angle according a specified pattern. The pattern is a string containing any characters, with a special meaning for the following characters:
D   The integer part of degrees
d   The fractional part of degrees
M   The integer part of minutes
m   The fractional part of minutes
S   The integer part of seconds
s   The fractional part of seconds
.   The decimal separator

Upper-case letters D , M and S are for the integer parts of degrees, minutes and seconds respectively. They must appear in this order (e.g. "M'D" is illegal because "M" and "S" are inverted; "D°S" is illegal too because there is no "M" between "D" and "S"). Lower-case letters d , m and s are for fractional parts of degrees, minutes and seconds respectively. Only one of those may appears in a pattern, and it must be the last special symbol (e.g. "D.dd°MM'" is illegal because "d" is followed by "M"; " D.mm " is illegal because "m" is not the fractional part of "D").

The number of occurrence of D , M , S and their lower-case counterpart is the number of digits to format. For example, "DD.ddd" will format angle with two digits for the integer part and three digits for the fractional part (e.g. 4.4578 will be formatted as "04.458"). Separator characters like °, ' and " and inserted "as-is" in the formatted string (except the decimal separator dot (" . "), which is replaced by the local-dependent decimal separator). Separator characters may be completely omitted; AngleFormat will still differentiate degrees, minutes and seconds fields according the pattern. For example, " 0480439 " with the pattern " DDDMMmm " will be parsed as 48°04.39'.

The following table gives some examples of legal patterns.
Pattern Example
DD°MM'SS" 48°30'00"
DD°MM' 48°30'
DD.ddd 48.500
DDMM 4830
DDMMSS 483000

See Also:   Angle
See Also:   Latitude
See Also:   Longitude
since:
   2.0
version:
   $Id: AngleFormat.java 20874 2006-08-07 10:00:01Z jgarnett $
author:
   Martin Desruisseaux


Field Summary
final static  intALTITUDE
     Constante indique que le nombre à formater est une altitude.
final public static  intDEGREES_FIELD
     Constant for degrees field.
final public static  intHEMISPHERE_FIELD
     Constant for hemisphere field.
final static  intLATITUDE
     Constante indique que l'angle à formater est une latitude.
final static  intLONGITUDE
     Constante indique que l'angle à formater est une longitude.
final public static  intMINUTES_FIELD
     Constant for minutes field.
final public static  intSECONDS_FIELD
     Constant for seconds field.

Constructor Summary
public  AngleFormat()
     Construct a new AngleFormat using the current default locale and a default pattern.
public  AngleFormat(String pattern)
     Construct a new AngleFormat using the current default locale and the specified pattern.
public  AngleFormat(String pattern, Locale locale)
     Construct a new AngleFormat using the specified pattern and locale.
public  AngleFormat(String pattern, DecimalFormatSymbols symbols)
     Construct a new AngleFormat using the specified pattern and decimal symbols.

Method Summary
public synchronized  voidapplyPattern(String pattern)
     Set the pattern to use for parsing and formatting angle.
static  voidcheckComplete(String source, ParsePosition pos, boolean isCoordinate)
     Vérifie si l'interprétation d'une chaîne de caractères a été complète.
public synchronized  booleanequals(Object obj)
     Compare this format with the specified object for equality.
final public  Stringformat(double angle)
     Format an angle.
public synchronized  StringBufferformat(double angle, StringBuffer toAppendTo, FieldPosition pos)
     Formats an angle and appends the resulting text to a given string buffer. The string will be formatted according the pattern set in the last call to AngleFormat.applyPattern .
Parameters:
  angle - Angle to format, in degrees.
Parameters:
  toAppendTo - Where the text is to be appended.
Parameters:
  pos - An optional FieldPosition identifying a fieldin the formatted text, or null if thisinformation is not wanted.
public synchronized  StringBufferformat(Object obj, StringBuffer toAppendTo, FieldPosition pos)
     Formats an angle, a latitude or a longitude and appends the resulting text to a given string buffer.
synchronized  StringBufferformat(double number, int type, StringBuffer toAppendTo, FieldPosition pos)
     Procède à l'écriture d'un angle, d'une latitude ou d'une longitude.
Parameters:
  number - Angle ou nombre à écrire.
Parameters:
  type - Type de l'angle ou du nombre:AngleFormat.LONGITUDE,AngleFormat.LATITUDE ouAngleFormat.ALTITUDE.
Parameters:
  toAppendTo - Buffer dans lequel écrire l'angle.
Parameters:
  pos - En entré, le code du champs dont on désire les index(AngleFormat.DEGREES_FIELD,AngleFormat.MINUTES_FIELD,AngleFormat.SECONDS_FIELD ouAngleFormat.HEMISPHERE_FIELD).En sortie, les index du champs demandé.
public static  AngleFormatgetInstance(Locale locale)
     Construct a new AngleFormat for the specified locale.
public synchronized  inthashCode()
     Returns a "hash value" for this object.
public  Angleparse(String source, ParsePosition pos)
     Parse a string as an angle.
public  Angleparse(String source)
     Parse a string as an angle.
Parameters:
  source - The string to parse.
final  NumberparseNumber(String source, ParsePosition pos)
     Interprète une chaîne de caractères qui devrait représenter un nombre. Cette méthode est utile pour lire une altitude après les angles.
Parameters:
  source - Chaîne de caractères à interpréter.
Parameters:
  pos - Position à partir d'où commencer l'interprétationde la chaîne source .
public  ObjectparseObject(String source, ParsePosition pos)
     Parse a substring as an angle.
public  ObjectparseObject(String source)
     Parse a string as an object.
public synchronized  StringtoPattern()
     Returns the pattern used for parsing and formatting angles.
public  StringtoString()
     Returns a string representation of this object.

Field Detail
ALTITUDE
final static int ALTITUDE(Code)
Constante indique que le nombre à formater est une altitude.



DEGREES_FIELD
final public static int DEGREES_FIELD(Code)
Constant for degrees field. When formatting a string, this value may be specified to the java.text.FieldPosition constructor in order to get the bounding index where degrees have been written.



HEMISPHERE_FIELD
final public static int HEMISPHERE_FIELD(Code)
Constant for hemisphere field. When formatting a string, this value may be specified to the java.text.FieldPosition constructor in order to get the bounding index where the hemisphere synbol has been written.



LATITUDE
final static int LATITUDE(Code)
Constante indique que l'angle à formater est une latitude.



LONGITUDE
final static int LONGITUDE(Code)
Constante indique que l'angle à formater est une longitude.



MINUTES_FIELD
final public static int MINUTES_FIELD(Code)
Constant for minutes field. When formatting a string, this value may be specified to the java.text.FieldPosition constructor in order to get the bounding index where minutes have been written.



SECONDS_FIELD
final public static int SECONDS_FIELD(Code)
Constant for seconds field. When formatting a string, this value may be specified to the java.text.FieldPosition constructor in order to get the bounding index where seconds have been written.




Constructor Detail
AngleFormat
public AngleFormat()(Code)
Construct a new AngleFormat using the current default locale and a default pattern.



AngleFormat
public AngleFormat(String pattern) throws IllegalArgumentException(Code)
Construct a new AngleFormat using the current default locale and the specified pattern.
Parameters:
  pattern - Pattern to use for parsing and formatting angle.See class description for an explanation of how this pattern work.
throws:
  IllegalArgumentException - If the specified pattern is not legal.



AngleFormat
public AngleFormat(String pattern, Locale locale) throws IllegalArgumentException(Code)
Construct a new AngleFormat using the specified pattern and locale.
Parameters:
  pattern - Pattern to use for parsing and formatting angle.See class description for an explanation of how this pattern work.
Parameters:
  locale - Locale to use.
throws:
  IllegalArgumentException - If the specified pattern is not legal.



AngleFormat
public AngleFormat(String pattern, DecimalFormatSymbols symbols)(Code)
Construct a new AngleFormat using the specified pattern and decimal symbols.
Parameters:
  pattern - Pattern to use for parsing and formatting angle.See class description for an explanation of how this pattern work.
Parameters:
  symbols - The symbols to use for parsing and formatting numbers.
throws:
  IllegalArgumentException - If the specified pattern is not legal.




Method Detail
applyPattern
public synchronized void applyPattern(String pattern) throws IllegalArgumentException(Code)
Set the pattern to use for parsing and formatting angle. See class description for an explanation of how patterns work.
Parameters:
  pattern - Pattern to use for parsing and formatting angle.
throws:
  IllegalArgumentException - If the specified pattern is not legal.



checkComplete
static void checkComplete(String source, ParsePosition pos, boolean isCoordinate) throws ParseException(Code)
Vérifie si l'interprétation d'une chaîne de caractères a été complète. Si ce n'était pas le cas, lance une exception avec un message d'erreur soulignant les caractères problématiques.
Parameters:
  source - Chaîne de caractères qui était à interpréter.
Parameters:
  pos - Position à laquelle s'est terminée l'interprétation de lachaîne source .
Parameters:
  isCoordinate - false si on interprétait un angle,ou true si on interprétait une coordonnée.
throws:
  ParseException - Si la chaîne source n'a pas étéinterprétée dans sa totalité.



equals
public synchronized boolean equals(Object obj)(Code)
Compare this format with the specified object for equality.



format
final public String format(double angle)(Code)
Format an angle. The string will be formatted according the pattern set in the last call to AngleFormat.applyPattern .
Parameters:
  angle - Angle to format, in degrees. The formatted string.



format
public synchronized StringBuffer format(double angle, StringBuffer toAppendTo, FieldPosition pos)(Code)
Formats an angle and appends the resulting text to a given string buffer. The string will be formatted according the pattern set in the last call to AngleFormat.applyPattern .
Parameters:
  angle - Angle to format, in degrees.
Parameters:
  toAppendTo - Where the text is to be appended.
Parameters:
  pos - An optional FieldPosition identifying a fieldin the formatted text, or null if thisinformation is not wanted. This field position shallbe constructed with one of the following constants:AngleFormat.DEGREES_FIELD,AngleFormat.MINUTES_FIELD,AngleFormat.SECONDS_FIELD orAngleFormat.HEMISPHERE_FIELD. The string buffer passed in as toAppendTo , with formatted text appended.



format
public synchronized StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) throws IllegalArgumentException(Code)
Formats an angle, a latitude or a longitude and appends the resulting text to a given string buffer. The string will be formatted according the pattern set in the last call to AngleFormat.applyPattern . The argument obj shall be an Angle object or one of its derived class ( Latitude , Longitude ). If obj is a Latitude object, then a symbol "N" or "S" will be appended to the end of the string (the symbol will be choosen according the angle's sign). Otherwise, if obj is a Longitude object, then a symbol "E" or "W" will be appended to the end of the string. Otherwise, no hemisphere symbol will be appended.

Strictly speaking, formatting ordinary numbers is not the AngleFormat 's job. Nevertheless, this method accept Number objects. This capability is provided only as a convenient way to format altitude numbers together with longitude and latitude angles.
Parameters:
  obj - Angle or Number object to format.
Parameters:
  toAppendTo - Where the text is to be appended.
Parameters:
  pos - An optional FieldPosition identifying a fieldin the formatted text, or null if thisinformation is not wanted. This field position shallbe constructed with one of the following constants:AngleFormat.DEGREES_FIELD,AngleFormat.MINUTES_FIELD,AngleFormat.SECONDS_FIELD orAngleFormat.HEMISPHERE_FIELD. The string buffer passed in as toAppendTo , withformatted text appended.
throws:
  IllegalArgumentException - if obj if not an objectof class Angle or Number.



format
synchronized StringBuffer format(double number, int type, StringBuffer toAppendTo, FieldPosition pos)(Code)
Procède à l'écriture d'un angle, d'une latitude ou d'une longitude.
Parameters:
  number - Angle ou nombre à écrire.
Parameters:
  type - Type de l'angle ou du nombre:AngleFormat.LONGITUDE,AngleFormat.LATITUDE ouAngleFormat.ALTITUDE.
Parameters:
  toAppendTo - Buffer dans lequel écrire l'angle.
Parameters:
  pos - En entré, le code du champs dont on désire les index(AngleFormat.DEGREES_FIELD,AngleFormat.MINUTES_FIELD,AngleFormat.SECONDS_FIELD ouAngleFormat.HEMISPHERE_FIELD).En sortie, les index du champs demandé. Ce paramètrepeut être nul si cette information n'est pas désirée. Le buffer toAppendTo par commodité.



getInstance
public static AngleFormat getInstance(Locale locale)(Code)
Construct a new AngleFormat for the specified locale.



hashCode
public synchronized int hashCode()(Code)
Returns a "hash value" for this object.



parse
public Angle parse(String source, ParsePosition pos)(Code)
Parse a string as an angle. This method can parse an angle even if it doesn't comply exactly to the expected pattern. For example, this method will parse correctly string "48°12.34'" even if the expected pattern was " DDMM.mm " (i.e. the string should have been " 4812.34 "). Spaces between degrees, minutes and secondes are ignored. If the string ends with an hemisphere symbol "N" or "S", then this method returns an object of class Latitude . Otherwise, if the string ends with an hemisphere symbol "E" or "W", then this method returns an object of class Longitude . Otherwise, this method returns an object of class Angle .
Parameters:
  source - A String whose beginning should be parsed.
Parameters:
  pos - Position where to start parsing. The parsed string as an Angle, Latitudeor Longitude object.



parse
public Angle parse(String source) throws ParseException(Code)
Parse a string as an angle.
Parameters:
  source - The string to parse. The parsed string as an Angle, Latitudeor Longitude object.
throws:
  ParseException - if the string has not been fully parsed.



parseNumber
final Number parseNumber(String source, ParsePosition pos)(Code)
Interprète une chaîne de caractères qui devrait représenter un nombre. Cette méthode est utile pour lire une altitude après les angles.
Parameters:
  source - Chaîne de caractères à interpréter.
Parameters:
  pos - Position à partir d'où commencer l'interprétationde la chaîne source . Le nombre lu comme objet Number.



parseObject
public Object parseObject(String source, ParsePosition pos)(Code)
Parse a substring as an angle. Default implementation invokes AngleFormat.parse(String,ParsePosition) .
Parameters:
  source - A String whose beginning should be parsed.
Parameters:
  pos - Position where to start parsing. The parsed string as an Angle,Latitude or Longitude object.



parseObject
public Object parseObject(String source) throws ParseException(Code)
Parse a string as an object. Default implementation invokes AngleFormat.parse(String) .
Parameters:
  source - The string to parse. The parsed string as an Angle, Latitude orLongitude object.
throws:
  ParseException - if the string has not been fully parsed.



toPattern
public synchronized String toPattern()(Code)
Returns the pattern used for parsing and formatting angles. See class description for an explanation of how patterns work.



toString
public String toString()(Code)
Returns a string representation of this object.



Methods inherited from java.text.Format
public Object clone()(Code)(Java Doc)
final public String format(Object obj)(Code)(Java Doc)
abstract public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)(Code)(Java Doc)
public AttributedCharacterIterator formatToCharacterIterator(Object obj)(Code)(Java Doc)
abstract public Object parseObject(String source, ParsePosition pos)(Code)(Java Doc)
public Object parseObject(String source) throws ParseException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.