/** * Marks the current WKT representation of the given class as not strictly compliant with the WKT specification. * This method can be used as an alternative to {@link #setInvalidWKT(IdentifiedObject, Exception)} when the * problematic object is not an instance of {@code IdentifiedObject}. * * @param unformattable the class of the object that can not be formatted, * @param cause the cause for the failure to format, or {@code null} if the cause is not an exception. */ public void setInvalidWKT(final Class<?> unformattable, final Exception cause) { ArgumentChecks.ensureNonNull("unformattable", unformattable); setInvalidWKT(getName(unformattable), cause); }
/** * Marks the current WKT representation of the given class as not strictly compliant with the WKT specification. * This method can be used as an alternative to {@link #setInvalidWKT(IdentifiedObject, Exception)} when the * problematic object is not an instance of {@code IdentifiedObject}. * * @param unformattable the class of the object that can not be formatted, * @param cause the cause for the failure to format, or {@code null} if the cause is not an exception. */ public void setInvalidWKT(final Class<?> unformattable, final Exception cause) { ArgumentChecks.ensureNonNull("unformattable", unformattable); setInvalidWKT(getName(unformattable), cause); }
/** * Marks the current WKT representation of the given object as not strictly compliant with the WKT specification. * This method can be invoked by implementations of {@link FormattableObject#formatTo(Formatter)} when the object * to format is more complex than what the WKT specification allows. * Applications can test {@link #isInvalidWKT()} later for checking WKT validity. * * @param unformattable the object that can not be formatted, * @param cause the cause for the failure to format, or {@code null} if the cause is not an exception. */ public void setInvalidWKT(final IdentifiedObject unformattable, final Exception cause) { ArgumentChecks.ensureNonNull("unformattable", unformattable); String name; final Identifier id = unformattable.getName(); if (id == null || (name = id.getCode()) == null) { name = getName(unformattable.getClass()); } setInvalidWKT(name, cause); }
/** * Marks the current WKT representation of the given object as not strictly compliant with the WKT specification. * This method can be invoked by implementations of {@link FormattableObject#formatTo(Formatter)} when the object * to format is more complex than what the WKT specification allows. * Applications can test {@link #isInvalidWKT()} later for checking WKT validity. * * @param unformattable the object that can not be formatted, * @param cause the cause for the failure to format, or {@code null} if the cause is not an exception. */ public void setInvalidWKT(final IdentifiedObject unformattable, final Exception cause) { ArgumentChecks.ensureNonNull("unformattable", unformattable); String name; final Identifier id = unformattable.getName(); if (id == null || (name = id.getCode()) == null) { name = getName(unformattable.getClass()); } setInvalidWKT(name, cause); }
/** * Formats this CRS as a <cite>Well Known Text</cite> {@code ImageCRS[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ImageCRS} are defined in the WKT 2 specification only.</div> * * @return {@code "ImageCRS"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return WKTKeywords.ImageCRS; }
/** * Formats this CRS as a <cite>Well Known Text</cite> {@code ImageCRS[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ImageCRS} are defined in the WKT 2 specification only.</div> * * @return {@code "ImageCRS"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return WKTKeywords.ImageCRS; }
/** * Formats the inner part of a <cite>Well Known Text</cite> version 1 (WKT 1) element. * * <div class="note"><b>Compatibility note:</b> * The {@code SPECIALIZABLE_MT} element formatted here is an Apache SIS-specific extension.</div> * * @param formatter the formatter to use. * @return the WKT element name, which is {@code "Specializable_MT"}. */ @Override protected final String formatTo(final Formatter formatter) { formatter.newLine(); formatter.append(global); for (SubArea domain : domains) { SubArea.format(domain, formatter); } formatter.setInvalidWKT(SpecializableTransform.class, null); return "Specializable_MT"; }
/** * Formats this coordinate operation in pseudo-WKT. This is specific to Apache SIS since * there is no concatenated operation in the Well Known Text (WKT) version 2 format. * * @param formatter the formatter to use. * @return {@code "ConcatenatedOperation"}. */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); for (final CoordinateOperation component : operations) { formatter.newLine(); formatter.append(castOrCopy(component)); } formatter.setInvalidWKT(this, null); return "ConcatenatedOperation"; }
/** * Formats this coordinate operation in pseudo-WKT. This is specific to Apache SIS since * there is no concatenated operation in the Well Known Text (WKT) version 2 format. * * @param formatter the formatter to use. * @return {@code "ConcatenatedOperation"}. */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); for (final CoordinateOperation component : operations) { formatter.newLine(); formatter.append(castOrCopy(component)); } formatter.setInvalidWKT(this, null); return "ConcatenatedOperation"; }
/** * Formats this datum as a <cite>Well Known Text</cite> {@code ParametricDatum[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ParametricDatum} is defined in the WKT 2 specification only.</div> * * @return {@code "ParametricDatum"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#83">WKT 2 specification</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return formatter.shortOrLong(WKTKeywords.PDatum, WKTKeywords.ParametricDatum); }
/** * Formats this CRS as a <cite>Well Known Text</cite> {@code ParametricCRS[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ParametricCRS} is defined in the WKT 2 specification only.</div> * * @return {@code "ParametricCRS"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#83">WKT 2 specification</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return isBaseCRS(formatter) ? WKTKeywords.BaseParamCRS : WKTKeywords.ParametricCRS; }
/** * Formats this CRS as a <cite>Well Known Text</cite> {@code TimeCRS[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code TimeCRS} is defined in the WKT 2 specification only.</div> * * @return {@code "TimeCRS"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#88">WKT 2 specification §14</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return isBaseCRS(formatter) ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS; }
/** * Formats this CRS as a <cite>Well Known Text</cite> {@code TimeCRS[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code TimeCRS} is defined in the WKT 2 specification only.</div> * * @return {@code "TimeCRS"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#88">WKT 2 specification §14</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return isBaseCRS(formatter) ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS; }
/** * Formats this CRS as a <cite>Well Known Text</cite> {@code ParametricCRS[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ParametricCRS} is defined in the WKT 2 specification only.</div> * * @return {@code "ParametricCRS"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#83">WKT 2 specification</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return isBaseCRS(formatter) ? WKTKeywords.BaseParamCRS : WKTKeywords.ParametricCRS; }
/** * Formats this datum as a <cite>Well Known Text</cite> {@code ParametricDatum[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ParametricDatum} is defined in the WKT 2 specification only.</div> * * @return {@code "ParametricDatum"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#83">WKT 2 specification</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return formatter.shortOrLong(WKTKeywords.PDatum, WKTKeywords.ParametricDatum); }
/** * Appends an enumeration or code list value. * The {@linkplain Symbols#getSeparator() element separator} will be written before the code list if needed. * * <p>For the WKT 2 format, this method uses the {@linkplain Types#getCodeName ISO name if available} * (for example {@code "northEast"}). * For the WKT 1 format, this method uses the programmatic name instead (for example {@code "NORTH_EAST"}).</p> * * @param code the code list to append to the WKT, or {@code null} if none. */ public void append(final CodeList<?> code) { if (code != null) { appendSeparator(); final String name = convention.majorVersion() == 1 ? code.name() : Types.getCodeName(code); if (CharSequences.isUnicodeIdentifier(name)) { setColor(ElementKind.CODE_LIST); buffer.append(name); resetColor(); } else { quote(name, ElementKind.CODE_LIST); setInvalidWKT(code.getClass(), null); } } }
/** * Formats this datum as a <cite>Well Known Text</cite> {@code ImageDatum[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ImageDatum} is defined in the WKT 2 specification only.</div> * * @return {@code "ImageDatum"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#81">WKT 2 specification §12.2</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); final Convention convention = formatter.getConvention(); if (convention == Convention.INTERNAL) { formatter.append(getPixelInCell()); // This is an extension compared to ISO 19162. } else if (convention.majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return formatter.shortOrLong(WKTKeywords.IDatum, WKTKeywords.ImageDatum); }
/** * Formats this datum as a <cite>Well Known Text</cite> {@code ImageDatum[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code ImageDatum} is defined in the WKT 2 specification only.</div> * * @return {@code "ImageDatum"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#81">WKT 2 specification §12.2</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); final Convention convention = formatter.getConvention(); if (convention == Convention.INTERNAL) { formatter.append(getPixelInCell()); // This is an extension compared to ISO 19162. } else if (convention.majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return formatter.shortOrLong(WKTKeywords.IDatum, WKTKeywords.ImageDatum); }
/** * Formats this datum as a <cite>Well Known Text</cite> {@code TimeDatum[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code TimeDatum} is defined in the WKT 2 specification only.</div> * * @return {@code "TimeDatum"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#90">WKT 2 specification §14.2</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); formatter.append(new Origin(getOrigin())); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return formatter.shortOrLong(WKTKeywords.TDatum, WKTKeywords.TimeDatum); }
/** * Formats this datum as a <cite>Well Known Text</cite> {@code TimeDatum[…]} element. * * <div class="note"><b>Compatibility note:</b> * {@code TimeDatum} is defined in the WKT 2 specification only.</div> * * @return {@code "TimeDatum"}. * * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#90">WKT 2 specification §14.2</a> */ @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); formatter.append(new Origin(getOrigin())); if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } return formatter.shortOrLong(WKTKeywords.TDatum, WKTKeywords.TimeDatum); }