Package org.geotools.renderer.lite

Examples of org.geotools.renderer.lite.LiteShape2


            for (int sIdx = 0; sIdx < symbolizers.length; sIdx++) {
                Symbolizer symbolizer = symbolizers[sIdx];
                Style2D style2d = styleFactory.createStyle(sampleFeature,
                        symbolizer, scaleRange);
                LiteShape2 shape = getSampleShape(symbolizer, w, h);

                shapePainter.paint(graphics, shape, style2d, scaleDenominator);
            }

            legendsStack.add(image);
View Full Code Here


     * @throws IllegalArgumentException if an unknown symbolizer impl was
     *         passed in.
     */
    private LiteShape2 getSampleShape(Symbolizer symbolizer, int legendWidth,
        int legendHeight) {
        LiteShape2 sampleShape;
        final float hpad = (legendWidth * hpaddingFactor);
        final float vpad = (legendHeight * vpaddingFactor);

        if (symbolizer instanceof LineSymbolizer) {
            if (this.sampleLine == null) {
                Coordinate[] coords = {
                        new Coordinate(hpad, legendHeight - vpad),
                        new Coordinate(legendWidth - hpad, vpad)
                    };
                LineString geom = geomFac.createLineString(coords);
               
                try{
                  this.sampleLine = new LiteShape2(geom, null,null, false);
                }
                catch(Exception e)
        {
                  this.sampleLine = null;
        }
            }

            sampleShape = this.sampleLine;
        } else if (symbolizer instanceof PolygonSymbolizer) {
            if (this.sampleRect == null) {
                final float w = legendWidth - (2 * hpad);
                final float h = legendHeight - (2 * vpad);

                Coordinate[] coords = {
                        new Coordinate(hpad, vpad),
                        new Coordinate(hpad, vpad + h),
                        new Coordinate(hpad + w, vpad + h),
                        new Coordinate(hpad + w, vpad),
                        new Coordinate(hpad, vpad)
                    };
                LinearRing shell = geomFac.createLinearRing(coords);
                Polygon geom = geomFac.createPolygon(shell, null);
                try{
                  this.sampleRect = new LiteShape2(geom, null, null,false);
                }
                catch(Exception e)
        {
                  this.sampleRect = null;
        }
            }

            sampleShape = this.sampleRect;
        } else if (symbolizer instanceof PointSymbolizer
                || symbolizer instanceof TextSymbolizer) {
            if (this.samplePoint == null) {
                Coordinate coord = new Coordinate(legendWidth / 2,
                        legendHeight / 2);
                try{
                  this.samplePoint = new LiteShape2(geomFac.createPoint(coord), null, null,false);
                }
                catch(Exception e)
        {
                  this.samplePoint = null;
        }
View Full Code Here

TOP

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

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.