Search in sources :

Example 1 with DefaultRecord

use of org.apache.sis.util.iso.DefaultRecord 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;
}
Also used : PositionalAccuracy(org.opengis.metadata.quality.PositionalAccuracy) DefaultAbsoluteExternalPositionalAccuracy(org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy) DefaultAbsoluteExternalPositionalAccuracy(org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy) DefaultRecord(org.apache.sis.util.iso.DefaultRecord) DefaultQuantitativeResult(org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult)

Aggregations

DefaultAbsoluteExternalPositionalAccuracy (org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy)1 DefaultQuantitativeResult (org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult)1 DefaultRecord (org.apache.sis.util.iso.DefaultRecord)1 PositionalAccuracy (org.opengis.metadata.quality.PositionalAccuracy)1