@Override protected boolean initializeDo() { final boolean initialized = super.initializeDo(); if (initialized) { final WmsClient wmsClient = new WmsClient(this.serviceUrl); final WmsLayerDefinition wmsLayerDefinition = wmsClient.getLayer(this.layerName); setWmsLayerDefinition(wmsLayerDefinition); return wmsLayerDefinition != null; } return initialized; }
protected void setWmsLayerDefinition(final WmsLayerDefinition wmsLayerDefinition) { this.wmsLayerDefinition = wmsLayerDefinition; if (wmsLayerDefinition == null) { setExists(false); } else { setExists(true); final WmsClient wmsClient = wmsLayerDefinition.getWmsClient(); this.serviceUrl = wmsClient.getServiceUrl().toString(); final String layerTitle = wmsLayerDefinition.getTitle(); setName(layerTitle); this.layerName = wmsLayerDefinition.getName(); final long minimumScale = (long) wmsLayerDefinition.getMinimumScale(); super.setMinimumScale(minimumScale); final long maximumScale = (long) wmsLayerDefinition.getMaximumScale(); super.setMaximumScale(maximumScale); setBoundingBox(wmsLayerDefinition.getLatLonBoundingBox()); final GeometryFactory geometryFactory = wmsLayerDefinition.getDefaultGeometryFactory(); setGeometryFactory(geometryFactory); } }