/** * Formats this position in the <cite>Well Known Text</cite> (WKT) format. * The format is like below, where {@code x₀}, {@code x₁}, {@code x₂}, <i>etc.</i> * are the ordinate values at index 0, 1, 2, <i>etc.</i>: * * {@preformat wkt * POINT[x₀ x₁ x₂ …] * } * * If the coordinate reference system is geodetic or projected, then coordinate values are formatted * with a precision equivalent to one centimetre on Earth (the actual number of fraction digits is * adjusted for the axis unit of measurement and the planet size if different than Earth). * * @param formatter the formatter where to format the inner content of this point. * @return the WKT keyword, which is {@code "Point"} for this element. * * @since 1.0 */ @Override protected String formatTo(final Formatter formatter) { final double[][] points = new double[][] {getCoordinate()}; formatter.append(points, WKTUtilities.suggestFractionDigits(getCoordinateReferenceSystem(), points)); return WKTKeywords.Point; }
getUpperCorner().getCoordinate() }; formatter.append(points, WKTUtilities.suggestFractionDigits(getCoordinateReferenceSystem(), points)); final int dimension = getDimension(); String keyword = "Box";
/** * Tests {@link WKTUtilities#suggestFractionDigits(CoordinateReferenceSystem, double[]...)}. */ @Test public void testSuggestFractionDigits() { assertArrayEquals(new int[] {8, 9}, WKTUtilities.suggestFractionDigits(HardCodedCRS.WGS84, new double[][] { {40, -10}, {50, -10.000000001} })); } }