/** * Constructs a new map projection from the supplied parameters. * * @param parameters The parameter values in standard units. * @throws ParameterNotFoundException if a mandatory parameter is missing. */ protected EquidistantCylindrical(final ParameterValueGroup parameters) throws ParameterNotFoundException { // Fetch parameters super(parameters); final Collection<GeneralParameterDescriptor> expected = getParameterDescriptors().descriptors(); if (expected.contains(Provider.STANDARD_PARALLEL_1)) { standardParallel = abs(doubleValue(expected, Provider.STANDARD_PARALLEL_1, parameters)); ensureLatitudeInRange(Provider.STANDARD_PARALLEL_1, standardParallel, false); cosStandardParallel = cos(standardParallel); } else { // standard parallel is the equator (Plate Carree or Equirectangular) standardParallel = 0; cosStandardParallel = 1.0; } assert latitudeOfOrigin == 0 : latitudeOfOrigin; }
/** Compares the specified object with this map projection for equality. */ @Override public boolean equals(final Object object) { if (object == this) { // Slight optimization return true; } if (super.equals(object)) { final EquidistantCylindrical that = (EquidistantCylindrical) object; return equals(this.standardParallel, that.standardParallel); } return false; }
/** {@inheritDoc} */ @Override public ParameterValueGroup getParameterValues() { final ParameterValueGroup values = super.getParameterValues(); if (!Double.isNaN(standardParallel)) { final Collection<GeneralParameterDescriptor> expected = getParameterDescriptors().descriptors(); set(expected, Provider.STANDARD_PARALLEL_1, values, standardParallel); } return values; }
/** * Creates a transform from the specified group of parameter values. * * @param parameters The group of parameter values. * @return The created math transform. * @throws ParameterNotFoundException if a required parameter was not found. * @throws FactoryException if the projection can not be created. */ protected MathTransform createMathTransform(final ParameterValueGroup parameters) throws ParameterNotFoundException, FactoryException { if (!isSpherical(parameters)) { LOGGER.log( Level.FINE, "GeoTools EquidistantCylindrical is defined only on the sphere, " + "we're going to use spherical equations even if the projection is using an ellipsoid"); } return new EquidistantCylindrical(parameters); } }