Package org.geotools.renderer.lite

Examples of org.geotools.renderer.lite.MetaBufferEstimator


      style.setFormula(STYLE_INDEX_ATTRIBUTE_NAME + " = " + style.getIndex());
    }
    // create the style
    Style style = styleFactoryService.createStyle(layer, copy);
    // estimate the buffer
    MetaBufferEstimator estimator = new MetaBufferEstimator();
    estimator.visit(style);
    int bufferInPixels = estimator.getBuffer();
    // expand area to include buffer
    Rectangle tileInpix = mapContext.getViewport().getScreenArea();
    ReferencedEnvelope metaArea = new ReferencedEnvelope(areaOfInterest);
    metaArea.expandBy(bufferInPixels / tileInpix.getWidth() * areaOfInterest.getWidth(),
        bufferInPixels / tileInpix.getHeight() * areaOfInterest.getHeight());
 
View Full Code Here


        Object sample = createSampleFeature();
        double w = width - 1;
        double h = height - 1;
        // must cram symbol in icon space, so rescale if too big !
        // metabuffer is a good way to judge the size...
        MetaBufferEstimator estimator = new MetaBufferEstimator();
        estimator.visit(symbolizer);
        double estimatedSize = estimator.getBuffer();
        Symbolizer rescaled = symbolizer;
        if (estimatedSize > w || estimatedSize > h) {
          // rescale necessary
          double scale = Math.min(w, h) / estimatedSize;
          RescaleStyleVisitor rescaler = new RescaleStyleVisitor(scale);
View Full Code Here

     *         rendered with the specified styles
     *
     */

    private int getExpandSizeFromStyle( Style style ) {
        MetaBufferEstimator rbe = new MetaBufferEstimator();
        FeatureTypeStyle[] styles = style.getFeatureTypeStyles();
        for (int t=0; t<styles.length; t++) {
            final FeatureTypeStyle lfts = styles[t];
            Rule[] rules = lfts.getRules();
            for (int j = 0; j < rules.length; j++) {
                rbe.visit(rules[j]);
            }
        }

        if(!rbe.isEstimateAccurate())
            RendererPlugin.log("Assuming rendering buffer = " + rbe.getBuffer()
                + ", but estimation is not accurate, you may want to set a buffer manually", null);

        // the actual amount we have to grow the rendering area by is half of the stroke/symbol sizes
        // plus one extra pixel for antialiasing effects
        return (int) Math.round(rbe.getBuffer() / 2.0 + 1);
    }
View Full Code Here

                    // compute the request radius
                    double radius;
                    if(buffer <= 0) {
                        // estimate the radius given the currently active rules
                        MetaBufferEstimator estimator = new MetaBufferEstimator();
                        for (Rule rule : rules) {
                            rule.accept(estimator);
                        }
                       
                        if(estimator.getBuffer() < 6.0 || !estimator.isEstimateAccurate()) {
                            radius = 3.0;
                        } else {
                            radius =  estimator.getBuffer() / 2.0;
                        }
                    } else {
                        radius = buffer;
                    }
                   
View Full Code Here

     * @param scaleDenominator
     * @return
     */
    static int computeLayerBuffer(Style style, double scaleDenominator) {
        final double TOLERANCE = 1e-6;
        MetaBufferEstimator estimator = new MetaBufferEstimator();
        for (FeatureTypeStyle fts : style.featureTypeStyles()) {
            for (Rule rule : fts.rules()) {
                if (((rule.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
                        && ((rule.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator)) {
                    estimator.visit(rule);
                }
            }
        }

        // we get any estimate, it's better than nothing...
        return estimator.getBuffer();
    }
View Full Code Here

        if (layerBuffer != null && layerBuffer > 0) {
            return (int) Math.round(layerBuffer / 2.0);
        }
       
        // estimate the radius given the currently active rules
        MetaBufferEstimator estimator = new MetaBufferEstimator();
        for (Rule rule : rules) {
            rule.accept(estimator);
        }

        // easy case, the style is static, we can just use size computed from the style
        int estimatedRadius = estimator.getBuffer() / 2;
        if (estimator.isEstimateAccurate()) {
            if (estimatedRadius < MIN_BUFFER_SIZE) {
                return MIN_BUFFER_SIZE;
            } else {
                return estimatedRadius;
            }
View Full Code Here

            }
            if (layerBuffer != null && layerBuffer > 0) {
                radius = layerBuffer / 2.0;
            } else {
                // estimate the radius given the currently active rules
                MetaBufferEstimator estimator = new MetaBufferEstimator();
                for (Rule rule : rules) {
                    rule.accept(estimator);
                }

                int estimatedRadius = estimator.getBuffer() / 2;
                if (estimatedRadius < MIN_BUFFER_SIZE) {
                    radius = MIN_BUFFER_SIZE;
                } else {
                    radius = estimatedRadius;
                }
View Full Code Here

     * @param scaleDenominator
     * @return
     */
    static int computeLayerBuffer(Style style, double scaleDenominator) {
        final double TOLERANCE = 1e-6;
        MetaBufferEstimator estimator = new MetaBufferEstimator();
        for (FeatureTypeStyle fts : style.featureTypeStyles()) {
            for (Rule rule : fts.rules()) {
                if (((rule.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
                        && ((rule.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator)) {
                    estimator.visit(rule);
                }
            }
        }

        // we get any estimate, it's better than nothing...
        return estimator.getBuffer();
    }
View Full Code Here

            }
            if (layerBuffer != null && layerBuffer > 0) {
                radius = layerBuffer / 2.0;
            } else {
                // estimate the radius given the currently active rules
                MetaBufferEstimator estimator = new MetaBufferEstimator();
                for (Rule rule : rules) {
                    rule.accept(estimator);
                }

                if (estimator.getBuffer() < 6.0 || !estimator.isEstimateAccurate()) {
                    radius = 3.0;
                } else {
                    radius = estimator.getBuffer() / 2.0;
                }
            }
        } else {
            radius = buffer;
        }
View Full Code Here

TOP

Related Classes of org.geotools.renderer.lite.MetaBufferEstimator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.