$("body").on("click",".new_layer", function() { dialog("Create new layer", "Enter your layer name", "_input", { OK: function() { // There must be a way to get the input from here using this, if it is a standard library. If you wrote your own, make the value retrievable using something other than a class selector (horrible performance + scoping +multiple instance issues) // This is where the view comes into play. Instead of cloning, bind the rendering into a JS prototype, and instantiate it. It means that you only have to modify stuff in one place, you don't risk cloning events with it, and you can test your Layer stand-alone var newLayer = new Layer(); newLayer .setName(name) .bindToGroup(parent); } }); });
String name = layer.getName(); String stylesStr = ""; String title = layer.getTitle(); String description = layer.get_abstract(); boolean queryable = layer.isQueryable(); List<StyleImpl> styles = layer.getStyles(); double minX = layer.getLatLonBoundingBox().getMinX(); double minY = layer.getLatLonBoundingBox().getMinY(); double maxX = layer.getLatLonBoundingBox().getMaxX(); double maxY = layer.getLatLonBoundingBox().getMaxY(); log.info("Found layer: " + layer.getName() + " with LatLon bbox " + bounds4326.toString()); for (Dimension dimension : layer.getDimensions().values()) { Extent dimExtent = layer.getExtent(dimension.getName()); paramFilters.add(new NaiveWMSDimensionFilter(dimension, dimExtent)); try { wmsLayer = getLayer(name, wmsUrls, bounds4326, bounds3785, stylesStr, queryable, layer.getBoundingBoxes(), paramFilters); } catch (GeoWebCacheException gwc) { log.error("Error creating " + layer.getName() + ": " + gwc.getMessage());
public String getName() { return layer.getName(); } public URI getSchema() {
Set srs = layer.getSrs(); String crs = "EPSG:4326"; HashMap bboxes = layer.getBoundingBoxes(); Set keys = bboxes.keySet(); String k = ""; bb = layer.getLatLonBoundingBox(); bb.setEPSGCode("EPSG:4326"); // for some reason WMS doesn't grid = gcf.create(layer.getTitle(), image, bbox);
Layer ret = new Layer(); ret.set_abstract((String)node.getChildValue("Abstract")); ret.setBoundingBoxes(bboxes); ret.setLatLonBoundingBox((CRSEnvelope)node.getChildValue("LatLonBoundingBox")); Iterator iChildLayers = childLayers.iterator(); while (iChildLayers.hasNext()) ((Layer)iChildLayers.next()).setParent(ret); ret.setChildren((Layer[])childLayers.toArray(new Layer[childLayers.size()])); ret.setKeywords((String[])node.getChildValue("KeywordList")); ret.setName((String)node.getChildValue("Name")); if (queryable != null) { if ("1".equals(queryable)) { ret.setQueryable(true); } else if ("0".equals(queryable)) { ret.setQueryable(new Boolean(queryable).booleanValue()); ret.setScaleHintMax(Double.parseDouble((String)shints.get("max"))); if (shints != null && shints.get("min") != null) ret.setScaleHintMin(Double.parseDouble((String)shints.get("min"))); ret.setSrs(srs); ret.setStyles((List)node.getChildValues("Style"));
if (layer.getBoundingBoxes().isEmpty()) { env = layer.getEnvelope(DefaultGeographicCRS.WGS84); } else { CRSEnvelope bbox; String epsg4326 = "EPSG:4326"; String epsg4269 = "EPSG:4269"; if (layer.getBoundingBoxes().containsKey(epsg4326)) { bbox = layer.getBoundingBoxes().get(epsg4326); } else if (layer.getBoundingBoxes().containsKey(epsg4269)) { bbox = layer.getBoundingBoxes().get(epsg4269); } else { bbox = layer.getBoundingBoxes().values().iterator().next(); } catch (NoSuchAuthorityCodeException e) { crs = DefaultGeographicCRS.WGS84; env = layer.getEnvelope(crs); } catch (FactoryException e) { crs = DefaultGeographicCRS.WGS84; env = layer.getEnvelope(crs); if (layer.getKeywords() != null) { List<String> more = Arrays.asList(layer.getKeywords()); keywords.addAll(more); if (layer.getName() != null) { keywords.add(layer.getName()); if (layer.getTitle() != null) { keywords.add(layer.getTitle());
Layer layer = new Layer(); layer.setName((String) value[i].getValue()); layer.setTitle((String) value[i].getValue()); layer.set_abstract((String) value[i].getValue()); layer.setKeywords((String[]) value[i].getValue()); layer.setLatLonBoundingBox((CRSEnvelope) value[i].getValue()); layer.setAttribution((Attribution) value[i].getValue()); layer.setScaleDenominatorMin(min.doubleValue()); layer.setScaleDenominatorMax(max.doubleValue()); childLayer.setParent(layer); childLayers.add(childLayer); layer.setScaleHintMin(scaleHint[0]); layer.setScaleHintMax(scaleHint[1]); layer.setSrs(crs); layer.setBoundingBoxes(boundingBoxes); layer.setDimensions(dimensions); layer.setExtents(extents); layer.setStyles(styles);
String title; Layer layer = (Layer) value; title = layer.getTitle(); if (title == null) { title = layer.getName(); title = layer.toString(); Layer[] children = layer.getChildren(); if (children.length > 1) { sb.append(String.format(" (%d children)", children.length));
Crs crs = geoService.getCrs2(toCrs); info.setCrs(geoService.getCodeFromCrs(crs)); info.setName(owsLayer.getName()); info.setDescription(owsLayer.getTitle()); OperationType operationTypeFeatureInfo = wmsMapServer.getCapabilities().getRequest().getGetFeatureInfo(); Envelope generalEnvelope = owsLayer.getEnvelope(crs); extendBbox = toBbox(generalEnvelope); crsEnvelope = new CRSEnvelope(generalEnvelope);
final LayerSourcePageContext context = getContext(); Layer selectedLayer = (Layer) context.getPropertyValue(WmsLayerSource.PROPERTY_NAME_SELECTED_LAYER); JLabel infoLabel = new JLabel(WmsAssistantPage2.getLatLonBoundingBoxText(selectedLayer.getLatLonBoundingBox())); List<StyleImpl> styles = selectedLayer.getStyles(); panel3.add(new JLabel(String.format("<html><b>%s</b></html>", selectedLayer.getTitle())), BorderLayout.CENTER); panel3.add(panel2, BorderLayout.EAST);
name = layer.getName(); List keywordsFromWMS = new ArrayList(); if (caps.getService().getKeywordList() != null) { if (layer.getKeywords() != null) { keywordsFromWMS.addAll( Arrays.asList( layer.getKeywords() ) ); keywordsFromWMS.add( layer.getName() ); keywordsFromWMS.add( caps.getService().getName() ); keywordsFromWMS.add( parentid ); keywords = (String[]) keywordsFromWMS.toArray(new String[keywordsFromWMS.size()]); if (layer.get_abstract() != null && layer.get_abstract().length() != 0) { description = layer.get_abstract(); } else { description = caps.getService().get_abstract(); if (layer.getTitle() != null && layer.getTitle().length() != 0) { title = layer.getTitle(); } else { title = caps.getService().getTitle();
private Bbox getBbox(org.geotools.data.ows.Layer owsLayer, Crs toCrs) throws GeomajasException { Envelope envelope = null; String crs = null; if (owsLayer.getBoundingBoxes() != null && owsLayer.getBoundingBoxes().containsKey(toCrs.getId())) { envelope = owsLayer.getBoundingBoxes().get(toCrs); crs = toCrs.getId(); } if (envelope != null && crs != null) { return toBbox(envelope); } // if no predefined bounding box: transform from latLon Envelope latLonEnvelope = owsLayer.getLatLonBoundingBox(); return geoService.transform(toBbox(latLonEnvelope), LATLON_EPSG, toCrs.getId()); }
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; }
return found; Collection<String> identifiers = extractCRSNames(crs); Layer.this.getBoundingBoxes(); // extents for layer and parents tempBBox = (CRSEnvelope) boxes.get(srsName); if (tempBBox != null) { tempBBox = Layer.this.getLatLonBoundingBox(); // checks parents break; tempBBox = Layer.this.getLatLonBoundingBox(); // checks parents if (tempBBox == null && getBoundingBoxes() != null && getBoundingBoxes().size() > 0) { tempBBox = (CRSEnvelope) getBoundingBoxes().values().iterator().next();
tempBBox = (CRSEnvelope) parentLayer.getBoundingBoxes().get(epsgCode); parentLayer = parentLayer.getParent(); latLonBBox = parentLayer.getLatLonBoundingBox(); if (latLonBBox != null) { try { parentLayer = parentLayer.getParent(); if (getLatLonBoundingBox() != null) { CRSEnvelope latLonBBox = getLatLonBoundingBox(); tempBBox = new CRSEnvelope("EPSG:4326", latLonBBox.getMinX(), latLonBBox.getMinY(), latLonBBox.getMaxX(), latLonBBox.getMaxY()); epsg = "EPSG:4326"; if (tempBBox == null && getBoundingBoxes() != null && getBoundingBoxes().size() > 0) { tempBBox = (CRSEnvelope) getBoundingBoxes().values().iterator().next(); epsg = tempBBox.getEPSGCode();
private void setupLayersList() { caps = wms.getCapabilities(); layers.clear(); layerNames.clear(); for( Iterator i = caps.getLayerList().iterator(); i.hasNext();){ Layer layer = (Layer) i.next(); layerNames.add(layer.getTitle()); layers.add(layer); } }
for (String srs : layer.getBoundingBoxes().keySet()) { try { if (layer.getSrs().contains("EPSG:4326")) { srsName = layer.getSrs().iterator().next(); validSRS = layer.getSrs(); } else { Set<String> intersection = new HashSet<String>(validSRS); intersection.retainAll(layer.getSrs());
bounds.getMaxY()); context.setPropertyValue(WmsLayerSource.PROPERTY_NAME_CRS_ENVELOPE, crsEnvelope); List<StyleImpl> styles = selectedLayer.getStyles(); if (!styles.isEmpty()) { context.setPropertyValue(WmsLayerSource.PROPERTY_NAME_SELECTED_STYLE, styles.get(0)); infoLabel.setText(getLatLonBoundingBoxText(selectedLayer.getLatLonBoundingBox()));