protected static AVList wmsGetParamsFromCapsDoc(Capabilities caps, AVList params) { if (caps == null) { String message = Logging.getMessage("nullValue.WMSCapabilities"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) { String message = Logging.getMessage("nullValue.LayerConfigParams"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } try { DataConfigurationUtils.getWMSLayerParams(caps, formatOrderPreference, params); } catch (IllegalArgumentException e) { String message = Logging.getMessage("WMS.MissingLayerParameters"); Logging.logger().log(java.util.logging.Level.SEVERE, message, e); throw new IllegalArgumentException(message, e); } catch (WWRuntimeException e) { String message = Logging.getMessage("WMS.MissingCapabilityValues"); Logging.logger().log(java.util.logging.Level.SEVERE, message, e); throw new IllegalArgumentException(message, e); } setFallbacks(params); // Setup WMS URL builder. params.setValue(AVKey.WMS_VERSION, caps.getVersion()); params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(params)); // Setup default WMS tiled image layer behaviors. params.setValue(AVKey.USE_TRANSPARENT_TEXTURES, true); return params; }
public WMSTiledImageLayer(String stateInXml) { this(wmsRestorableStateToParams(stateInXml)); RestorableSupport rs; try { rs = RestorableSupport.parse(stateInXml); } catch (Exception e) { // Parsing the document specified by stateInXml failed. String message = Logging.getMessage("generic.ExceptionAttemptingToParseStateXml", stateInXml); Logging.logger().severe(message); throw new IllegalArgumentException(message, e); } this.doRestoreState(rs, null); }
protected static AVList wmsGetParamsFromDocument(Element domElement, AVList params) { if (domElement == null) { String message = Logging.getMessage("nullValue.DocumentIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) params = new AVListImpl(); LayerConfiguration.getWMSTiledImageLayerParams(domElement, params); BasicTiledImageLayer.getParamsFromDocument(domElement, params); params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(params)); return params; }
@Override public BufferedImage composeImageForSector( Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, int levelNumber, String mimeType, boolean abortOnError, BufferedImage image, int timeout) throws Exception { if (sector == null) { String message = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ComposeImageTile tile = new ComposeImageTile( sector, mimeType, this.getLevels().getLastLevel(), canvasWidth, canvasHeight); try { if (image == null) image = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB); downloadImage(tile, mimeType, timeout); Thread.sleep(1); // generates InterruptedException if thread has been interupted BufferedImage tileImage = ImageIO.read(tile.getFile()); Thread.sleep(1); // generates InterruptedException if thread has been interupted ImageUtil.mergeImage(sector, tile.getSector(), aspectRatio, tileImage, image); Thread.sleep(1); // generates InterruptedException if thread has been interupted this.firePropertyChange(AVKey.PROGRESS, 0d, 1d); } catch (InterruptedIOException e) { throw e; } catch (Exception e) { if (abortOnError) throw e; String message = Logging.getMessage("generic.ExceptionWhileRequestingImage", tile.getPath()); Logging.logger().log(java.util.logging.Level.WARNING, message, e); } return image; }
protected static AVList wmsRestorableStateToParams(String stateInXml) { if (stateInXml == null) { String message = Logging.getMessage("nullValue.StringIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } RestorableSupport rs; try { rs = RestorableSupport.parse(stateInXml); } catch (Exception e) { // Parsing the document specified by stateInXml failed. String message = Logging.getMessage("generic.ExceptionAttemptingToParseStateXml", stateInXml); Logging.logger().severe(message); throw new IllegalArgumentException(message, e); } AVList params = new AVListImpl(); wmsRestoreStateToParams(rs, null, params); return params; }