/** * Appends a {@linkplain ParameterValueGroup group of parameters} in a {@code Param_MT[…]} element. * * @param parameters the parameter to append to the WKT, or {@code null} if none. * @param formatter the formatter where to append the parameter. */ public static void appendParamMT(final ParameterValueGroup parameters, final Formatter formatter) { if (parameters != null) { appendName(parameters.getDescriptor(), formatter, ElementKind.PARAMETER); append(parameters, formatter); } }
/** * Formats this group as a pseudo-<cite>Well Known Text</cite> element. * * @param formatter the formatter where to format the inner content of this WKT element. * @return {@code "ParameterGroup"}. */ @Override protected String formatTo(final Formatter formatter) { WKTUtilities.appendParamMT(this, formatter); return WKTKeywords.ParameterGroup; } }
@Override protected String formatTo(final Formatter formatter) { formatter.indent(-1); formatter.append(WKTUtilities.toFormattable(crs)); formatter.indent(+1); return type; } });
WKTUtilities.appendName(this, formatter, null); final Convention convention = formatter.getConvention(); final List<? extends CoordinateReferenceSystem> crs; formatter.append(WKTUtilities.toFormattable(element));
/** Formats this {@code Conversion} element. */ @Override protected String formatTo(final Formatter formatter) { WKTUtilities.appendName(conversion, formatter, null); formatter.newLine(); append(formatter); return WKTKeywords.Conversion; }
/** * Tests {@link WKTUtilities#toType(Class, Class)}. * * @see ReferencingUtilitiesTest#testToPropertyName() */ @Test public void testToType() { assertNull ( toType(CoordinateSystem.class, CoordinateSystem.class)); assertEquals(WKTKeywords.affine, toType(CoordinateSystem.class, AffineCS .class)); assertEquals(WKTKeywords.Cartesian, toType(CoordinateSystem.class, CartesianCS .class)); assertEquals(WKTKeywords.cylindrical, toType(CoordinateSystem.class, CylindricalCS .class)); assertEquals(WKTKeywords.ellipsoidal, toType(CoordinateSystem.class, EllipsoidalCS .class)); assertEquals(WKTKeywords.linear, toType(CoordinateSystem.class, LinearCS .class)); // assertEquals(WKTKeywords.parametric, toType(CoordinateSystem.class, ParametricCS .class)); assertEquals(WKTKeywords.polar, toType(CoordinateSystem.class, PolarCS .class)); assertEquals(WKTKeywords.spherical, toType(CoordinateSystem.class, SphericalCS .class)); assertEquals(WKTKeywords.temporal, toType(CoordinateSystem.class, TimeCS .class)); assertEquals(WKTKeywords.vertical, toType(CoordinateSystem.class, VerticalCS .class)); }
/** * 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; }
final boolean filter = WKTUtilities.isEPSG(parameters.getDescriptor(), false) && // NOT method.getName() Constants.EPSG.equalsIgnoreCase(Citations.toCodeSpace(formatter.getNameAuthority())); formatter.newLine(); formatter.indent(+1); for (final GeneralParameterValue param : parameters.values()) { if (!filter || WKTUtilities.isEPSG(param.getDescriptor(), true)) { WKTUtilities.append(param, formatter);
/** * Appends a {@linkplain ParameterValue parameter} in a {@code PARAMETER[…]} element. * If the supplied parameter is actually a {@linkplain ParameterValueGroup parameter group}, * all contained parameters will be flattened in a single list. * * @param parameter the parameter to append to the WKT, or {@code null} if none. * @param formatter the formatter where to append the parameter. */ public static void append(GeneralParameterValue parameter, final Formatter formatter) { if (parameter instanceof ParameterValueGroup) { boolean first = true; for (final GeneralParameterValue param : ((ParameterValueGroup) parameter).values()) { if (first) { formatter.newLine(); first = false; } append(param, formatter); } } if (parameter instanceof ParameterValue<?>) { if (!(parameter instanceof FormattableObject)) { parameter = new DefaultParameterValue<>((ParameterValue<?>) parameter); } formatter.append((FormattableObject) parameter); formatter.newLine(); } }
WKTUtilities.appendName(this, formatter, null); final Convention convention = formatter.getConvention(); final List<? extends CoordinateReferenceSystem> crs; formatter.append(WKTUtilities.toFormattable(element));
/** Formats this {@code Conversion} element. */ @Override protected String formatTo(final Formatter formatter) { WKTUtilities.appendName(conversion, formatter, null); formatter.newLine(); append(formatter); return WKTKeywords.Conversion; }
final String type = WKTUtilities.toType(CoordinateSystem.class, getInterface()); if (type == null) { formatter.setInvalidWKT(this, null);
/** * 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} })); } }
final boolean filter = WKTUtilities.isEPSG(parameters.getDescriptor(), false) && // NOT method.getName() Constants.EPSG.equalsIgnoreCase(Citations.getCodeSpace(formatter.getNameAuthority())); formatter.newLine(); formatter.indent(+1); for (final GeneralParameterValue param : parameters.values()) { if (!filter || WKTUtilities.isEPSG(param.getDescriptor(), true)) { WKTUtilities.append(param, formatter);
/** * Appends a {@linkplain ParameterValue parameter} in a {@code PARAMETER[…]} element. * If the supplied parameter is actually a {@linkplain ParameterValueGroup parameter group}, * all contained parameters will be flattened in a single list. * * @param parameter the parameter to append to the WKT, or {@code null} if none. * @param formatter the formatter where to append the parameter. */ public static void append(GeneralParameterValue parameter, final Formatter formatter) { if (parameter instanceof ParameterValueGroup) { boolean first = true; for (final GeneralParameterValue param : ((ParameterValueGroup) parameter).values()) { if (first) { formatter.newLine(); first = false; } append(param, formatter); } } if (parameter instanceof ParameterValue<?>) { if (!(parameter instanceof FormattableObject)) { parameter = new DefaultParameterValue<>((ParameterValue<?>) parameter); } formatter.append((FormattableObject) parameter); formatter.newLine(); } }
protected String formatTo(final Formatter formatter) { final ParameterDescriptor<T> descriptor = getDescriptor(); // Gives to users a chance to override this property. WKTUtilities.appendName(descriptor, formatter, ElementKind.PARAMETER); final Convention convention = formatter.getConvention(); final boolean isWKT1 = convention.majorVersion() == 1; } else { if (convention != Convention.INTERNAL) { unit = WKTUtilities.toFormattable(unit);
@Override protected String formatTo(final Formatter formatter) { WKTUtilities.appendParamMT(values, formatter); return WKTKeywords.Param_MT; } });
/** * Appends a {@linkplain ParameterValueGroup group of parameters} in a {@code Param_MT[…]} element. * * @param parameters the parameter to append to the WKT, or {@code null} if none. * @param formatter the formatter where to append the parameter. */ public static void appendParamMT(final ParameterValueGroup parameters, final Formatter formatter) { if (parameters != null) { appendName(parameters.getDescriptor(), formatter, ElementKind.PARAMETER); append(parameters, formatter); } }
WKTUtilities.appendName(this, formatter, ElementKind.forType(getClass())); return null;
final String type = WKTUtilities.toType(CoordinateSystem.class, getInterface()); if (type == null) { formatter.setInvalidWKT(this, null);