Examples of SLDStyleFactory


Examples of org.geotools.renderer.style.SLDStyleFactory

            }
            float[] point = new float[6];
            PathIterator pathIterator = shape.getPathIterator(null);
            pathIterator.currentSegment(point);

            SLDStyleFactory styleFactory = new SLDStyleFactory();
            Style2D tmp = null;
            try {
                tmp = styleFactory.createStyle(feature, pointSymbolizer, new NumberRange(Double.class, Double.NEGATIVE_INFINITY,
                        Double.POSITIVE_INFINITY));
            } catch (Exception e) {
                PointSymbolizerWrapper tmpPs = new PointSymbolizerWrapper(pointSymbolizer, null);
                tmp = styleFactory.createStyle(feature, pointSymbolizer, new NumberRange(Double.class, Double.NEGATIVE_INFINITY,
                        Double.POSITIVE_INFINITY));
            }
            if (tmp instanceof MarkStyle2D) {
                MarkStyle2D style = (MarkStyle2D) tmp;
                Shape shape2 = style.getTransformedShape(point[0], point[1]);
View Full Code Here

Examples of org.geotools.renderer.style.SLDStyleFactory

            int width = SLDs.width(SLDs.stroke(pointSymbolizer));
            if (width < 1)
                width = 1;
            float[] point = new float[6];
            shape.getPathIterator(null).currentSegment(point);
            SLDStyleFactory styleFactory = new SLDStyleFactory();
            Style2D tmp = styleFactory.createStyle(feature, pointSymbolizer, new NumberRange(Integer.class, 0, imgH));

            if (tmp instanceof MarkStyle2D) {

                MarkStyle2D style = (MarkStyle2D) tmp;
                style.setSize(imgH / 2);
View Full Code Here

Examples of org.geotools.renderer.style.SLDStyleFactory

            Color c = SLDs.pointColor( pointSymbolizer );
            Color fill=SLDs.pointFillWithAlpha( pointSymbolizer );
            int width = SLDs.width(SLDs.stroke(pointSymbolizer));
            float[] point=new float[6];
            shape.getPathIterator(null).currentSegment(point);
            SLDStyleFactory styleFactory=new SLDStyleFactory();
             Style2D tmp = styleFactory.createStyle(feature, pointSymbolizer, new NumberRange(Double.class, Double.MIN_VALUE, Double.MAX_VALUE));
           
             if( tmp instanceof MarkStyle2D ){
                MarkStyle2D style=(MarkStyle2D) tmp;
                Shape shape2 = style.getTransformedShape(point[0], point[1]);
View Full Code Here

Examples of org.geotools.renderer.style.SLDStyleFactory

            if(width == SLD.NOTFOUND)
                width =1;
           
            float[] point=new float[6];
            shape.getPathIterator(null).currentSegment(point);
            SLDStyleFactory styleFactory=new SLDStyleFactory();
            Style2D tmp = styleFactory.createStyle(feature, pointSymbolizer, NumberRange.create(Double.MIN_VALUE, Double.MAX_VALUE));
            if( tmp instanceof MarkStyle2D ){
                MarkStyle2D style=(MarkStyle2D) tmp;
                Shape shape2 = style.getTransformedShape(point[0], point[1]);
View Full Code Here

Examples of org.geotools.renderer.style.SLDStyleFactory

        masterImage,
        null);
    if (renderingHints != null) {
      masterGraphics.setRenderingHints(renderingHints);
    }
    styleFactory = new SLDStyleFactory();
    styleFactory.setRenderingHints(renderingHints);
    styleFactory.setVectorRenderingEnabled(vectorRenderingEnabled);
    styleFactory.setLineOptimizationEnabled(lineOptimizationEnabled);
    masterGraphics.setClip(paintArea.getArea());
    labelGraphics = new DelayedBackbufferGraphic(
View Full Code Here

Examples of org.geotools.renderer.style.SLDStyleFactory

                 * A legend graphic is produced for each applicable rule. They're being held
                 * here until the process is done and then painted on a "stack" like legend.
                 */
                final List<RenderedImage> legendsStack = new ArrayList<RenderedImage>(ruleCount);
               
                final SLDStyleFactory styleFactory = new SLDStyleFactory();
               
                double minimumSymbolSize = MINIMUM_SYMBOL_SIZE;
                // get minSymbolSize from LEGEND_OPTIONS, if defined
                if (request.getLegendOptions().get("minSymbolSize") instanceof String) {
                    String minSymbolSizeOpt = (String) request.getLegendOptions()
                            .get("minSymbolSize");
                    try {
                        minimumSymbolSize = Double.parseDouble(minSymbolSizeOpt);
                    } catch (NumberFormatException e) {
                        throw new IllegalArgumentException(
                                "Invalid minSymbolSize value: should be a number");
                    }
                }
                // calculate the symbols rescaling factor necessary for them to be
                // drawn inside the icon box
                double symbolScale = calcSymbolScale(w, h, layer, sampleFeature,
                        applicableRules, minimumSymbolSize);
               
                for (int i = 0; i < ruleCount; i++) {
                   
                    final RenderedImage image = ImageUtils.createImage(w, h, (IndexColorModel) null,
                            transparent);
                    final Map<RenderingHints.Key, Object> hintsMap = new HashMap<RenderingHints.Key, Object>();
                    final Graphics2D graphics = ImageUtils.prepareTransparency(transparent, LegendUtils.getBackgroundColor(request), image,
                            hintsMap);
                    graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
                   
                    Feature sample = getSampleFeatureForRule(layer,
                            sampleFeature, applicableRules[i]);
                   
                    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
                    final Symbolizer[] symbolizers = applicableRules[i].getSymbolizers();
                    final GraphicLegend legend = applicableRules[i].getLegend();
                   
                    // If this rule has a legend graphic defined in the SLD, use it
                    if (legend != null) {
                        if (this.samplePoint == null) {
                            Coordinate coord = new Coordinate(w / 2, h / 2);

                            try {
                                this.samplePoint = new LiteShape2(geomFac.createPoint(coord), null, null, false);
                            } catch (Exception e) {
                                this.samplePoint = null;
                            }
                        }
                        shapePainter.paint(graphics, this.samplePoint, legend, scaleDenominator, false);

                    } else {

                   
                        for (int sIdx = 0; sIdx < symbolizers.length; sIdx++) {
                            Symbolizer symbolizer = symbolizers[sIdx];
                           
                            if (symbolizer instanceof RasterSymbolizer) {
                                // skip it
                            } else {
                                // rescale symbols if needed
                                if (symbolScale > 1.0
                                        && symbolizer instanceof PointSymbolizer) {
                                    PointSymbolizer pointSymbolizer = cloneSymbolizer(symbolizer);
                                    if (pointSymbolizer.getGraphic() != null) {
                                        double size = getPointSymbolizerSize(sample,
                                                pointSymbolizer, Math.min(w, h) - 4);
                                        pointSymbolizer.getGraphic().setSize(
                                                ff.literal(size / symbolScale
                                                        + minimumSymbolSize));
       
                                        symbolizer = pointSymbolizer;
                                    }
                                }
                               
                                Style2D style2d = styleFactory.createStyle(sample,
                                        symbolizer, scaleRange);
                                LiteShape2 shape = getSampleShape(symbolizer, w, h);
       
                                if (style2d != null) {
                                    shapePainter.paint(graphics, shape, style2d,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.