Mercator changes for revisions 25605:25606

The correction factor applied in this commit is the same correction factor than the one published in the formula of EPSG:9805 - Mercator (variant B) (a.k.a. Mercator (2SP)). Consequently after reverting this commit, the same correction factor is re-introduced as a side effect of Mercator (2SP) implementation, except that Apache SIS computes this factor once for ever at construction time and combines it with the global scale factor.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r25605:25606 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/Mercator.java
Revision 25605Revision 25606
        // No standard parallel. Instead, uses the scale factor explicitely provided.
        standardParallel = Double.NaN;
    }
    assert latitudeOfOrigin == 0 : latitudeOfOrigin;
}

/**
        // No standard parallel. Instead, uses the scale factor explicitely provided.
        standardParallel = Double.NaN;
    }
}

/**
            ErrorKeys.POLE_PROJECTION_$1, new Latitude(Math.toDegrees(y))));
}

y = - Math.log(tsfn(y, Math.sin(y)));

if (ptDst != null) {
    ptDst.setLocation(x,y);
    return ptDst;
             ErrorKeys.POLE_PROJECTION_$1, new Latitude(Math.toDegrees(y))));
 }

 // /////////////////////////////////////////////////////////////////////
//
// This correction allows us to employs a latitude of origin that is not
// correspondent to the equator. See Snyderet al. for reference, page
// 47.
//
// /////////////////////////////////////////////////////////////////////
final double sinPhi = Math.sin(latitudeOfOrigin);
final double scaleCorrection = (Math.cos(this.latitudeOfOrigin) / (Math
   .sqrt(1 - this.excentricitySquared * sinPhi * sinPhi)));

 x*=scaleCorrection;
y = -Math.log(tsfn(y, Math.sin(y)))
   * scaleCorrection;

 if (ptDst != null) {
     ptDst.setLocation(x,y);
     return ptDst;
protected Point2D inverseTransformNormalized(double x, double y, final Point2D ptDst)
        throws ProjectionException
{
    y = Math.exp(-y);
    y = cphi2(y);
protected Point2D inverseTransformNormalized(double x, double y, final Point2D ptDst)
        throws ProjectionException
{
    // /////////////////////////////////////////////////////////////////////
   //
   // This correction allows us to employs a latitude of origin that is not
   // correspondent to the equator. See Snyderet al. for reference, page
   // 47.
   //
   // /////////////////////////////////////////////////////////////////////
   final double sinPhi = Math.sin(latitudeOfOrigin);
   final double scaleCorrection = (Math.cos(this.latitudeOfOrigin) / (Math
      .sqrt(1 - this.excentricitySquared * sinPhi * sinPhi)));
   y/=scaleCorrection;
   x/=scaleCorrection;

    y = Math.exp(-y);
    y = cphi2(y);
// Compute using ellipsoidal formulas, for comparaison later.
assert (ptDst = super.transformNormalized(x, y, ptDst)) != null;

y = Math.log(Math.tan((Math.PI/4) + 0.5*y));

assert checkTransform(x, y, ptDst);
if (ptDst != null) {
    ptDst.setLocation(x,y);
 // Compute using ellipsoidal formulas, for comparaison later.
 assert (ptDst = super.transformNormalized(x, y, ptDst)) != null;

 // /////////////////////////////////////////////////////////////////////
//
// This correction allows us to employs a latitude of origin that is not
// correspondent to the equator. See Snyderet al. for reference, page
// 47.
//
// /////////////////////////////////////////////////////////////////////
final double sinPhi = Math.sin(latitudeOfOrigin);
final double scaleCorrection = (Math.cos(this.latitudeOfOrigin) / (Math
   .sqrt(1 - this.excentricitySquared * sinPhi * sinPhi)));

 x*=scaleCorrection;
 y = Math.log(Math.tan((Math.PI/4) + 0.5*y))*scaleCorrection;

 assert checkTransform(x, y, ptDst);
 if (ptDst != null) {
     ptDst.setLocation(x,y);
// Compute using ellipsoidal formulas, for comparaison later.
assert (ptDst = super.inverseTransformNormalized(x, y, ptDst)) != null;

y = (Math.PI/2) - 2.0*Math.atan(Math.exp(-y));

assert checkInverseTransform(x, y, ptDst);
 // Compute using ellipsoidal formulas, for comparaison later.
 assert (ptDst = super.inverseTransformNormalized(x, y, ptDst)) != null;

 // /////////////////////////////////////////////////////////////////////
//
// This correction allows us to employs a latitude of origin that is not
// correspondent to the equator. See Snyderet al. for reference, page
// 47.
//
// /////////////////////////////////////////////////////////////////////
final double sinPhi = Math.sin(latitudeOfOrigin);
final double scaleCorrection = (Math.cos(this.latitudeOfOrigin) / (Math
   .sqrt(1 - this.excentricitySquared * sinPhi * sinPhi)));
x/=scaleCorrection;
y/=scaleCorrection;

 y = (Math.PI/2) - 2.0*Math.atan(Math.exp(-y));

 assert checkInverseTransform(x, y, ptDst);