use of org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy in project sis by apache.
the class TransformationAccuracy method create.
/**
* Creates a positional accuracy for the given value, in metres.
* This method may return a cached value.
*
* @param accuracy the accuracy in metres.
* @return a positional accuracy with the given value.
*/
public static PositionalAccuracy create(final Double accuracy) {
PositionalAccuracy p = CACHE.get(accuracy);
if (p == null) {
final DefaultRecord record = new DefaultRecord(TYPE);
record.setAll(accuracy);
final DefaultQuantitativeResult result = new DefaultQuantitativeResult();
result.setValues(Collections.singletonList(record));
// In metres by definition in the EPSG database.
result.setValueUnit(Units.METRE);
result.setValueType(TYPE);
final DefaultAbsoluteExternalPositionalAccuracy element = new DefaultAbsoluteExternalPositionalAccuracy(result);
element.setNamesOfMeasure(Collections.singleton(TRANSFORMATION_ACCURACY));
element.setEvaluationMethodType(EvaluationMethodType.DIRECT_EXTERNAL);
element.freeze();
p = CACHE.putIfAbsent(accuracy, element);
if (p == null) {
p = element;
}
}
return p;
}
Aggregations