/** * Sets the symbols used for parsing and formatting WKT. * * @param symbols the new set of symbols to use for parsing and formatting WKT. */ public void setSymbols(final Symbols symbols) { ArgumentChecks.ensureNonNull("symbols", symbols); if (!symbols.equals(this.symbols)) { this.symbols = symbols.immutable(); formatter = null; parser = null; } }
/** * Sets the symbols used for parsing and formatting WKT. * * @param symbols the new set of symbols to use for parsing and formatting WKT. */ public void setSymbols(final Symbols symbols) { ArgumentChecks.ensureNonNull("symbols", symbols); if (!symbols.equals(this.symbols)) { this.symbols = symbols.immutable(); formatter = null; parser = null; } }
/** * Creates a new formatter instance with the specified convention, symbols and indentation. * * @param convention the convention to use. * @param symbols the symbols. * @param indentation the amount of spaces to use in indentation for WKT formatting, * or {@link WKTFormat#SINGLE_LINE} for formatting the whole WKT on a single line. */ public Formatter(final Convention convention, final Symbols symbols, final int indentation) { ArgumentChecks.ensureNonNull("convention", convention); ArgumentChecks.ensureNonNull("symbols", symbols); ArgumentChecks.ensureBetween("indentation", WKTFormat.SINGLE_LINE, Byte.MAX_VALUE, indentation); this.locale = Locale.getDefault(Locale.Category.DISPLAY); this.convention = convention; this.authority = convention.getNameAuthority(); this.symbols = symbols.immutable(); this.separatorNewLine = this.symbols.separatorNewLine(); this.indentation = (byte) indentation; this.numberFormat = symbols.createNumberFormat(); this.dateFormat = new StandardDateFormat(symbols.getLocale()); this.unitFormat = new UnitFormat(symbols.getLocale()); this.buffer = new StringBuffer(); unitFormat.setStyle(UnitFormat.Style.NAME); if (convention.usesCommonUnits) { unitFormat.setLocale(Locale.US); } }
/** * Creates a new formatter instance with the specified convention, symbols and indentation. * * @param convention the convention to use. * @param symbols the symbols. * @param indentation the amount of spaces to use in indentation for WKT formatting, * or {@link WKTFormat#SINGLE_LINE} for formatting the whole WKT on a single line. */ public Formatter(final Convention convention, final Symbols symbols, final int indentation) { ArgumentChecks.ensureNonNull("convention", convention); ArgumentChecks.ensureNonNull("symbols", symbols); ArgumentChecks.ensureBetween("indentation", WKTFormat.SINGLE_LINE, Byte.MAX_VALUE, indentation); this.locale = Locale.getDefault(Locale.Category.DISPLAY); this.convention = convention; this.authority = convention.getNameAuthority(); this.symbols = symbols.immutable(); this.lineSeparator = this.symbols.lineSeparator(); this.indentation = (byte) indentation; this.numberFormat = symbols.createNumberFormat(); this.dateFormat = new StandardDateFormat(symbols.getLocale()); this.unitFormat = new UnitFormat(symbols.getLocale()); this.buffer = new StringBuffer(); unitFormat.setStyle(UnitFormat.Style.NAME); if (convention.usesCommonUnits) { unitFormat.setLocale(Locale.US); } }