/** * Checks if the graphics should be text antialiasing * * @param req the {@link GetLegendGraphicRequest} from which to extract font antialiasing * information. * @return true if the fontAntiAliasing is set to on */ public static boolean isFontAntiAliasing(final GetLegendGraphicRequest req) { if (req.getLegendOptions().get("fontAntiAliasing") instanceof String) { String aaVal = (String) req.getLegendOptions().get("fontAntiAliasing"); if (aaVal.equalsIgnoreCase("on") || aaVal.equalsIgnoreCase("true") || aaVal.equalsIgnoreCase("yes") || aaVal.equalsIgnoreCase("1")) { return true; } } return false; }
/** * Retrieves column height of legend from the provided {@link GetLegendGraphicRequest}. * * @param req a {@link GetLegendGraphicRequest} from which we should extract column height * information. * @return the column height specified in the provided {@link GetLegendGraphicRequest} or a * default DEFAULT_COLUMN_HEIGHT. */ public static int getColumnHeight(final GetLegendGraphicRequest req) { ensureNotNull(req, "GetLegendGraphicRequestre"); final Map<String, Object> legendOptions = req.getLegendOptions(); int columnheight = DEFAULT_COLUMN_HEIGHT; if (legendOptions != null && legendOptions.get("columnheight") != null) { try { columnheight = Integer.parseInt((String) legendOptions.get("columnheight")); } catch (NumberFormatException e) { } } return columnheight; }
/** * Retrieves row width of legend from the provided {@link GetLegendGraphicRequest}. * * @param req a {@link GetLegendGraphicRequest} from which we should extract row width * information. * @return the row width specified in the provided {@link GetLegendGraphicRequest} or a default * DEFAULT_ROW_WIDTH. */ public static int getRowWidth(final GetLegendGraphicRequest req) { ensureNotNull(req, "GetLegendGraphicRequestre"); final Map<String, Object> legendOptions = req.getLegendOptions(); int rowwidth = DEFAULT_ROW_WIDTH; if (legendOptions != null && legendOptions.get("rowwidth") != null) { try { rowwidth = Integer.parseInt((String) legendOptions.get("rowwidth")); } catch (NumberFormatException e) { } } return rowwidth; }
/** * Retrieves rows of legend from the provided {@link GetLegendGraphicRequest}. * * @param req a {@link GetLegendGraphicRequest} from which we should extract rows information. * @return the rows specified in the provided {@link GetLegendGraphicRequest} or a default * DEFAULT_ROWS. */ public static int getRows(final GetLegendGraphicRequest req) { ensureNotNull(req, "GetLegendGraphicRequestre"); final Map<String, Object> legendOptions = req.getLegendOptions(); int rows = DEFAULT_ROWS; if (legendOptions != null && legendOptions.get("rows") != null) { try { rows = Integer.parseInt((String) legendOptions.get("rows")); } catch (NumberFormatException e) { } } return rows; }
/** * Retrieves columns of legend from the provided {@link GetLegendGraphicRequest}. * * @param req a {@link GetLegendGraphicRequest} from which we should extract columns * information. * @return the columns specified in the provided {@link GetLegendGraphicRequest} or a default * DEFAULT_COLUMNS. */ public static int getColumns(final GetLegendGraphicRequest req) { ensureNotNull(req, "GetLegendGraphicRequestre"); final Map<String, Object> legendOptions = req.getLegendOptions(); int columns = DEFAULT_COLUMNS; if (legendOptions != null && legendOptions.get("columns") != null) { try { columns = Integer.parseInt((String) legendOptions.get("columns")); } catch (NumberFormatException e) { } } return columns; }
/** * Retrieves the group legend layout from the provided {@link GetLegendGraphicRequest}. * * @param req a {@link GetLegendGraphicRequest} from which we should extract the group {@link * LegendLayout} information. * @return the group {@link LegendLayout} specified in the provided {@link * GetLegendGraphicRequest} or a default DEFAULT_LAYOUT. */ public static LegendLayout getGroupLayout(final GetLegendGraphicRequest req) { ensureNotNull(req, "GetLegendGraphicRequestre"); final Map<String, Object> legendOptions = req.getLegendOptions(); LegendLayout layout = DEFAULT_LAYOUT; if (legendOptions != null && legendOptions.get("grouplayout") != null) { try { layout = LegendLayout.valueOf( ((String) legendOptions.get("grouplayout")).toUpperCase()); } catch (IllegalArgumentException e) { } } return layout; }
/** * Retrieves the legend layout from the provided {@link GetLegendGraphicRequest}. * * @param req a {@link GetLegendGraphicRequest} from which we should extract the {@link * LegendLayout} information. * @return the {@link LegendLayout} specified in the provided {@link GetLegendGraphicRequest} or * a default DEFAULT_LAYOUT. */ public static LegendLayout getLayout(final GetLegendGraphicRequest req) { ensureNotNull(req, "GetLegendGraphicRequestre"); final Map<String, Object> legendOptions = req.getLegendOptions(); LegendLayout layout = DEFAULT_LAYOUT; if (legendOptions != null && legendOptions.get("layout") != null) { try { layout = LegendLayout.valueOf(((String) legendOptions.get("layout")).toUpperCase()); } catch (IllegalArgumentException e) { } } return layout; }
final Map<String, Object> legendOptions = req.getLegendOptions(); if (legendOptions == null) return DEFAULT_FONT; String legendFontName = LegendUtils.DEFAULT_FONT_NAME; double dpi = RendererUtilities.getDpi(req.getLegendOptions()); double standardDpi = RendererUtilities.getDpi(Collections.emptyMap()); if (dpi != standardDpi) {
final Map<String, Object> legendOptions = req.getLegendOptions(); final String color = legendOptions != null ? (String) legendOptions.get("fontColor") : null; if (color == null) {
final Map<String, Object> legendOptions = req.getLegendOptions(); if (legendOptions == null) return DEFAULT_BG_COLOR; Object clr = legendOptions.get("bgColor");
if (request.getLegendOptions().get("forceLabels") instanceof String) { String forceLabelsOpt = (String) request.getLegendOptions().get("forceLabels"); if (forceLabelsOpt.equalsIgnoreCase("on")) { forceLabelsOn = true; if (request.getLegendOptions().get("forceTitles") instanceof String) { String forceTitlesOpt = (String) request.getLegendOptions().get("forceTitles"); if (forceTitlesOpt.equalsIgnoreCase("off")) { forceTitlesOff = true; double dpi = RendererUtilities.getDpi(request.getLegendOptions()); double standardDpi = RendererUtilities.getDpi(Collections.emptyMap()); if (dpi != standardDpi) { double pixelsPerMeters = RendererUtilities.calculatePixelsPerMeterRatio( request.getScale(), request.getLegendOptions()); UomRescaleStyleVisitor rescaleVisitor = new UomRescaleStyleVisitor(pixelsPerMeters); rescaleVisitor.visit(gt2Style); if (request.getLegendOptions().get("minSymbolSize") instanceof String) { String minSymbolSizeOpt = (String) request.getLegendOptions().get("minSymbolSize"); try { minimumSymbolSize = Double.parseDouble(minSymbolSizeOpt); if (!StringUtils.isEmpty(request.getLegendOptions().get("labelMargin"))) { labelMargin = Integer.parseInt(
if (request.getLegendOptions().get("forceLabels") instanceof String) { String forceLabelsOpt = (String) request.getLegendOptions().get("forceLabels"); if (forceLabelsOpt.equalsIgnoreCase("on")) { forceLabelsOn = true; if (request.getLegendOptions().get("forceTitles") instanceof String) { String forceTitlesOpt = (String) request.getLegendOptions().get("forceTitles"); if (forceTitlesOpt.equalsIgnoreCase("off")) { forceTitlesOff = true; if (request.getLegendOptions().get("imageSizeFactor") instanceof String) { String imageSizeFactorOpt = (String) request.getLegendOptions().get("imageSizeFactor"); double dpi = RendererUtilities.getDpi(request.getLegendOptions()); double standardDpi = RendererUtilities.getDpi(Collections.emptyMap()); if (dpi != standardDpi) { double pixelsPerMeters = RendererUtilities.calculatePixelsPerMeterRatio( request.getScale(), request.getLegendOptions()); UomRescaleStyleVisitor rescaleVisitor = new UomRescaleStyleVisitor(pixelsPerMeters); rescaleVisitor.visit(gt2Style); if (request.getLegendOptions().get("minSymbolSize") instanceof String) { String minSymbolSizeOpt = (String) request.getLegendOptions().get("minSymbolSize"); try { minimumSymbolSize = Double.parseDouble(minSymbolSizeOpt);
cmapLegendBuilder.setAdditionalOptions(request.getLegendOptions());