Package org.geotools.styling

Examples of org.geotools.styling.LineSymbolizer


   
    @Test
    public void testRescaleLocalPixelInMetersSymbolizer() throws Exception {
        Stroke stroke = sb.createStroke(Color.RED, 2, new float[] {5, 10});
        stroke.setWidth(ff.literal("2px"));
        LineSymbolizer ls = sb.createLineSymbolizer(stroke);
        ls.setUnitOfMeasure(SI.METER);
        ls.accept(visitor);
        LineSymbolizer clone = (LineSymbolizer) visitor.getCopy();
       
        assertEquals("4px", clone.getStroke().getWidth().evaluate(null, String.class));
    }
View Full Code Here


                setFillOpacityItems( SLD.opacity(polySym.getFill()) );
                break;

            case LINESTRING:
            case MULTILINESTRING:
                LineSymbolizer lineSym = (LineSymbolizer) sym;
                setLineColorItems( SLD.color(lineSym) );
                break;

            case POINT:
            case MULTIPOINT:
View Full Code Here

   
    @Test
    public void testRescaleLocalPixelInPixelSymbolizer() throws Exception {
        Stroke stroke = sb.createStroke(Color.RED, 2, new float[] {5, 10});
        stroke.setWidth(ff.literal("2px"));
        LineSymbolizer ls = sb.createLineSymbolizer(stroke);
        ls.accept(visitor);
        LineSymbolizer clone = (LineSymbolizer) visitor.getCopy();
       
        assertEquals("4", clone.getStroke().getWidth().evaluate(null, String.class));
    }
View Full Code Here

        /*
         * Setting the geometryPropertyName arg to null signals that we want to
         * draw the default geomettry of features
         */
        LineSymbolizer sym = styleFactory.createLineSymbolizer(stroke, null);

        Rule rule = styleFactory.createRule();
        rule.symbolizers().add(sym);
        FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[]{rule});
        Style style = styleFactory.createStyle();
View Full Code Here

            if (sym instanceof PolygonSymbolizer) {
                PolygonSymbolizer symb = (PolygonSymbolizer) sym;
                color = polyFill(symb);

            } else if (sym instanceof LineSymbolizer) {
                LineSymbolizer symb = (LineSymbolizer) sym;
                color = color(symb);

            } else if (sym instanceof PointSymbolizer) {
                PointSymbolizer symb = (PointSymbolizer) sym;
                color = pointFillWithAlpha(symb);
View Full Code Here

         * @param attrs1
         * @param hints
         * @throws OperationNotSupportedException
         */
        public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints ){
            LineSymbolizer symbol = StyleFactoryFinder.createStyleFactory().getDefaultLineSymbolizer();
            // symbol.setGraphic(null);
   
            for (int i = 0; i < value.length; i++) {
                if ((value[i] == null) || value[i].getElement() == null) {
                    continue;
                }
   
                Element e = value[i].getElement();
                if(elems[GEOMETRY].getName().equals(e.getName()))
                    symbol.setGeometryPropertyName((String)value[i].getValue());
   
                if(elems[STROKE].getName().equals(e.getName()))
                    symbol.setStroke((Stroke)value[i].getValue());
            }
           
            return symbol;
        }
View Full Code Here

        /*
         * Setting the geometryPropertyName arg to null signals that we want to
         * draw the default geomettry of features
         */
        LineSymbolizer sym = styleFactory.createLineSymbolizer(stroke, null);

        Rule rule = styleFactory.createRule();
        rule.symbolizers().add(sym);
        try
      rule.setFilter(ECQL.toFilter("geometryType(the_geom)='LineString' or geometryType(the_geom)='LinearRing' or geometryType(the_geom)='MultiLineString'"));
View Full Code Here

                // Lines
                if (!lineStyles.isEmpty()) {
                    Iterator<LineSymbolizer> iter = lineStyles.iterator();
                    while (iter.hasNext()) {
                        LineSymbolizer sym = (LineSymbolizer) iter.next();
                        try {
                            LineStyle2D style = (LineStyle2D) styleFactory.createStyle(feature,
                                    sym, scaleRange);
                            encodeLineStyle(feature, style, sym);
                        } catch (IllegalArgumentException iae) {
                            LOGGER.fine(iae.getMessage() + " for " + sym.toString());
                        }
                    }
                }

                // Polygons
                if (!polyStyles.isEmpty()) {
                    Iterator<PolygonSymbolizer> iter = polyStyles.iterator();
                    while (iter.hasNext()) {
                        PolygonSymbolizer sym = (PolygonSymbolizer) iter.next();
                        try {
                            PolygonStyle2D style = (PolygonStyle2D) styleFactory.createStyle(
                                    feature, sym, scaleRange);
                            // The last argument is forced outline
                            encodePolygonStyle(feature, style, sym, !lineStyles.isEmpty());
                        } catch (IllegalArgumentException iae) {
                            LOGGER.fine(iae.getMessage() + " for " + sym.toString());
                        }
                    }
                }

            } catch (Exception e) {
View Full Code Here

        int numClasses = 10;
        List <Rule> rules =  builder.jenksClassification(lineCollection, "jenks71", numClasses, false);
        builder.lineStyle(rules, new BlueColorRamp(), false);
        Rule ruleOne = rules.get(0);
        assertTrue(ruleOne.getSymbolizers()[0] instanceof LineSymbolizer);
        LineSymbolizer symbolizer = (LineSymbolizer)ruleOne.getSymbolizers()[0];
        assertEquals(new Color(0, 0, 49), symbolizer.getStroke().getColor().evaluate(null, Color.class));
        assertNotNull(ruleOne.getFilter());
        assertEquals(10, rules.size());
    }
View Full Code Here

    @Test
    public void testLineStyleReverse() throws Exception {
        int numClasses = 10;
        List <Rule> rules =  builder.jenksClassification(lineCollection, "jenks71", numClasses, false);
        builder.lineStyle(rules, new BlueColorRamp(), true);
        LineSymbolizer symbolizer = (LineSymbolizer)rules.get(0).getSymbolizers()[0];
        assertEquals(new Color(0, 0, 224), symbolizer.getStroke().getColor().evaluate(null, Color.class));
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.LineSymbolizer

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.