use of org.opengis.metadata.Identifier in project sis by apache.
the class MetadataBuilder method addProcessing.
/**
* Adds information about the procedure, process and algorithm applied in a process step.
* If a processing was already defined with a different identifier, then a new processing
* instance will be created. Storage location is:
*
* <ul>
* <li>{@code metadata/resourceLineage/processStep/processingInformation/identifier}</li>
* </ul>
*
* @param authority identifies the authority that defines processing code, or {@code null} if none.
* @param identifier processing package that produced the data, or {@code null} for no-operation.
*
* @see #addSoftwareReference(CharSequence)
* @see #addHostComputer(CharSequence)
*/
public final void addProcessing(final CharSequence authority, String identifier) {
if (identifier != null && !(identifier = identifier.trim()).isEmpty()) {
if (processing != null) {
final Identifier current = processing.getIdentifier();
if (current != null) {
if (identifier.equals(current.getCode())) {
return;
}
processStep().setProcessingInformation(processing);
addIfNotPresent(lineage().getProcessSteps(), processStep);
processing = null;
processStep = null;
}
}
processing().setIdentifier(sharedIdentifier(authority, identifier));
}
}
use of org.opengis.metadata.Identifier in project sis by apache.
the class GeodeticObjectParser method parseMethod.
/**
* Parses a {@code "Method"} (WKT 2) element, without the parameters.
*
* @param parent the parent element.
* @param keywords the element keywords.
* @return the operation method.
* @throws ParseException if the {@code "Method"} element can not be parsed.
*/
private OperationMethod parseMethod(final Element parent, final String... keywords) throws ParseException {
final Element element = parent.pullElement(MANDATORY, keywords);
final String name = element.pullString("method");
Map<String, ?> properties = parseMetadataAndClose(element, name, null);
// See NOTE 2 in parseDerivingConversion.
final Identifier id = toIdentifier(properties.remove(IdentifiedObject.IDENTIFIERS_KEY));
/*
* The map projection method may be specified by an EPSG identifier (or any other authority),
* which is preferred to the method name since the later is potentially ambiguous. However not
* all CoordinateOperationFactory may accept identifier as an argument to 'getOperationMethod'.
* So if an identifier is present, we will try to use it but fallback on the name if we can
* not use the identifier.
*/
FactoryException suppressed = null;
if (id instanceof ReferenceIdentifier)
try {
// CodeSpace is a mandatory attribute in ID[…] elements, so we do not test for null values.
return referencing.getOperationMethod(opFactory, mtFactory, ((ReferenceIdentifier) id).getCodeSpace() + DefaultNameSpace.DEFAULT_SEPARATOR + id.getCode());
} catch (FactoryException e) {
suppressed = e;
}
try {
return referencing.getOperationMethod(opFactory, mtFactory, name);
} catch (FactoryException e) {
if (suppressed != null) {
e.addSuppressed(suppressed);
}
throw element.parseFailed(e);
}
}
use of org.opengis.metadata.Identifier in project sis by apache.
the class SimpleIdentifiedObject method hashCode.
/**
* Returns a hash code value for this object.
*/
@Override
public final int hashCode() {
int code = (int) serialVersionUID;
final Identifier name = getName();
if (name != null) {
code ^= name.hashCode();
}
return code;
}
use of org.opengis.metadata.Identifier in project sis by apache.
the class InverseOperationMethod method create.
/**
* Returns or create the inverse of the given operation method. If the same operation method can be used
* for the inverse operation either with the exact same parameter values or with the sign of some values
* reversed, then the given method is returned as-is. Otherwise a synthetic method is created.
*/
static OperationMethod create(final OperationMethod method) {
if (method instanceof InverseOperationMethod) {
return ((InverseOperationMethod) method).inverse;
}
if (!isInvertible(method)) {
boolean useSameParameters = false;
for (final GeneralParameterDescriptor descriptor : method.getParameters().descriptors()) {
useSameParameters = (descriptor.getRemarks() instanceof SignReversalComment);
if (!useSameParameters)
break;
}
if (!useSameParameters) {
Identifier name = method.getName();
name = new ImmutableIdentifier(null, null, "Inverse of " + name.getCode());
final Map<String, Object> properties = new HashMap<>(6);
properties.put(NAME_KEY, name);
properties.put(FORMULA_KEY, method.getFormula());
properties.put(REMARKS_KEY, method.getRemarks());
if (method instanceof Deprecable) {
properties.put(DEPRECATED_KEY, ((Deprecable) method).isDeprecated());
}
return new InverseOperationMethod(properties, method);
}
}
return method;
}
use of org.opengis.metadata.Identifier in project sldeditor by robward-scisys.
the class CoordManager method populateCRSList.
/**
* Populate crs list.
*/
public void populateCRSList() {
if (isPopulated()) {
Runnable runnable = () -> {
VendorOptionVersion vendorOptionVersion = VendorOptionManager.getInstance().getDefaultVendorOptionVersion();
ValueComboBoxData notSetValue = new ValueComboBoxData(NOT_SET_CRS, Localisation.getString(CoordManager.class, "common.notSet"), vendorOptionVersion);
crsDataList.add(notSetValue);
Hints hints = null;
for (AuthorityFactory factory : ReferencingFactoryFinder.getCRSAuthorityFactories(hints)) {
String authorityCode = NOT_SET_CRS;
Citation citation = factory.getAuthority();
if (citation != null) {
@SuppressWarnings("unchecked") Collection<Identifier> identifierList = (Collection<Identifier>) citation.getIdentifiers();
authorityCode = identifierList.iterator().next().getCode();
}
Set<String> codeList;
try {
codeList = factory.getAuthorityCodes(CoordinateReferenceSystem.class);
for (String code : codeList) {
String fullCode = String.format("%s:%s", authorityCode, code);
String descriptionText = factory.getDescriptionText(code).toString();
String text = String.format("%s - %s", fullCode, descriptionText);
ValueComboBoxData value = new ValueComboBoxData(fullCode, text, vendorOptionVersion);
crsDataList.add(value);
crsMap.put(fullCode, value);
}
} catch (NoSuchAuthorityCodeException e) {
// ConsoleManager.getInstance().exception(this, e);
} catch (FactoryException e) {
ConsoleManager.getInstance().exception(this, e);
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
}
Aggregations