Search in sources :

Example 1 with Parameters

use of org.apache.sis.parameter.Parameters 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 Parameters

use of org.apache.sis.parameter.Parameters in project sis by apache.

the class MapProjectionTestCase method parameters.

/**
 * Returns the parameters to use for instantiating the projection to test.
 * The parameters are initialized with the ellipse semi-axis lengths.
 *
 * @param  provider  the provider of the projection to test.
 * @param  ellipse   {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
 * @return the parameters to use for instantiating the projection.
 */
static Parameters parameters(final DefaultOperationMethod provider, final boolean ellipse) {
    final Parameters parameters = Parameters.castOrWrap(provider.getParameters().createValue());
    final Ellipsoid ellipsoid = (ellipse ? GeodeticDatumMock.WGS84 : GeodeticDatumMock.SPHERE).getEllipsoid();
    parameters.parameter(Constants.SEMI_MAJOR).setValue(ellipsoid.getSemiMajorAxis());
    parameters.parameter(Constants.SEMI_MINOR).setValue(ellipsoid.getSemiMinorAxis());
    if (ellipse) {
        parameters.parameter(Constants.INVERSE_FLATTENING).setValue(ellipsoid.getInverseFlattening());
    }
    return parameters;
}
Also used : Parameters(org.apache.sis.parameter.Parameters) Ellipsoid(org.opengis.referencing.datum.Ellipsoid)

Example 3 with Parameters

use of org.apache.sis.parameter.Parameters in project sis by apache.

the class NoOp method parameters.

/**
 * Work around for RFE #4093999 in Sun's bug database
 * ("Relax constraint on placement of this()/super() call in constructors").
 */
@Workaround(library = "JDK", version = "1.7")
private static Parameters parameters(final double semiMajor, final double semiMinor) {
    final ParameterValueGroup group = new ParameterBuilder().addName("No-operation").createGroupForMapProjection().createValue();
    group.parameter(Constants.SEMI_MAJOR).setValue(semiMajor);
    group.parameter(Constants.SEMI_MINOR).setValue(semiMinor);
    return (Parameters) group;
}
Also used : Parameters(org.apache.sis.parameter.Parameters) ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) ParameterBuilder(org.apache.sis.parameter.ParameterBuilder) Workaround(org.apache.sis.util.Workaround)

Example 4 with Parameters

use of org.apache.sis.parameter.Parameters in project sis by apache.

the class ObliqueStereographicTest method createNormalizedProjection.

/**
 * Creates a new instance of {@link ObliqueStereographic} for a sphere or an ellipsoid.
 * The new instance is stored in the inherited {@link #transform} field.
 *
 * @param  ellipse  {@code false} for the spherical case, or {@code true} for the ellipsoidal case.
 */
private void createNormalizedProjection(final boolean ellipse) {
    final OperationMethod op = new org.apache.sis.internal.referencing.provider.ObliqueStereographic();
    final ParameterValueGroup p = op.getParameters().createValue();
    /*
         * Following parameters are not given explicitely by EPSG definitions since they are
         * usually inferred from the datum.  However in the particular case of this test, we
         * need to provide them. The names used below are either OGC names or SIS extensions.
         */
    if (!ellipse) {
        p.parameter("semi_major").setValue(R);
        p.parameter("semi_minor").setValue(R);
    } else {
        p.parameter("semi_major").setValue(a);
        p.parameter("inverse_flattening").setValue(ivf);
    }
    /*
         * Following parameters are reproduced verbatim from EPSG registry and EPSG guide.
         */
    p.parameter("Latitude of natural origin").setValue(φ0, Units.RADIAN);
    p.parameter("Longitude of natural origin").setValue(λ0, Units.RADIAN);
    p.parameter("Scale factor at natural origin").setValue(k0);
    p.parameter("False easting").setValue(FE, Units.METRE);
    p.parameter("False northing").setValue(FN, Units.METRE);
    transform = new ObliqueStereographic(op, (Parameters) p);
}
Also used : Parameters(org.apache.sis.parameter.Parameters) ContextualParameters(org.apache.sis.referencing.operation.transform.ContextualParameters) ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) OperationMethod(org.opengis.referencing.operation.OperationMethod)

Example 5 with Parameters

use of org.apache.sis.parameter.Parameters in project sis by apache.

the class PolarStereographicTest method createNormalizedProjection.

/**
 * Creates a new instance of {@link PolarStereographic}.
 */
private void createNormalizedProjection(final MapProjection method) {
    final Parameters parameters = parameters(method, false);
    NormalizedProjection projection = new PolarStereographic(method, parameters);
    projection = new ProjectionResultComparator(projection, new PolarStereographic.Spherical((PolarStereographic) projection));
    transform = projection;
    tolerance = NORMALIZED_TOLERANCE;
    validate();
}
Also used : Parameters(org.apache.sis.parameter.Parameters)

Aggregations

Parameters (org.apache.sis.parameter.Parameters)26 MathTransform (org.opengis.referencing.operation.MathTransform)5 BursaWolfParameters (org.apache.sis.referencing.datum.BursaWolfParameters)4 MathTransformFactoryMock (org.apache.sis.referencing.operation.transform.MathTransformFactoryMock)4 NoninvertibleTransformException (org.opengis.referencing.operation.NoninvertibleTransformException)3 FactoryException (org.opengis.util.FactoryException)3 MatrixSIS (org.apache.sis.referencing.operation.matrix.MatrixSIS)2 ContextualParameters (org.apache.sis.referencing.operation.transform.ContextualParameters)2 StorageConnector (org.apache.sis.storage.StorageConnector)2 Debug (org.apache.sis.util.Debug)2 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)2 AffineTransform (java.awt.geom.AffineTransform)1 Path (java.nio.file.Path)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 Angle (javax.measure.quantity.Angle)1 Length (javax.measure.quantity.Length)1 ParameterizedAffine (org.apache.sis.internal.referencing.j2d.ParameterizedAffine)1 Equirectangular (org.apache.sis.internal.referencing.provider.Equirectangular)1 LambertConformal1SP (org.apache.sis.internal.referencing.provider.LambertConformal1SP)1 PolarStereographicNorth (org.apache.sis.internal.referencing.provider.PolarStereographicNorth)1