Search in sources :

Example 1 with MathTransformFactoryMock

use of org.apache.sis.referencing.operation.transform.MathTransformFactoryMock in project sis by apache.

the class EquirectangularTest method createCompleteProjection.

/**
 * Initializes a simple Equirectangular projection on sphere. This method is different than the
 * {@code createNormalizedProjection(boolean)} method in all other test classes, because it does
 * not create an instance of {@link NormalizedProjection}. Instead, it creates an affine transform
 * for the whole projection (not only the normalized part).
 */
private void createCompleteProjection() throws FactoryException {
    final Equirectangular provider = new Equirectangular();
    final Parameters parameters = parameters(provider, false);
    transform = new MathTransformFactoryMock(provider).createParameterizedTransform(parameters);
    // Not NORMALIZED_TOLERANCE since this is not a NormalizedProjection.
    tolerance = Formulas.LINEAR_TOLERANCE;
    validate();
}
Also used : Equirectangular(org.apache.sis.internal.referencing.provider.Equirectangular) Parameters(org.apache.sis.parameter.Parameters) MathTransformFactoryMock(org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)

Example 2 with MathTransformFactoryMock

use of org.apache.sis.referencing.operation.transform.MathTransformFactoryMock in project sis by apache.

the class ZonedGridSystemTest method createProjection.

/**
 * Creates a new instance of {@link ZonedGridSystem}.
 *
 * @param  ellipse  {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
 */
private void createProjection(final boolean ellipse) throws FactoryException {
    final ZonedTransverseMercator method = new ZonedTransverseMercator();
    final Parameters values = parameters(method, ellipse);
    values.parameter(Constants.SCALE_FACTOR).setValue(0.9996, Units.UNITY);
    values.parameter(Constants.FALSE_EASTING).setValue(500000, Units.METRE);
    values.parameter("Initial longitude").setValue(-180, Units.DEGREE);
    values.parameter("Zone width").setValue(6, Units.DEGREE);
    transform = new MathTransformFactoryMock(method).createParameterizedTransform(values);
    tolerance = Formulas.LINEAR_TOLERANCE;
    validate();
}
Also used : Parameters(org.apache.sis.parameter.Parameters) ZonedTransverseMercator(org.apache.sis.internal.referencing.provider.ZonedTransverseMercator) MathTransformFactoryMock(org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)

Example 3 with MathTransformFactoryMock

use of org.apache.sis.referencing.operation.transform.MathTransformFactoryMock in project sis by apache.

the class MapProjectionTestCase method createCompleteProjection.

/**
 * Initializes a complete projection (including conversion from degrees to radians) for the given provider.
 */
final void createCompleteProjection(final DefaultOperationMethod provider, final double semiMajor, final double semiMinor, final double centralMeridian, final double latitudeOfOrigin, final double standardParallel1, final double standardParallel2, final double scaleFactor, final double falseEasting, final double falseNorthing) throws FactoryException {
    final Parameters values = Parameters.castOrWrap(provider.getParameters().createValue());
    values.parameter(Constants.SEMI_MAJOR).setValue(semiMajor);
    values.parameter(Constants.SEMI_MINOR).setValue(semiMinor);
    if (semiMajor == WGS84_A && semiMinor == WGS84_B) {
        values.parameter(Constants.INVERSE_FLATTENING).setValue(298.257223563);
    }
    if (!isNaN(centralMeridian))
        values.parameter(Constants.CENTRAL_MERIDIAN).setValue(centralMeridian);
    if (!isNaN(latitudeOfOrigin))
        values.parameter(Constants.LATITUDE_OF_ORIGIN).setValue(latitudeOfOrigin);
    if (!isNaN(standardParallel1))
        values.parameter(Constants.STANDARD_PARALLEL_1).setValue(standardParallel1);
    if (!isNaN(standardParallel2))
        values.parameter(Constants.STANDARD_PARALLEL_2).setValue(standardParallel2);
    if (!isNaN(scaleFactor))
        values.parameter(Constants.SCALE_FACTOR).setValue(scaleFactor);
    if (!isNaN(falseEasting))
        values.parameter(Constants.FALSE_EASTING).setValue(falseEasting);
    if (!isNaN(falseNorthing))
        values.parameter(Constants.FALSE_NORTHING).setValue(falseNorthing);
    transform = new MathTransformFactoryMock(provider).createParameterizedTransform(values);
    validate();
}
Also used : Parameters(org.apache.sis.parameter.Parameters) MathTransformFactoryMock(org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)

Example 4 with MathTransformFactoryMock

use of org.apache.sis.referencing.operation.transform.MathTransformFactoryMock in project sis by apache.

the class PolarStereographicTest method testPolarStereographicNorth.

/**
 * Tests <cite>"Stereographic North Pole"</cite>. The tested point is adapted from
 * <a href="http://www.remotesensing.org/geotiff/proj_list/polar_stereographic.html">Polar Stereographic
 * on remotesensing.org</a>.
 *
 * @throws FactoryException if an error occurred while creating the map projection.
 * @throws TransformException if an error occurred while projecting a coordinate.
 */
@Test
public void testPolarStereographicNorth() throws FactoryException, TransformException {
    final PolarStereographicNorth method = new PolarStereographicNorth();
    final Parameters pg = parameters(method, true);
    pg.parameter("standard_parallel_1").setValue(71.0);
    pg.parameter("central_meridian").setValue(-96.0);
    transform = new MathTransformFactoryMock(method).createParameterizedTransform(pg);
    tolerance = 0.02;
    verifyTransform(new double[] { // 121°20'22.380"W
    -121 - (20 + 22.380 / 60) / 60, // 39°06'04.508"N
    39 + (6 + 4.508 / 60) / 60 }, new double[] { -2529570, -5341800 });
}
Also used : Parameters(org.apache.sis.parameter.Parameters) PolarStereographicNorth(org.apache.sis.internal.referencing.provider.PolarStereographicNorth) MathTransformFactoryMock(org.apache.sis.referencing.operation.transform.MathTransformFactoryMock) Test(org.junit.Test)

Aggregations

Parameters (org.apache.sis.parameter.Parameters)4 MathTransformFactoryMock (org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)4 Equirectangular (org.apache.sis.internal.referencing.provider.Equirectangular)1 PolarStereographicNorth (org.apache.sis.internal.referencing.provider.PolarStereographicNorth)1 ZonedTransverseMercator (org.apache.sis.internal.referencing.provider.ZonedTransverseMercator)1 Test (org.junit.Test)1