
org.geotoolkit.metadata.iso.quality.PositionalAccuracyConstant Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geotk-metadata Show documentation
Show all versions of geotk-metadata Show documentation
Implementations of metadata derived from ISO 19115. This module provides both an implementation
of the metadata interfaces defined in GeoAPI, and a framework for handling those metadata through
Java reflection.
The newest version!
/*
* Geotoolkit.org - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2009-2012, Open Source Geospatial Foundation (OSGeo)
* (C) 2009-2012, Geomatys
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* This package contains documentation from OpenGIS specifications.
* OpenGIS consortium's work is fully acknowledged here.
*/
package org.geotoolkit.metadata.iso.quality;
import java.util.Collections;
import java.io.ObjectStreamException;
import javax.xml.bind.annotation.XmlRootElement;
import net.jcip.annotations.ThreadSafe;
import org.opengis.util.InternationalString;
import org.opengis.metadata.quality.EvaluationMethodType;
import org.opengis.metadata.quality.AbsoluteExternalPositionalAccuracy;
import org.geotoolkit.lang.Workaround;
import org.geotoolkit.metadata.iso.citation.Citations;
/**
* Same as {@link DefaultAbsoluteExternalPositionalAccuracy} but in a different implementation class.
* This is needed in order to avoid a deadlock to occur when {@code DirectEpsgFactory} instantiates
* a {@code DefaultAbsoluteExternalPositionalAccuracy} in one thread while the static initializer of
* {@link AbstractPositionalAccuracy} is running in an other thread. This is a know issue with class
* initialization in Java without satisfying solution. The workaround applied here is to use a
* package-privated class that users can not instantiate themself.
*
* @author Martin Desruisseaux (Geomatys)
* @version 3.04
*
* @see Issue 4891511
*
* @since 3.00
* @module
*/
@ThreadSafe
@Workaround(library="JDK", version="1.6")
@XmlRootElement(name = "DQ_AbsoluteExternalPositionalAccuracy")
final class PositionalAccuracyConstant extends AbstractPositionalAccuracy
implements AbsoluteExternalPositionalAccuracy
{
/**
* Serial number for inter-operability with different versions.
*/
private static final long serialVersionUID = -2554090935254116470L;
/**
* Creates an positional accuracy initialized to the given result.
*/
PositionalAccuracyConstant(final InternationalString desc,
final InternationalString eval,
final boolean pass)
{
DefaultConformanceResult result = new DefaultConformanceResult(Citations.GEOTOOLKIT, eval, pass);
result.freeze();
setResults(Collections.singleton(result));
setMeasureDescription(desc);
setEvaluationMethodDescription(eval);
setEvaluationMethodType(EvaluationMethodType.DIRECT_INTERNAL);
freeze();
}
/**
* Invoked on deserialization. Replace this instance by one of the constants, if applicable.
*/
private Object readResolve() throws ObjectStreamException {
if (equals(DATUM_SHIFT_APPLIED)) return DATUM_SHIFT_APPLIED;
if (equals(DATUM_SHIFT_OMITTED)) return DATUM_SHIFT_OMITTED;
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy