use of org.opengis.util.InternationalString in project sis by apache.
the class MetadataBuilder method addSampleValueDescription.
/**
* Adds a description of a particular sample value.
* Storage location is:
*
* <ul>
* <li>{@code metadata/contentInfo/rangeElementDescription}</li>
* </ul>
*
* <div class="note"><b>Note:</b>
* ISO 19115 range elements are approximatively equivalent to
* {@code org.apache.sis.coverage.Category} in the {@code sis-coverage} module.</div>
*
* @param name designation associated with a set of range elements, or {@code null} if none.
* @param definition description of a set of specific range elements, or {@code null} if none.
*/
public void addSampleValueDescription(final CharSequence name, final CharSequence definition) {
final InternationalString i18n = trim(name);
final InternationalString def = trim(definition);
if (i18n != null && def != null) {
final DefaultRangeElementDescription element = new DefaultRangeElementDescription();
element.setName(i18n);
element.setDefinition(def);
addIfNotPresent(coverageDescription().getRangeElementDescriptions(), element);
}
}
use of org.opengis.util.InternationalString in project sis by apache.
the class MetadataBuilder method addSupplementalInformation.
/**
* Adds any other descriptive information about the resource.
* If information already exists, the new one will be appended after a new line.
* Storage location is:
*
* <ul>
* <li>{@code metadata/identificationInfo/supplementalInformation}</li>
* </ul>
*
* @param info any other descriptive information about the resource, or {@code null} for no-operation.
*/
public final void addSupplementalInformation(final CharSequence info) {
final InternationalString i18n = trim(info);
if (i18n != null) {
final DefaultDataIdentification identification = identification();
identification.setSupplementalInformation(append(identification.getSupplementalInformation(), i18n));
}
}
use of org.opengis.util.InternationalString in project sis by apache.
the class MetadataBuilder method append.
/**
* Returns the concatenation of the given strings. The previous string may be {@code null}.
* This method does nothing if the previous string already contains the one to append.
*/
private static InternationalString append(final InternationalString previous, final InternationalString toAdd) {
if (previous == null) {
return toAdd;
}
final String p = previous.toString();
final String a = toAdd.toString();
if (p.contains(a)) {
return previous;
}
return Types.toInternationalString(p + System.lineSeparator() + a);
}
use of org.opengis.util.InternationalString in project sis by apache.
the class MetadataBuilder method addHostComputer.
/**
* Adds information about the computer and/or operating system in use at the processing time.
* This is added to the processing identified by last call to {@link #addProcessing(CharSequence, String)}.
* Storage location is:
*
* <ul>
* <li>{@code metadata/resourceLineage/processStep/processingInformation/procedureDescription}</li>
* </ul>
*
* @param platform name of the system on which the processing has been executed, or {@code null} for no-operation.
*/
public final void addHostComputer(final CharSequence platform) {
InternationalString i18n = trim(platform);
if (i18n != null) {
i18n = Resources.formatInternational(Resources.Keys.ProcessingExecutedOn_1, i18n);
final DefaultProcessing p = processing();
p.setProcedureDescription(append(p.getProcedureDescription(), i18n));
}
}
use of org.opengis.util.InternationalString in project sis by apache.
the class FeatureFormat method formatValue.
/**
* Appends the given attribute value, in a truncated form if it exceed the maximal value length.
*
* @param value the value to append.
* @param table where to append the value.
* @param length number of characters appended before this method call in the current table cell.
* @return number of characters appended after this method call in the current table cell, or -1 if
* the length exceed the maximal length (in which case the caller should break iteration).
*/
private int formatValue(final Object value, final TableAppender table, final int length) {
String text;
if (value instanceof InternationalString) {
text = ((InternationalString) value).toString(displayLocale);
} else if (value instanceof GenericName) {
text = toString((GenericName) value);
} else if (value instanceof AbstractIdentifiedType) {
text = toString(((AbstractIdentifiedType) value).getName());
} else if (value instanceof IdentifiedObject) {
text = IdentifiedObjects.getIdentifierOrName((IdentifiedObject) value);
} else if ((text = Geometries.toString(value)) == null) {
text = value.toString();
}
final int remaining = MAXIMAL_VALUE_LENGTH - length;
if (remaining >= text.length()) {
table.append(text);
return length + text.length();
} else {
table.append(text, 0, Math.max(0, remaining - 1)).append('…');
return -1;
}
}
Aggregations