Set<Configuration> saveConfigurations = new HashSet<Configuration>();
// now restore the gridsubset for each layer
for (Map.Entry<TileLayer, GridSubset> entry : affectedLayers.entrySet()) {
TileLayer layer = entry.getKey();
GridSubset gsubset = entry.getValue();
BoundingBox gridSetExtent = gsubset.getOriginalExtent();
if (null != gridSetExtent && sameSRS) {
gridSetExtent = newGridSet.getOriginalExtent().intersection(gridSetExtent);
}
int zoomStart = gsubset.getZoomStart();
int zoomStop = gsubset.getZoomStop();
if (zoomStart > maxZoomLevel) {
zoomStart = maxZoomLevel;
}
if (zoomStop > maxZoomLevel || zoomStop < zoomStart) {
zoomStop = maxZoomLevel;
}
GridSubset newGridSubset = GridSubsetFactory.createGridSubSet(newGridSet,
gridSetExtent, zoomStart, zoomStop);
layer.removeGridSubset(oldGridSetName);
layer.addGridSubset(newGridSubset);
Configuration config = tld.getConfiguration(layer);
config.modifyLayer(layer);
saveConfigurations.add(config);
}