/** * Returns an error message for "No path found from sourceCRS to targetCRS". * This is used for the construction of {@link OperationNotFoundException}. * * @param source the source CRS. * @param target the target CRS. * @return a default error message. */ private static String notFoundMessage(final IdentifiedObject source, final IdentifiedObject target) { return Resources.format(Resources.Keys.CoordinateOperationNotFound_2, CRSPair.label(source), CRSPair.label(target)); }
/** * Returns an error message for "No path found from sourceCRS to targetCRS". * This is used for the construction of {@link OperationNotFoundException}. * * @param source the source CRS. * @param target the target CRS. * @return a default error message. */ private static String notFoundMessage(final IdentifiedObject source, final IdentifiedObject target) { return Resources.format(Resources.Keys.CoordinateOperationNotFound_2, CRSPair.label(source), CRSPair.label(target)); }
/** * Returns a name for an object derived from the specified one. * This method builds a name of the form "{@literal <original identifier>} (step 1)" * where "(step 1)" may be replaced by "(step 2)", "(step 3)", <i>etc.</i> if this * method has already been invoked for the same identifier (directly or indirectly). */ private Map<String,?> derivedFrom(final IdentifiedObject object) { Identifier oldID = object.getName(); Object p = identifierOfStepCRS.get(oldID); if (p instanceof Identifier) { oldID = (Identifier) p; p = identifierOfStepCRS.get(oldID); } final int count = (p != null) ? (Integer) p + 1 : 1; final Identifier newID = new NamedIdentifier(Citations.SIS, oldID.getCode() + " (step " + count + ')'); identifierOfStepCRS.put(newID, oldID); identifierOfStepCRS.put(oldID, count); final Map<String,Object> properties = new HashMap<>(4); properties.put(IdentifiedObject.NAME_KEY, newID); properties.put(IdentifiedObject.REMARKS_KEY, Vocabulary.formatInternational( Vocabulary.Keys.DerivedFrom_1, CRSPair.label(object))); return properties; }
/** * Returns a name for an object derived from the specified one. * This method builds a name of the form "{@literal <original identifier>} (step 1)" * where "(step 1)" may be replaced by "(step 2)", "(step 3)", <i>etc.</i> if this * method has already been invoked for the same identifier (directly or indirectly). */ private Map<String,?> derivedFrom(final IdentifiedObject object) { Identifier oldID = object.getName(); Object p = identifierOfStepCRS.get(oldID); if (p instanceof Identifier) { oldID = (Identifier) p; p = identifierOfStepCRS.get(oldID); } final int count = (p != null) ? (Integer) p + 1 : 1; final Identifier newID = new NamedIdentifier(Citations.SIS, oldID.getCode() + " (step " + count + ')'); identifierOfStepCRS.put(newID, oldID); identifierOfStepCRS.put(oldID, count); final Map<String,Object> properties = new HashMap<>(4); properties.put(IdentifiedObject.NAME_KEY, newID); properties.put(IdentifiedObject.REMARKS_KEY, Vocabulary.formatInternational( Vocabulary.Keys.DerivedFrom_1, CRSPair.label(object))); return properties; }