public String getName() { return layer.getName(); } public URI getSchema() {
public String getName() { return layer.getName(); }
public void addLayer(Layer layer, String style) { addLayer(layer.getName(), style); }
public void addLayer( Layer layer, String style ) { addLayer(layer.getName(), style); }
public URI getIdentifier() { try { return new URI(parent.getIdentifier().toString() + "#" + layer.getName()); //$NON-NLS-1$ } catch (Throwable e) { return parent.getIdentifier(); } }
/** * Utility method to return each layer that has a name. This method maintains no hierarchy at all. * * @return An array of Layers, each value has a it's name property set or an empty array if there are none. It will return null if there is no capabilities document * */ public static Layer[] getNamedLayers(WMSCapabilities capabilities) { if (capabilities == null) { return null; } List namedLayersList = new ArrayList(); Layer[] layers = (Layer[]) capabilities.getLayerList().toArray(new Layer[capabilities.getLayerList().size()]); for( int i = 0; i < layers.length; i++ ) { if ((layers[i].getName() != null) && (layers[i].getName().length() != 0)) { namedLayersList.add(layers[i]); } } Layer[] namedLayers = new Layer[namedLayersList.size()]; for (int i = 0; i < namedLayersList.size(); i++) { namedLayers[i] = (Layer) namedLayersList.get(i); } return namedLayers; }
/** * Utility method to return each layer that has a name. This method maintains no hierarchy at * all. * * @return An array of Layers, each value has a it's name property set or an empty array if * there are none. It will return null if there is no capabilities document */ public static Layer[] getNamedLayers(WMSCapabilities capabilities) { if (capabilities == null) { return null; } List namedLayersList = new ArrayList(); Layer[] layers = (Layer[]) capabilities .getLayerList() .toArray(new Layer[capabilities.getLayerList().size()]); for (int i = 0; i < layers.length; i++) { if ((layers[i].getName() != null) && (layers[i].getName().length() != 0)) { namedLayersList.add(layers[i]); } } Layer[] namedLayers = new Layer[namedLayersList.size()]; for (int i = 0; i < namedLayersList.size(); i++) { namedLayers[i] = (Layer) namedLayersList.get(i); } return namedLayers; }
private Collection<Layer> getWMSLayers(WebMapServer wms) { ArrayList<Layer> layers = new ArrayList<Layer>(); String source = wms.getInfo().getSource().toString(); String zp = _layers.get(source); // // String zp = Thinklab.get().getProperties().getProperty(WMS_LAYER_PROPERTY + "." + _wms_index); for (Layer l : WMSUtils.getNamedLayers(wms.getCapabilities())) { if (zp == null || (zp != null && zp.contains(l.getName()))) { layers.add(l); } } return layers; }
/** * @see org.geotools.data.wms.request.Request#getFinalURL() */ public URL getFinalURL() { Iterator iter = queryLayers.iterator(); String initialQueryLayerString = properties.getProperty(QUERY_LAYERS) == null ? "" : properties.getProperty(QUERY_LAYERS); //$NON-NLS-1$ String queryLayerString = properties.getProperty(QUERY_LAYERS) == null ? "" : properties.getProperty(QUERY_LAYERS); //$NON-NLS-1$ while( iter.hasNext() ) { Layer layer = (Layer) iter.next(); try { queryLayerString = queryLayerString + URLEncoder.encode(layer.getName(), "UTF-8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { queryLayerString = queryLayerString + layer.getName(); } if (iter.hasNext()) { queryLayerString = queryLayerString + ","; //$NON-NLS-1$ } } setProperty(QUERY_LAYERS, queryLayerString); //need to add the querylayers to the LAYERS tag as well. setProperty(GetMapRequest.LAYERS, queryLayerString); URL url = super.getFinalURL(); setProperty(QUERY_LAYERS, initialQueryLayerString); return url; }
title = layer.getTitle(); if (title == null) { title = layer.getName();
private void setupLayersList() { caps = wms.getCapabilities(); model.clear(); for (Layer layer :WMSUtils.getNamedLayers( caps )) { String title = layer.getTitle(); if (title == null) { title = layer.getName(); } model.addElement( layer ); } }
public GeneralParameterDescriptor createLayersReadParam() { Map properties = fillProperties("LAYERS", "Describes each layer in the WMS and the styles associated " + "with. The parameter name is the name of the layer. The value" + "is the style for that layer. The valid values are all the " + "styles that layer can be drawn with."); List layers = Arrays.asList(WMSUtils.getNamedLayers(capabilities)); GeneralParameterDescriptor[] layerParams = new DefaultParameterDescriptor[layers .size()]; for (int i = 0; i < layers.size(); i++) { Layer layer = (Layer) layers.get(i); Map layerProperties = fillProperties(layer.getName(), ""); String[] styles = new String[layer.getStyles().size()]; for (int j = 0; j < layer.getStyles().size(); j++) { Style style = (Style) layer.getStyles().get(j); styles[i] = style.getName(); } layerParams[i] = new DefaultParameterDescriptor(layerProperties, String.class, styles, null, null, null, null, false); } GeneralParameterDescriptor param = new DefaultParameterDescriptorGroup(properties, 0, layers.size(), layerParams); return param; }
@Override public Layer createLayer(LayerContext ctx, PropertySet configuration) { final WebMapServer mapServer; try { mapServer = getWmsServer(configuration); } catch (Exception e) { final String message = String.format("Not able to access Web Mapping Server: %s", configuration.getValue(WmsLayerType.PROPERTY_NAME_URL)); throw new RuntimeException(message, e); } final int layerIndex = configuration.getValue(WmsLayerType.PROPERTY_NAME_LAYER_INDEX); final org.geotools.data.ows.Layer wmsLayer = getLayer(mapServer, layerIndex); final MultiLevelSource multiLevelSource = createMultiLevelSource(configuration, mapServer, wmsLayer); final ImageLayer.Type imageLayerType = LayerTypeRegistry.getLayerType(ImageLayer.Type.class); final PropertySet config = imageLayerType.createLayerConfig(ctx); config.setValue(ImageLayer.PROPERTY_NAME_MULTI_LEVEL_SOURCE, multiLevelSource); config.setValue(ImageLayer.PROPERTY_NAME_BORDER_SHOWN, false); config.setValue(ImageLayer.PROPERTY_NAME_PIXEL_BORDER_SHOWN, false); final ImageLayer wmsImageLayer = new ImageLayer(this, multiLevelSource, config); wmsImageLayer.setName(wmsLayer.getName()); return wmsImageLayer; }
@Override public Layer createLayer(LayerContext ctx, PropertySet configuration) { final WebMapServer mapServer; try { mapServer = getWmsServer(configuration); } catch (Exception e) { final String message = String.format("Not able to access Web Mapping Server: %s", configuration.getValue(WmsLayerType.PROPERTY_NAME_URL)); throw new RuntimeException(message, e); } final int layerIndex = (Integer) configuration.getValue(WmsLayerType.PROPERTY_NAME_LAYER_INDEX); final org.geotools.data.ows.Layer wmsLayer = getLayer(mapServer, layerIndex); final MultiLevelSource multiLevelSource = createMultiLevelSource(configuration, mapServer, wmsLayer); final ImageLayer.Type imageLayerType = LayerTypeRegistry.getLayerType(ImageLayer.Type.class); final PropertySet config = imageLayerType.createLayerConfig(ctx); config.setValue(ImageLayer.PROPERTY_NAME_MULTI_LEVEL_SOURCE, multiLevelSource); config.setValue(ImageLayer.PROPERTY_NAME_BORDER_SHOWN, false); config.setValue(ImageLayer.PROPERTY_NAME_PIXEL_BORDER_SHOWN, false); final ImageLayer wmsImageLayer = new ImageLayer(this, multiLevelSource, config); wmsImageLayer.setName(wmsLayer.getName()); return wmsImageLayer; }
template.setValue(WmsLayerType.PROPERTY_NAME_CRS_ENVELOPE, crsEnvelope); final com.bc.ceres.glayer.Layer layer = wmsType.createLayer(getContext().getLayerContext(), template); layer.setName(selectedLayer.getName()); return layer; } finally {