Search in sources :

Example 1 with DefaultQuantitativeResult

use of org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult in project sis by apache.

the class CustomAttribute method quality.

/**
 * Evaluates the quality of this attribute with a custom rule.
 */
@Override
public DataQuality quality() {
    final DefaultDataQuality quality = (DefaultDataQuality) super.quality();
    final DefaultDomainConsistency report = new DefaultDomainConsistency();
    final DefaultQuantitativeResult result = new DefaultQuantitativeResult();
    result.setErrorStatistic(new SimpleInternationalString(ADDITIONAL_QUALITY_INFO));
    report.setMeasureIdentification(new NamedIdentifier(getName()));
    report.setResults(singleton(result));
    quality.setReports(singleton(report));
    return quality;
}
Also used : DefaultDomainConsistency(org.apache.sis.metadata.iso.quality.DefaultDomainConsistency) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultDataQuality(org.apache.sis.metadata.iso.quality.DefaultDataQuality) DefaultQuantitativeResult(org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult)

Example 2 with DefaultQuantitativeResult

use of org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult 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

DefaultQuantitativeResult (org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult)2 DefaultAbsoluteExternalPositionalAccuracy (org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy)1 DefaultDataQuality (org.apache.sis.metadata.iso.quality.DefaultDataQuality)1 DefaultDomainConsistency (org.apache.sis.metadata.iso.quality.DefaultDomainConsistency)1 NamedIdentifier (org.apache.sis.referencing.NamedIdentifier)1 DefaultRecord (org.apache.sis.util.iso.DefaultRecord)1 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)1 PositionalAccuracy (org.opengis.metadata.quality.PositionalAccuracy)1