if (gridCRS.getGridType().equals(GridType.GT2dSimpleGrid))
offsets = new Double[] { 1.0, 1.0 };
else
offsets = new Double[] { 1.0, 0.0, 0.0, 1.0 };
} else {
AffineTransform2D affine = (AffineTransform2D) gridToCRS;
if (gridCRS.getGridType().equals(GridType.GT2dSimpleGrid))
offsets = new Double[] { affine.getScaleX(), affine.getScaleY() };
else
offsets = new Double[] { affine.getScaleX(), affine.getShearX(),
affine.getShearY(), affine.getScaleY() };
}
}
// building the actual transform for the resulting grid geometry
AffineTransform tx;
if (gridCRS.getGridType().equals(GridType.GT2dSimpleGrid.getXmlConstant())) {
tx = new AffineTransform(offsets[0], 0, 0, offsets[1], origin[0], origin[1]);
} else {
tx = new AffineTransform(offsets[0], offsets[2], offsets[1], offsets[3],
origin[0], origin[1]);
}
gridToCRS = new AffineTransform2D(tx);
}
// now we have enough info to read the coverage, grab the parameters
// and add the grid geometry info
final Map parameters = CoverageUtils.getParametersKVP(reader.getFormat()