void encodeGroundOverlay(Folder container, Layer layer, int drawOrder, Envelope box) { GroundOverlay go = container.createAndAddGroundOverlay(); go.setDrawOrder(drawOrder); Icon icon = go.createAndSetIcon(); String href = WMSRequests.getGetMapUrl(request, layer, 0, box, new String[] { "width", "256", "height", "256", "format", "image/png", "transparent", "true" }); icon.setHref(href); LOGGER.fine(href); // make sure the ground overlay disappears as the lower tiles activate addRegion(go, box, 128, 512); LatLonBox llBox = go.createAndSetLatLonBox(); setEnvelope(box, llBox); }
@Override public Feature decorate(Feature feature, KmlEncodingContext context) { Document doc = (Document) feature; // create the screen overlay ScreenOverlay go = doc.createAndAddScreenOverlay(); go.setName("Legend"); go.setOverlayXY(createPixelsVec(0, 0)); go.setScreenXY(createPixelsVec(10, 20)); // build the href Icon icon = go.createAndSetIcon(); String legendOptions = (String) context.getRequest().getRawKvp().get("LEGEND_OPTIONS"); String[] kvpArray = null; if (legendOptions != null) { kvpArray = new String[] { "LEGEND_OPTIONS", legendOptions }; } List<Layer> layerList = context.getMapContent().layers(); Layer[] layers = (Layer[]) layerList.toArray(new Layer[layerList.size()]); icon.setHref(WMSRequests.getGetLegendGraphicUrl(context.getRequest(), layers, kvpArray)); return feature; }
protected void setInlineIconStyle(Style style, org.geotools.styling.Style sld, IconProperties properties, KmlEncodingContext context) { final String name = properties.getIconName(sld); Map<String,org.geotools.styling.Style> iconStyles = context.getIconStyles(); if (!iconStyles.containsKey(name)) { final org.geotools.styling.Style injectedStyle = IconPropertyInjector.injectProperties(sld, properties.getProperties()); iconStyles.put(name, injectedStyle); } final Double scale = properties.getScale(); final String path = "icons/" + name + ".png"; IconStyle is = style.createAndSetIconStyle(); if (properties.getHeading() != null) { is.setHeading(0.0); } if (scale != null) { is.setScale(scale); } Icon icon = is.createAndSetIcon(); icon.setHref(path); }
go.setName("Map"); Icon icon = go.createAndSetIcon(); icon.setHref("image.png"); icon.setViewRefreshMode(ViewRefreshMode.NEVER); icon.setViewBoundScale(0.75);
protected void setDefaultIconStyle(Style style, SimpleFeature feature, KmlEncodingContext context) { // figure out if line or polygon boolean line = feature.getDefaultGeometry() != null && (feature.getDefaultGeometry() instanceof LineString || feature .getDefaultGeometry() instanceof MultiLineString); boolean poly = feature.getDefaultGeometry() != null && (feature.getDefaultGeometry() instanceof Polygon || feature .getDefaultGeometry() instanceof MultiPolygon); // Final pre-flight check if (!line && !poly) { LOGGER.log(Level.FINER, "Unexpectedly entered encodeDefaultIconStyle() " + "with something that does not have a multipoint geometry."); return; } IconStyle is = style.createAndSetIconStyle(); // make transparent if they ask for attributes, since we'll have a label if (context.isDescriptionEnabled()) { is.setColor("00ffffff"); } // if line or polygon scale the label if (line || poly) { is.setScale(0.4); } String imageURL = "http://icons.opengeo.org/markers/icon-" + (poly ? "poly.1" : "line.1") + ".png"; Icon icon = is.createAndSetIcon(); icon.setHref(imageURL); icon.setViewBoundScale(1); }
go.setDrawOrder(mapLayerOrder); Icon icon = go.createAndSetIcon(); icon.setHref(getGroundOverlayHRef(layer)); icon.setViewRefreshMode(ViewRefreshMode.NEVER); icon.setViewBoundScale(0.75);
protected void setLiveIconStyle(Style style, org.geotools.styling.Style sld, IconProperties properties, KmlEncodingContext context) { final Double opacity = properties.getOpacity(); final Double scale = properties.getScale(); final Double heading = properties.getHeading(); IconStyle is = style.createAndSetIconStyle(); if (opacity != null) { is.setColor(colorToHex(Color.WHITE, opacity)); } if (scale != null) { is.setScale(scale); } if (heading != null) { is.setHeading(heading); } // Get the name of the workspace WorkspaceInfo ws = context.getWms().getCatalog().getStyleByName(sld.getName()).getWorkspace(); String wsName = null; if(ws!=null) wsName = ws.getName(); Icon icon = is.createAndSetIcon(); icon.setHref(properties.href(context.getMapContent().getRequest().getBaseUrl(), wsName, sld.getName())); }