use of com.revolsys.geometry.cs.ParameterValueString in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadCoordOperationParamValue.
private static void loadCoordOperationParamValue(final IntHashMap<CoordinateOperationMethod> methodById, final IntHashMap<Map<ParameterName, ParameterValue>> operationParameters, final IntHashMap<List<Byte>> paramReversal) {
try (ChannelReader reader = newChannelReader("coordOperationParamValue")) {
while (true) {
final int operationId = reader.getInt();
final CoordinateOperationMethod method = readCode(reader, methodById);
final ParameterName parameterName = readCode(reader, PARAM_NAME_BY_ID);
final double value = reader.getDouble();
final String fileRef = reader.getStringUtf8ByteCount();
final UnitOfMeasure unit = readCode(reader, UNIT_BY_ID);
final ParameterValue parameterValue;
if (Double.isFinite(value)) {
if (Property.hasValue(fileRef)) {
throw new IllegalArgumentException("Cannot have a value and fileRef for coordOperationParamValue=" + operationId + " " + parameterName);
} else {
parameterValue = new ParameterValueNumber(unit, value);
}
} else {
if (Property.hasValue(fileRef)) {
parameterValue = new ParameterValueString(fileRef);
} else {
parameterValue = null;
}
}
Map<ParameterName, ParameterValue> parameterValues = operationParameters.get(operationId);
if (parameterValues == null) {
parameterValues = Maps.newLinkedHash();
final List<ParameterName> parameterOrder = method.getParameterNames();
for (final ParameterName orderParameterName : parameterOrder) {
parameterValues.put(orderParameterName, null);
}
operationParameters.put(operationId, parameterValues);
}
method.setParameter(parameterValues, parameterName, parameterValue);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
Logs.error(EpsgCoordinateSystems.class, "Error loading coordOperationParamValue", e);
}
}
}
Aggregations