/** * Builds and returns a {@link BufferedImageLegendGraphic} appropriate to be encoded as PNG * * @see GetLegendGraphicOutputFormat#produceLegendGraphic(GetLegendGraphicRequest) */ public BufferedImageLegendGraphic produceLegendGraphic(GetLegendGraphicRequest request) throws ServiceException { BufferedImageLegendGraphicBuilder builder = new BufferedImageLegendGraphicBuilder(); BufferedImage legendGraphic = builder.buildLegendGraphic(request); BufferedImageLegendGraphic legend = new BufferedImageLegendGraphic(legendGraphic); return legend; }
/** * @param backGroundColor * @uml.property name="backgroundColor" */ public void setBackgroundColor(final Color backGroundColor) { PackagedUtils.ensureNotNull(backGroundColor, "backGroundColor"); this.backgroundColor = backGroundColor; }
/** * Ensures that the provided argument is not <code>null</code>. * * <p>If it <code>null</code> it must throw a {@link NullPointerException}. * * @param argument argument to check for <code>null</code>. */ protected static void ensureNotNull(final Object argument) { ensureNotNull(argument, "Argument cannot be null"); }
private GetLegendGraphicRequest runGetLegendGraphics(String requestURL) throws Exception { Map rawKvp = (Map) caseInsensitiveKvp(KvpUtils.parseQueryString(requestURL)); Map kvp = parseKvp(rawKvp); GetLegendGraphicKvpReader reader = new GetLegendGraphicKvpReader(getWMS()); GetLegendGraphicRequest request = reader.read(reader.createRequest(), kvp, rawKvp); legendProducer.buildLegendGraphic(request); this.lastRequest = request; return request; } }
protected Rule[] updateRuleTitles( FeatureCountProcessor processor, LegendRequest legend, Rule[] applicableRules) { return processor.preProcessRules(legend, applicableRules); }
/** * Constructor for a RasterLayerLegendHelper. * * <p>It takes a {@link GetLegendGraphicRequest} object in order to do its magic. * * @param request the {@link GetLegendGraphicRequest} for which we want to build a legend * @param style the {@link Style} for which we want to build a legend * @param rule the {@link Rule} to use for rendering */ public RasterLayerLegendHelper( final GetLegendGraphicRequest request, Style style, String ruleName) { PackagedUtils.ensureNotNull(request, "The provided GetLegendGraphicRequest is null"); parseRequest(request, style, ruleName); }
/** * Creates a sample Feature instance in the hope that it can be used in the rendering of the * legend graphic, using the given dimensionality for the geometry attribute. * * @param schema the schema for which to create a sample Feature instance * @param dimensionality the geometry dimensionality required (ovverides the one defined in the * schema) 1= points, 2= lines, 3= polygons * @throws ServiceException */ private Feature createSampleFeature(FeatureType schema, int dimensionality) throws ServiceException { if (schema instanceof SimpleFeatureType) { schema = cloneWithDimensionality(schema, dimensionality); } return createSampleFeature(schema); }
/** * @param legend a {@link BufferedImageLegendGraphic} * @param output destination for the image written by {@link ImageIO} in the {@link * #getContentType() supported format} * @see Response#write(Object, OutputStream, Operation) */ @Override public void write(Object legend, OutputStream output, Operation operation) throws IOException, ServiceException { Assert.isInstanceOf(BufferedImageLegendGraphic.class, legend); BufferedImage legendImage = ((BufferedImageLegendGraphic) legend).getLegend(); JAISupport.encode(JPEGLegendOutputFormat.MIME_TYPE, legendImage, output); }
/** * Sets the {@link ColorMapType} for this legend builder in order to instruct it on how to * build the legend. * * @param colorMapType a int representing a {@link ColorMapType} for this legend builder in * order to instruct it on how to build the legend. */ public void setColorMapType(final int type) { this.colorMapType = ColorMapType.create(type); }
@Override protected Graphics2D getGraphics( boolean transparent, Color bgColor, RenderedImage preparedImage, Map<Key, Object> hintsMap) { return new NoOpGraphics2D(); }
@Override protected void setLastRow() { set(lastRuleManager, 1); } }
@SuppressWarnings("rawtypes") public AbstractGetLegendGraphicResponse(final Class binding, final String outputFormat) { super(binding, caseInsensitive(outputFormat)); }
/** * Retrieves the legend for the provided request. * * @return a {@link BufferedImage} that represents the legend for the provided request. */ public BufferedImage getLegend() { if (rasterSymbolizer == null) { return null; } return createResponse(); }
/** * Creates a {@link ColorMapLegendCreator} using the provided elements. * * @return a {@link ColorMapLegendCreator}. */ public ColorMapLegendCreator create() { return new ColorMapLegendCreator(this); }
public Cell getColorManager() { return get(0); }
/** * @return a {@link BufferedImageLegendGraphic} * @see GetLegendGraphicOutputFormat#produceLegendGraphic(GetLegendGraphicRequest) * @see BufferedImageLegendGraphicBuilder */ public BufferedImageLegendGraphic produceLegendGraphic(GetLegendGraphicRequest request) throws ServiceException { BufferedImageLegendGraphicBuilder builder = new BufferedImageLegendGraphicBuilder(); BufferedImage legendGraphic = builder.buildLegendGraphic(request); BufferedImageLegendGraphic legend = new BufferedImageLegendGraphic(legendGraphic); return legend; }
protected Rule[] updateRuleTitles( FeatureCountProcessor processor, LegendRequest legend, Rule[] applicableRules) { return processor.preProcessRules(legend, applicableRules); }
/** * @param labelFontColor * @uml.property name="labelFontColor" */ public void setLabelFontColor(final Color labelFontColor) { PackagedUtils.ensureNotNull(labelFontColor, "labelFontColor"); this.labelFontColor = labelFontColor; }
/** * @param labelFont * @uml.property name="labelFont" */ public void setLabelFont(final Font labelFont) { PackagedUtils.ensureNotNull(labelFont, "labelFont"); this.labelFont = labelFont; }
/** * Ensures that the provided argument is not <code>null</code>. * * <p>If it <code>null</code> it must throw a {@link NullPointerException}. * * @param argument argument to check for <code>null</code>. */ static void ensureNotNull(final Object argument) { ensureNotNull(argument, "Argument cannot be null"); }