LegendMerger.MergeOptions.createFromRequest( legendsStack, 0,
new LegendMerger.MergeOptions( imgs, (int) dx,
if (c != null) { if (totalWidth > 0) { totalWidth = totalWidth + options.getDx(); int h = c.getHeight() + (c.nodes.size() - 1) * options.getDy(); totalHeight = Math.max(totalHeight, h); totalWidth = totalWidth + options.getMargin() * 2; totalHeight = totalHeight + options.getMargin() * 2; totalWidth, totalHeight, (IndexColorModel) null, options.isTransparent()); final Map<RenderingHints.Key, Object> hintsMap = new HashMap<RenderingHints.Key, Object>(); Graphics2D finalGraphics = ImageUtils.prepareTransparency( options.isTransparent(), options.getBackgroundColor(), finalLegend, hintsMap); if (options.isAntialias()) { finalGraphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); int vOffset = options.getMargin(); int hOffset = options.getMargin(); for (Column c : columns) { if (c != null) { for (BufferedImage n : c.getNodes()) { finalGraphics.drawImage(n, hOffset, vOffset, null);
LegendMerger.MergeOptions.createFromRequest( legendsStack, 0,
List<RenderedImage> imageStack = mergeOptions.getImageStack(); List<BufferedImage> nodes = new ArrayList<BufferedImage>(); if (imgCount == 1 && (!mergeOptions.isForceLabelsOn() || rules == null)) { return (BufferedImage) imageStack.get(0); } else { img, label, mergeOptions.getLabelFont(), mergeOptions.isAntialias(), mergeOptions.isTransparent(), mergeOptions.getBackgroundColor(), mergeOptions.getLabelMargin()); LegendLayout layout = mergeOptions.getLayout(); BufferedImage finalLegend = null; if (layout == LegendLayout.HORIZONTAL) { Row[] rows = createRows(nodes, mergeOptions.getRowWidth(), mergeOptions.getRows()); finalLegend = buildFinalHLegend(rows, mergeOptions); createColumns( nodes, mergeOptions.getColumnHeight(), mergeOptions.getColumns(), req, true);
if (r != null) { if (totalHeight > 0) { totalHeight = totalHeight + options.getDy(); int w = r.getWidth() + (r.nodes.size() - 1) * options.getDx(); totalWidth = Math.max(totalWidth, w); totalWidth = totalWidth + options.getMargin() * 2; totalHeight = totalHeight + options.getMargin() * 2; totalWidth, totalHeight, (IndexColorModel) null, options.isTransparent()); final Map<RenderingHints.Key, Object> hintsMap = new HashMap<RenderingHints.Key, Object>(); Graphics2D finalGraphics = ImageUtils.prepareTransparency( options.isTransparent(), options.getBackgroundColor(), finalLegend, hintsMap); if (options.isAntialias()) { finalGraphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); int vOffset = options.getMargin(); int hOffset = options.getMargin(); for (Row r : rows) { if (r != null) { for (BufferedImage n : r.getNodes()) { finalGraphics.drawImage(n, hOffset, vOffset, null);
List<RenderedImage> imageStack = mergeOptions.getImageStack(); if (imgCount == 1 && (!mergeOptions.isForceLabelsOn() || rules == null)) { return (BufferedImage) imageStack.get(0); if (mergeOptions.isForceTitlesOff()) { for (RenderedImage img : imageStack) { nodes.add((BufferedImage) img); lbl, img, mergeOptions.getLabelFont(), mergeOptions.isAntialias(), mergeOptions.isTransparent(), mergeOptions.getBackgroundColor()); nodes.add(img); LegendLayout layout = mergeOptions.getLayout(); BufferedImage finalLegend = null; if (layout == LegendLayout.HORIZONTAL) {
List<RenderedImage> imageStack = mergeOptions.getImageStack(); LegendLayout layout = mergeOptions.getLayout(); Row[] rows = createRows(nodes, mergeOptions.getRowWidth(), mergeOptions.getRows()); finalLegend = buildFinalHLegend(rows, mergeOptions); createColumns( nodes, mergeOptions.getColumnHeight(), mergeOptions.getColumns(), null, false);
/** * Receives a list of <code>BufferedImages</code> and produces a new one which holds all the * images in <code>imageStack</code> one above the other, handling labels. * * @param imageStack the list of BufferedImages, one for each applicable Rule * @param rules The applicable rules, one for each image in the stack (if not null it's used to * compute labels) * @param request The request. * @param forceLabelsOn true for force labels on also with a single image. * @param forceLabelsOff true for force labels off also with more than one rule. * @return the stack image with all the images on the argument list. * @throws IllegalArgumentException if the list is empty */ private BufferedImage mergeGroups( List<RenderedImage> imageStack, Rule[] rules, GetLegendGraphicRequest req, boolean forceLabelsOn, boolean forceLabelsOff, boolean forceTitlesOff) { LegendMerger.MergeOptions options = LegendMerger.MergeOptions.createFromRequest( imageStack, 0, 0, 0, 0, req, forceLabelsOn, forceLabelsOff, forceTitlesOff); options.setLayout(LegendUtils.getGroupLayout(req)); return LegendMerger.mergeGroups(rules, options); }
/** * Receives a list of <code>BufferedImages</code> and produces a new one which holds all the * images in <code>imageStack</code> one above the other, handling labels. * * @param imageStack the list of BufferedImages, one for each applicable Rule * @param rules The applicable rules, one for each image in the stack (if not null it's used to * compute labels) * @param request The request. * @param forceLabelsOn true for force labels on also with a single image. * @param forceLabelsOff true for force labels off also with more than one rule. * @return the stack image with all the images on the argument list. * @throws IllegalArgumentException if the list is empty */ private BufferedImage mergeGroups( List<RenderedImage> imageStack, Rule[] rules, GetLegendGraphicRequest req, boolean forceLabelsOn, boolean forceLabelsOff, boolean forceTitlesOff) { LegendMerger.MergeOptions options = LegendMerger.MergeOptions.createFromRequest( imageStack, 0, 0, 0, 0, req, forceLabelsOn, forceLabelsOff, forceTitlesOff); options.setLayout(LegendUtils.getGroupLayout(req)); return LegendMerger.mergeGroups(rules, options); }
public static MergeOptions createFromRequest( List<RenderedImage> imageStack, int dx, int dy, int margin, int labelMargin, GetLegendGraphicRequest req, boolean forceLabelsOn, boolean forceLabelsOff, boolean forceTitlesOff) { return new LegendMerger.MergeOptions( imageStack, dx, dy, margin, labelMargin, req, forceLabelsOn, forceLabelsOff, forceTitlesOff); } }