Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Geotoolkit.org - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2004-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.
*/
package org.geotoolkit.referencing.operation.provider;
import java.io.IOException;
import net.jcip.annotations.Immutable;
import org.opengis.util.FactoryException;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.Transformation;
import org.opengis.referencing.ReferenceIdentifier;
import org.geotoolkit.parameter.Parameters;
import org.geotoolkit.parameter.DefaultParameterDescriptor;
import org.geotoolkit.metadata.iso.citation.Citations;
import org.geotoolkit.internal.io.Installation;
import org.geotoolkit.referencing.NamedIdentifier;
import org.geotoolkit.referencing.operation.MathTransformProvider;
import org.geotoolkit.referencing.operation.transform.NadconTransform;
import org.geotoolkit.resources.Vocabulary;
import org.geotoolkit.util.logging.Logging;
/**
* The provider for "North American Datum Conversion" (EPSG:9613). The math
* transform implementations instantiated by this provider may be any of the following classes:
*
The following table summarizes the parameters recognized by this provider.
* For a more detailed parameter list, see the {@link #PARAMETERS} constant.
*
Operation name: {@code NADCON}
*
*
Parameter name
Default value
*
{@code Latitude difference file}
{@code "conus.las"}
*
{@code Longitude difference file}
{@code "conus.los"}
*
*
*
* {@section Grid data}
* This transform requires data that are not bundled by default with Geotk. Run the
* geotk-setup module
* for downloading and installing the grid data.
*
* @author Rueben Schulz (UBC)
* @author Martin Desruisseaux (Geomatys)
* @version 3.20
*
* @see Geotk coordinate operations matrix
*
* @since 2.1
* @module
*/
@Immutable
public class NADCON extends MathTransformProvider {
/**
* Serial number for inter-operability with different versions.
*/
private static final long serialVersionUID = -4707304160205218546L;
/**
* The operation parameter descriptor for the Latitude difference file
* parameter value. The default value is {@code "conus.las"}.
*
* @deprecated Invoke {@linkplain #PARAMETERS}.{@linkplain ParameterDescriptorGroup#descriptor(String)
* descriptor(String)} instead.
*/
@Deprecated
public static final ParameterDescriptor LAT_DIFF_FILE = new DefaultParameterDescriptor(
Citations.EPSG, "Latitude difference file", String.class, null, "conus.las", null, null, null, true);
/**
* The operation parameter descriptor for the Longitude difference file
* parameter value. The default value is {@code "conus.los"}.
*
* @deprecated Invoke {@linkplain #PARAMETERS}.{@linkplain ParameterDescriptorGroup#descriptor(String)
* descriptor(String)} instead.
*/
@Deprecated
public static final ParameterDescriptor LONG_DIFF_FILE = new DefaultParameterDescriptor(
Citations.EPSG, "Longitude difference file", String.class, null, "conus.los", null, null, null, true);
/**
* The group of all parameters expected by this coordinate operation.
* The following table lists the operation names and the parameters recognized by Geotk:
*
*
*
*
*
*
Name:
EPSG:
NADCON
*
Alias:
Geotk:
NADCON transform
*
Identifier:
EPSG:
9613
*
*
*
*
*
Name:
EPSG:
Latitude difference file
*
*
*
*
Type:
{@code String}
*
Obligation:
mandatory
*
Default value:
{@code "conus.las"}
*
*
*
*
*
Name:
EPSG:
Longitude difference file
*
*
*
*
Type:
{@code String}
*
Obligation:
mandatory
*
Default value:
{@code "conus.los"}
*
*
*
*/
public static final ParameterDescriptorGroup PARAMETERS = UniversalParameters.createDescriptorGroup(
new ReferenceIdentifier[] {
new NamedIdentifier(Citations.EPSG, "NADCON"),
new IdentifierCode (Citations.EPSG, 9613),
new NamedIdentifier(Citations.GEOTOOLKIT, Vocabulary.formatInternational(
Vocabulary.Keys.NADCON_TRANSFORM))
}, null, new ParameterDescriptor>[] {
LAT_DIFF_FILE,
LONG_DIFF_FILE
}, 0);
/**
* Constructs a provider.
*/
public NADCON() {
super(2, 2, PARAMETERS);
}
/**
* Returns {@code true} if the NADCON data seem to be present. This method checks for the existence
* of {@code "conus.las"} and {@code "conus.los"} (continental United States) files, using the same
* search criterion than the one applied by the {@linkplain NadconTransform#NadconTransform(String,
* String) transform constructor}.
*
* Some optional data can be automatically downloaded and installed by running the
* geotk-setup module.
*
* @return {@code true} if NADCON data seem to be present.
*/
public static boolean isAvailable() {
try {
return Installation.NADCON.exists(NadconTransform.class, "conus.las") &&
Installation.NADCON.exists(NadconTransform.class, "conus.los");
} catch (IOException e) {
Logging.recoverableException(NADCON.class, "isAvailable", e);
return false;
}
}
/**
* Returns the operation type.
*/
@Override
public Class getOperationType() {
return Transformation.class;
}
/**
* Creates a math transform from the specified group of parameter values.
*
* @throws FactoryException If the grid files can not be loaded.
*/
@Override
protected MathTransform createMathTransform(final ParameterValueGroup values) throws FactoryException {
final String latitudeGridFile = Parameters.stringValue(LAT_DIFF_FILE, values);
final String longitudeGridFile = Parameters.stringValue(LONG_DIFF_FILE, values);
return new NadconTransform(longitudeGridFile, latitudeGridFile);
}
}