}
if (version == null || "".equals(version)) { //$NON-NLS-1$
WmsPlugin.log("GetCapabilities VERSION is required", new ServiceNotFoundException()); //$NON-NLS-1$
return null;
}
IGeoResourceInfo info = resource.getInfo( new SubProgressMonitor(monitor, 50));
String srs = CRS.toSRS(info.getCRS());
TileSet tileset = new WMSTileSet();
ReferencedEnvelope bounds = info.getBounds();
if (bounds == null ) { //$NON-NLS-1$
WmsPlugin.log("Bounds required for TileSet definition", new NullPointerException("Bounds required for tileset definitio")); //$NON-NLS-1$
return null;
}
double minX = bounds.getMinimum(0);
double maxX = bounds.getMaximum(0);
double minY = bounds.getMinimum(1);
double maxY = bounds.getMaximum(1);
CRSEnvelope bbox = new CRSEnvelope(srs, minX, minY, maxX, maxY);
tileset.setBoundingBox(bbox);
tileset.setCoorindateReferenceSystem(srs);
Map<String, Serializable> properties = resource.getPersistentProperties();
Integer width = Integer.parseInt((String) properties.get(PreferenceConstants.P_TILESET_WIDTH));
Integer height = Integer.parseInt((String) properties.get(PreferenceConstants.P_TILESET_HEIGHT));
if (width == null) {
width = PreferenceConstants.DEFAULT_TILE_SIZE;
}
if (height == null) {
height = PreferenceConstants.DEFAULT_TILE_SIZE;
}
tileset.setWidth(width);
tileset.setHeight(height);
String imageType = (String) properties.get(PreferenceConstants.P_TILESET_IMAGE_TYPE);
if (imageType == null || "".equals(imageType)) { //$NON-NLS-1$
imageType = PreferenceConstants.DEFAULT_IMAGE_TYPE;
}
tileset.setFormat(imageType);
/*
* The layer ID
*/
tileset.setLayers(info.getName());
String scales = (String) properties.get(PreferenceConstants.P_TILESET_SCALES);
String resolutions = workoutResolutions(scales, new ReferencedEnvelope(bbox), width);