/** * Access to styles in the same order as {@link #legends}. * * @return stules in the same order as layers * @deprecated Use getLegendRequest(name).getStyle() */ public List<Style> getStyles() { List<Style> styles = new ArrayList<Style>(legends.size()); for (LegendRequest layer : legends) { styles.add(layer.getStyle()); } return Collections.unmodifiableList(styles); }
FeatureTypeStyle featureTypeStyle = style.featureTypeStyles().get(0); if ((featureTypeStyle != null) && !featureTypeStyle.rules().isEmpty()) { LegendRequest legendEntryRequest = request.new LegendRequest(); request.getLegends().add(legendEntryRequest); legendEntryRequest.setTitle(entry.getKey()); legendEntryRequest.setStyle(style);
/** * List of layer FeatureType in order requested. * * @return layer FeatureType in order requested * @deprecated Use {@link #getLegends()} */ public List<FeatureType> getLayers() { List<FeatureType> types = new ArrayList<FeatureType>(legends.size()); for (LegendRequest layer : legends) { types.add(layer.getFeatureType()); } return Collections.unmodifiableList(types); }
FeatureType layer = legend.getFeatureType(); Style gt2Style = legend.getStyle(); if (gt2Style == null) { throw new NullPointerException("request.getStyle()"); String ruleName = legend.getRule(); // was null final boolean useProvidedLegend = layer != null && legend.getLayerInfo() != null;
FeatureType layer = legend.getFeatureType(); Style gt2Style = legend.getStyle(); if (gt2Style == null) { throw new NullPointerException("request.getStyle()"); String ruleName = legend.getRule(); // was null final boolean useProvidedLegend = layer != null && legend.getLayerInfo() != null;
legend.setLayer(layer); legend.setLayerGroupInfo(layerGroupInfo); LegendRequest styleLegend = request.new LegendRequest(); layers.add(styleLegend);
GetLegendGraphicRequest request) { LegendInfo legendInfo = legend.getLegendInfo(); if (legendInfo == null) { return null; // nothing provided will need to dynamically generate
LegendRequest legend = request .new LegendRequest(featureType, layerInfo.getResource().getQualifiedName()); legend.setLayerInfo(layerInfo); legend.setTitle(mli.getLabel());
int height = image.getHeight(); LegendRequest legend = req.new LegendRequest(ftInfo.getFeatureType()); legend.setStyle(cat.getStyleByName(MockData.ROAD_SEGMENTS.getLocalPart()).getStyle()); req.getLegends().add(legend);
GetLegendGraphicRequest request) { LegendInfo legendInfo = legend.getLegendInfo(); if (legendInfo == null) { return null; // nothing provided will need to dynamically generate
int height = image.getHeight(); LegendRequest legend = req.new LegendRequest(ftInfo.getFeatureType()); legend.setStyle( getCatalog().getStyleByName(MockData.ROAD_SEGMENTS.getLocalPart()).getStyle()); req.getLegends().add(legend);
/** * Pre-processes the legend request and returns a style whose rules have been altered to contain * a feature count * * @param legend * @return * @throws Exception */ public Rule[] preProcessRules(LegendRequest legend, Rule[] rules) { if (rules == null || rules.length == 0) { return rules; } // is the code running in match first mode? MatchFirstVisitor matchFirstVisitor = new MatchFirstVisitor(); legend.getStyle().accept(matchFirstVisitor); boolean matchFirst = matchFirstVisitor.matchFirst; try { GetMapRequest getMapRequest = parseAssociatedGetMap(legend, rules); Map<Rule, AtomicInteger> counters = renderAndCountFeatures(rules, getMapRequest, matchFirst); Rule[] result = updateRuleTitles(rules, counters); return result; } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException(ex); } }
Style style = getLegendGraphics.getLegends().get(0).getStyle(); FeatureTypeStyle fts = style.featureTypeStyles().get(0); assertNull(fts.getTransformation());
LegendRequest legend = req.new LegendRequest(); legend.setStyle(externalGraphicStyle);
/** * Separate symbolizers. * * @param imageMap the image map * @param request the request * @param styleMap the style map */ private void separateSymbolizers( Map<String, BufferedImage> imageMap, GetLegendGraphicRequest request, Map<String, Style> styleMap) { for (Entry<String, Style> entry : styleMap.entrySet()) { request.getLegends().clear(); LegendRequest legendEntryRequest = request.new LegendRequest(); legendEntryRequest.setStyle(entry.getValue()); legendEntryRequest.setStyleName(entry.getKey()); request.getLegends().add(legendEntryRequest); BufferedImage legendGraphic = null; try { legendGraphic = legendBuilder.buildLegendGraphic(request); } catch (Exception e) { // Ignore } imageMap.put(entry.getKey(), legendGraphic); } }
/** * Renders a title for a layer (to be put on top of the layer legend). * * @param legend FeatureType representing the layer * @param w width for the image (hint) * @param h height for the image (hint) * @param transparent (should the image be transparent) * @param request GetLegendGraphicRequest being built * @return image with the title */ private RenderedImage getLayerTitle( LegendRequest legend, int w, int h, boolean transparent, GetLegendGraphicRequest request) { String title = legend.getTitle(); final BufferedImage image = ImageUtils.createImage(w, h, (IndexColorModel) null, transparent); return LegendMerger.getRenderedLabel(image, title, request); }
private String getLayerName(LegendRequest legend) { if (legend.getLayer() != null) { return legend.getLayer(); } else if (legend.getLayerInfo() != null) { return legend.getLayerInfo().prefixedName(); } else if (legend.getFeatureType() != null) { Name name = legend.getFeatureType().getName(); NamespaceInfo ns = request.getWms().getCatalog().getNamespaceByURI(name.getNamespaceURI()); final String localName = name.getLocalPart(); if (ns != null) { return ns.getPrefix() + ":" + localName; } else { return localName; } } else { // should not really happen today, but who knows, may do in the future throw new ServiceException("Could not get the layer name out of " + legend); } }
/** * Assign resolved style information to {@link #legends}. * * <p>Styles must be provided in the same order as the layers list. * * @param styles * @deprecated Use getLegendGraphic(name).setStyle(style) */ public void setStyles(List<Style> styles) { Iterator<Style> s = styles.iterator(); for (LegendRequest legend : legends) { if (!s.hasNext()) { break; // no more styles } Style style = s.next(); legend.setStyle(style); } }
/** * Renders a title for a layer (to be put on top of the layer legend). * * @param legend FeatureType representing the layer * @param w width for the image (hint) * @param h height for the image (hint) * @param transparent (should the image be transparent) * @param request GetLegendGraphicRequest being built * @return image with the title */ private RenderedImage getLayerTitle( LegendRequest legend, int w, int h, boolean transparent, GetLegendGraphicRequest request) { String title = legend.getTitle(); final BufferedImage image = ImageUtils.createImage(w, h, (IndexColorModel) null, transparent); return LegendMerger.getRenderedLabel(image, title, request); }