CRS changes for revisions 25788:25789

This contribution has been rewritten in the next commit (revision 25792). Commit message is: "Take advantage from the fact that the center point is already projected by transform(MathTransform, …) methods: reuse that point instead of reprojecting it again".

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r25788:25789 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/CRS.java
Revision 25788Revision 25789
DirectPosition sourcePt = null;
DirectPosition targetPt = null;
final int dimension = targetCS.getDimension();
for (int i=0; i<dimension; i++) {
    final CoordinateSystemAxis axis = targetCS.getAxis(i);
    boolean testMax = false; // Tells if we are testing the minimal or maximal value.
DirectPosition sourcePt = null;
DirectPosition targetPt = null;
final int dimension = targetCS.getDimension();

// compute the center of the source envelope, and project it to the destination CRS
GeneralEnvelope source = new GeneralEnvelope(envelope);
source.setCoordinateReferenceSystem(operation.getSourceCRS());
DirectPosition projectedCenter = operation.getMathTransform().transform(source.getCenter(), null);

for (int i=0; i<dimension; i++) {
    final CoordinateSystemAxis axis = targetCS.getAxis(i);
    boolean testMax = false; // Tells if we are testing the minimal or maximal value.
}
targetPt = new GeneralDirectPosition(mt.getSourceDimensions());
for (int j=0; j<dimension; j++) {
    targetPt.setOrdinate(j, transformed.getCenter(j));
}
// TODO: avoid the hack below if we provide a contains(DirectPosition)
//       method in GeoAPI Envelope interface.
}
targetPt = new GeneralDirectPosition(mt.getSourceDimensions());
for (int j=0; j<dimension; j++) {
    targetPt.setOrdinate(j, projectedCenter.getOrdinate(j));
}
// TODO: avoid the hack below if we provide a contains(DirectPosition)
//       method in GeoAPI Envelope interface.