//DJB: the WMS spec says that the request must not be 0 area
// if it is, throw a service exception!
Envelope env = request.getBbox();
if (env.isNull() || (env.getWidth() <=0)|| (env.getHeight() <=0)){
throw new WmsException("The request bounding box has zero area: " + env);
}
// DJB DONE: replace by setAreaOfInterest(Envelope,
// CoordinateReferenceSystem)
// with the user supplied SRS parameter
//if there's a crs in the request, use that. If not, assume its 4326
CoordinateReferenceSystem mapcrs = request.getCrs();
//DJB: added this to be nicer about the "NONE" srs.
if (mapcrs !=null)
map.setAreaOfInterest(request.getBbox(),mapcrs);
else
map.setAreaOfInterest(request.getBbox());
map.setMapWidth(request.getWidth());
map.setMapHeight(request.getHeight());
map.setBgColor(request.getBgColor());
map.setTransparent(request.isTransparent());
LOGGER.fine("setting up map");
MapLayer layer;
FeatureSource source;
for (int i = 0; i < layers.length; i++) {
Style style = styles[i];
try {
source = layers[i].getFeatureSource();
} catch (IOException exp) {
LOGGER.log(Level.SEVERE,
"Getting feature source: " + exp.getMessage(), exp);
throw new WmsException(null,
"Internal error : " + exp.getMessage());
}
layer = new DefaultMapLayer(source, style);