/** * Applies Unit Of Measure rescaling against all symbolizers, the result will be symbolizers * that operate purely in pixels * * @param lfts */ void applyUnitRescale(final ArrayList<LiteFeatureTypeStyle> lfts) { // apply dpi rescale double dpi = RendererUtilities.getDpi(getRendererHints()); double standardDpi = RendererUtilities.getDpi(Collections.emptyMap()); if (dpi != standardDpi) { double scaleFactor = dpi / standardDpi; DpiRescaleStyleVisitor dpiVisitor = new GraphicsAwareDpiRescaleStyleVisitor(scaleFactor); for (LiteFeatureTypeStyle fts : lfts) { rescaleFeatureTypeStyle(fts, dpiVisitor); } } // apply UOM rescaling double pixelsPerMeters = RendererUtilities.calculatePixelsPerMeterRatio(scaleDenominator, rendererHints); UomRescaleStyleVisitor rescaleVisitor = new UomRescaleStyleVisitor(pixelsPerMeters); for (LiteFeatureTypeStyle fts : lfts) { rescaleFeatureTypeStyle(fts, rescaleVisitor); } }
private void workaroundLabelCacheBug() { Map<Object, Object> hints = (Map<Object, Object>) renderer.getRendererHints(); if (hints == null) { hints = new HashMap<Object, Object>(); } if (hints.containsKey(StreamingRenderer.LABEL_CACHE_KEY)) { labelCache = (LabelCache) hints.get(StreamingRenderer.LABEL_CACHE_KEY); } else { labelCache = new LabelCacheImpl(); hints.put(StreamingRenderer.LABEL_CACHE_KEY, labelCache); } renderer.setRendererHints(hints); }
private void workaroundLabelCacheBug() { Map<Object, Object> hints = (Map<Object, Object>) renderer.getRendererHints(); if (hints == null) { hints = new HashMap<Object, Object>(); } if (hints.containsKey(StreamingRenderer.LABEL_CACHE_KEY)) { labelCache = (LabelCache) hints.get(StreamingRenderer.LABEL_CACHE_KEY); } else { labelCache = new LabelCacheImpl(); hints.put(StreamingRenderer.LABEL_CACHE_KEY, labelCache); } renderer.setRendererHints(hints); }
@Override protected void onBeforeRender(StreamingRenderer renderer) { // force the renderer into serial painting mode, as we need to check what // was painted to decide which features to include in the results Map hints = renderer.getRendererHints(); hints.put(StreamingRenderer.OPTIMIZE_FTS_RENDERING_KEY, Boolean.FALSE); // disable antialiasing to speed up rendering hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); // TODO: should we disable the screenmap as well? featureInfoListener.setGraphics(graphics); featureInfoListener.setRenderer(renderer); renderer.addRenderListener(featureInfoListener); } };
@Override protected void onBeforeRender(StreamingRenderer renderer) { // disable antialiasing, numbers signify ids, we cannot have "half tints" renderer.getJava2DHints() .put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); Map hints = renderer.getRendererHints(); double dpi = RendererUtilities.getDpi(hints); dpi = dpi / DEFAULT_UTFRESOLUTION; hints.put(StreamingRenderer.DPI_KEY, dpi); } };
/** * Applies Unit Of Measure rescaling against all symbolizers, the result will be symbolizers * that operate purely in pixels * @param lfts */ void applyUnitRescale(final ArrayList<LiteFeatureTypeStyle> lfts) { // apply dpi rescale double dpi = RendererUtilities.getDpi(getRendererHints()); double standardDpi = RendererUtilities.getDpi(Collections.emptyMap()); if(dpi != standardDpi) { double scaleFactor = dpi / standardDpi; DpiRescaleStyleVisitor dpiVisitor = new DpiRescaleStyleVisitor(scaleFactor); for(LiteFeatureTypeStyle fts : lfts) { rescaleFeatureTypeStyle(fts, dpiVisitor); } } // apply UOM rescaling double pixelsPerMeters = RendererUtilities.calculatePixelsPerMeterRatio(scaleDenominator, rendererHints); UomRescaleStyleVisitor rescaleVisitor = new UomRescaleStyleVisitor(pixelsPerMeters); for(LiteFeatureTypeStyle fts : lfts) { rescaleFeatureTypeStyle(fts, rescaleVisitor); } }