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();
}
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;
}
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;
}
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);
}
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();
}
Aggregations