Package org.geotools.gml.producer
Class CoordinateFormatter
- Object
- 
- CoordinateFormatter
 
- 
 public final class CoordinateFormatter extends Object Formats coordinates with a given number of decimals, using code more efficient than NumberFormat when possible. The class is not thread safe, create a new instance for each thread using it.
- 
- 
Constructor SummaryConstructors Constructor Description CoordinateFormatter(int numDecimals)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(double x)Formats a number with the configured number of decimals.StringBufferformat(double x, StringBuffer sb)Formats a number with the configured number of decimalsintgetMaximumFractionDigits()Returns the maximum number of digits allowed in the fraction portion of a number.booleanisForcedDecimal()Returns the force decimal flag, seesetForcedDecimal(boolean)booleanisPadWithZeros()voidsetForcedDecimal(boolean forcedDecimal)When set to true, forces decimal representation of numbers, otherwise allows scientific notation too (for very large of very small numbers).voidsetMaximumFractionDigits(int maxDigits)voidsetPadWithZeros(boolean pad)
 
- 
- 
- 
Method Detail- 
formatpublic String format(double x) Formats a number with the configured number of decimals. For better performance best useformat(double, StringBuffer)against a re-used StringBuffer
 - 
formatpublic StringBuffer format(double x, StringBuffer sb) Formats a number with the configured number of decimals
 - 
getMaximumFractionDigitspublic int getMaximumFractionDigits() Returns the maximum number of digits allowed in the fraction portion of a number.- Returns:
- the maximum number of digits.
 
 - 
setMaximumFractionDigitspublic void setMaximumFractionDigits(int maxDigits) 
 - 
isForcedDecimalpublic boolean isForcedDecimal() Returns the force decimal flag, seesetForcedDecimal(boolean)
 - 
isPadWithZerospublic boolean isPadWithZeros() 
 - 
setForcedDecimalpublic void setForcedDecimal(boolean forcedDecimal) When set to true, forces decimal representation of numbers, otherwise allows scientific notation too (for very large of very small numbers). False by default.
 - 
setPadWithZerospublic void setPadWithZeros(boolean pad) 
 
- 
 
-