/** * 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. */ public MathTransform createMathTransform(final ParameterValueGroup parameters) throws ParameterNotFoundException { return new Gnomonic(parameters); } }
/** * Constructs a gnomonic projection using a spheroid algorithm. * * @param parameters The parameter values in standard units. * @throws ParameterNotFoundException if a mandatory parameter is missing. */ protected Gnomonic(final ParameterValueGroup parameters) throws ParameterNotFoundException { super(parameters); final Collection<GeneralParameterDescriptor> expected = getParameterDescriptors().descriptors(); latitudeOfCentre = doubleValue(expected, Provider.LATITUDE_OF_CENTRE, parameters); centralMeridian = doubleValue(expected, Provider.LONGITUDE_OF_CENTRE, parameters); ensureLatitudeInRange(Provider.LATITUDE_OF_CENTRE, latitudeOfCentre, true); ensureLongitudeInRange(Provider.LONGITUDE_OF_CENTRE, centralMeridian, true); sinPhi0 = sin(latitudeOfCentre); cosPhi0 = cos(latitudeOfCentre); primeVert0 = 1 / sqrt(1.0 - excentricitySquared * sinPhi0 * sinPhi0); projectedCylindricalZ0 = primeVert0 * sinPhi0; }
/** {@inheritDoc} */ @Override public ParameterValueGroup getParameterValues() { final ParameterValueGroup values = super.getParameterValues(); final Collection<GeneralParameterDescriptor> expected = getParameterDescriptors().descriptors(); set(expected, Provider.LATITUDE_OF_CENTRE, values, latitudeOfCentre); set(expected, Provider.LONGITUDE_OF_CENTRE, values, centralMeridian); return values; }
/** * Transforms the specified (<var>x</var>,<var>y</var>) coordinates and stores the result in * {@code ptDst}. */ @Override protected Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) { final double normalisedCylindricalZ = sinPhi0 * (primeVert0 * (1.0 - excentricitySquared)) + cosPhi0 * y; final double primeVerticalCylindricalRadius = cosPhi0 * primeVert0 - sinPhi0 * y; final double lambda = atan2(x, primeVerticalCylindricalRadius); final double normalisedCylindricalRadius = hypot(x, primeVerticalCylindricalRadius); final double phi = getLatitudeFromPolar(normalisedCylindricalRadius, normalisedCylindricalZ); if (ptDst != null) { ptDst.setLocation(lambda, phi); return ptDst; } return new Point2D.Double(lambda, phi); }
/** 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 Gnomonic that = (Gnomonic) object; return equals(this.latitudeOfCentre, that.latitudeOfCentre); } return false; }