try {
if (node.hasAttribute("srsName")) {
CRS.decode(node.getAttributeValue("srsName").toString());
}
} catch (NoSuchAuthorityCodeException e) {
throw new WFSException("Invalid Authority Code: " + e.getAuthorityCode(),
"InvalidParameterValue");
}
Geometry geometry = (Geometry) super.parse(instance, node, value);
if (geometry != null) {
//1. ensure a crs is set
if (geometry.getUserData() == null) {
//no crs set for the geometry, did we inherit one from a parent?
if ( crs != null ) {
geometry.setUserData(crs);
} else {
// for the moment we don't do anything since we miss the information
// to infer the CRS from the feature type
}
}
//2. ensure the coordinates of the geometry fall into valid space defined by crs
CoordinateReferenceSystem crs = (CoordinateReferenceSystem) geometry.getUserData();
if(crs != null)
try {
JTS.checkCoordinatesRange(geometry, crs);
} catch(PointOutsideEnvelopeException e) {
throw new WFSException(e, "InvalidParameterValue");
}
}
return geometry;
}