// PENDING(NL): Add code to check for CRS compatibility
// Must consider possibility that this is a pixel envelope
// rather than geo coordinate; only way to be sure is to check Units
DirectPosition topCorner = envelope.getUpperCorner();
DirectPosition botCorner = envelope.getLowerCorner();
DirectPosition topLeft = new DirectPositionImpl(topCorner);
DirectPosition botRight = new DirectPositionImpl(botCorner);
//Again, making assumption we can ignore this LatLonAlt stuff - colin
/*
// If the Envelope coordinates are LatLonAlts,
// calling setOrdinate causes Error-level logging messages,
// including a stack trace,
// though it still works. But in principal we should
// call get/setLat and get/setLon instead if we have LatLonAlts
if (topLeft instanceof LatLonAlt && botRight instanceof LatLonAlt) {
((LatLonAlt) topLeft).setLon(((LatLonAlt)
botCorner).getLon(NonSI.DEGREE_ANGLE), NonSI.DEGREE_ANGLE);
((LatLonAlt) botRight).setLon(((LatLonAlt)
topCorner).getLon(NonSI.DEGREE_ANGLE), NonSI.DEGREE_ANGLE);
} else {*/
topLeft.setOrdinate(1, botCorner.getOrdinate(1));
botRight.setOrdinate(1, topCorner.getOrdinate(1));
//}//end of else statment associated with above LatLongAlt stuff
// Create a JTS Envelope
Coordinate jtsTopRight =
JTSUtils.directPositionToCoordinate(topCorner);