Package org.geotools.styling

Examples of org.geotools.styling.Symbolizer


            LOGGER.log(Level.SEVERE, "Error: no handler for this Classifier type");
        }

        // add an else rule to capture any missing features?
        if (elseMode != ELSEMODE_IGNORE) {
            Symbolizer symb = createSymbolizer(geometryAttrType, getElseColor(elseMode, colors),
                    opacity, defaultStroke);
            Rule elseRule = sb.createRule(symb);
            elseRule.setIsElseFilter(true);
            elseRule.setTitle("Else");
            elseRule.setName("else");
View Full Code Here


     * Helper for createXXXStyle methods. Creates a new Rule containing
     * a Symbolizer tailored to the geometry type of the features that
     * we are displaying.
     */
    private Rule createRule(Color outlineColor, Color fillColor) {
        Symbolizer symbolizer = null;
        Fill fill = null;
        Stroke stroke = sf.createStroke(ff.literal(outlineColor), ff.literal(LINE_WIDTH));

        switch (geometryType) {
            case POLYGON:
View Full Code Here

        Symbolizer[] symbolizers = rule.getSymbolizers();

        if (symbolizers != null) {
            for (int i = 0; i < symbolizers.length; i++) {
                Symbolizer symbolizer = symbolizers[i];
                symbolizer.accept(this);
            }
        }

        Graphic[] legendGraphics = rule.getLegendGraphic();
View Full Code Here

        assertTrue(rbe.isEstimateAccurate());
    }

    @Test
    public void testMultiSymbolizers() {
        Symbolizer ls = sb.createLineSymbolizer(sb.createStroke(10.8));
        Symbolizer ps = sb.createPolygonSymbolizer(sb.createStroke(12), sb.createFill());
        Rule r = sb.createRule(new Symbolizer[] { ls, ps });
        MetaBufferEstimator rbe = new MetaBufferEstimator();
        rbe.visit(r);
        assertEquals(12, rbe.getBuffer());
        assertTrue(rbe.isEstimateAccurate());
View Full Code Here

        assertTrue(rbe.isEstimateAccurate());
    }

    @Test
    public void testPropertyWidth() {
        Symbolizer ls = sb.createLineSymbolizer(sb.createStroke(sb.colorExpression(Color.BLACK), sb
                .attributeExpression("gimbo")));
        Symbolizer ps = sb.createPolygonSymbolizer(sb.createStroke(12), sb.createFill());
        Rule r = sb.createRule(new Symbolizer[] { ls, ps });
        MetaBufferEstimator rbe = new MetaBufferEstimator();
        rbe.visit(r);
        assertEquals(12, rbe.getBuffer());
        assertTrue(!rbe.isEstimateAccurate());
View Full Code Here

        assertTrue(!rbe.isEstimateAccurate());
    }
   
    @Test
    public void testEnvironmentWidth() {
        Symbolizer ls = sb.createLineSymbolizer(sb.createStroke(sb.colorExpression(Color.BLACK),
                ff.function("env", ff.literal("thickness"), ff.literal(10))));
        Rule r = sb.createRule(new Symbolizer[] { ls});
        MetaBufferEstimator rbe = new MetaBufferEstimator();
       
        // no env variable, fall back on the default value
View Full Code Here

    }
   
    @Test
    public void testConstantFunction() {
        Function cos = ff.function("cos", ff.literal(Math.toRadians(Math.PI)));
        Symbolizer ls = sb.createLineSymbolizer(sb.createStroke(sb.colorExpression(Color.BLACK), cos));
        Rule r = sb.createRule(new Symbolizer[] { ls });
        MetaBufferEstimator rbe = new MetaBufferEstimator();

        // cos(pi) == 1
        rbe.visit(r);
View Full Code Here

    }
   
    @Test
    public void testMath() {
        Add add = ff.add(ff.literal("5"), ff.literal("-2"));
        Symbolizer ls = sb.createLineSymbolizer(sb.createStroke(sb.colorExpression(Color.BLACK), add));
        Rule r = sb.createRule(new Symbolizer[] { ls });
        MetaBufferEstimator rbe = new MetaBufferEstimator();
       
        // 5-2 = 3
        rbe.visit(r);
View Full Code Here

    }

    public void visit(ImageOutline outline) {
        //copy the symbolizer
        final Symbolizer symb = outline.getSymbolizer();
        final Symbolizer copySymb = copy(symb);

        final ImageOutline copy = sf.createImageOutline(copySymb);
        copy.setSymbolizer(copySymb);
        if (STRICT && !copy.equals(outline)) {
            throw new IllegalStateException("Was unable to duplicate provided ImageOutline:" + outline);
View Full Code Here

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value) throws Exception {

        Symbolizer sym = (Symbolizer) value;
        //      &lt;xsd:sequence&gt;
        //          &lt;xsd:element minOccurs="0" ref="se:Name"/&gt;
        //          &lt;xsd:element minOccurs="0" ref="se:Description"/&gt;
        //          &lt;xsd:element minOccurs="0" ref="se:BaseSymbolizer"/&gt;
        //      &lt;/xsd:sequence&gt;
        //      &lt;xsd:attribute name="version" type="se:VersionType"/&gt;
        //      &lt;xsd:attribute name="uom" type="xsd:anyURI"/&gt;
        if (node.hasChild("Name")) {
            sym.setName((String)node.getChildValue("Name"));
        }
        if (node.hasChild("Description")) {
            sym.setDescription((Description) node.getChildValue("Description"));
        }
        if (node.hasChild("BaseSymbolizer")) {
            //throw new IllegalArgumentException("BaseSymbolizer not supported");
        }
        if (node.hasAttribute("version")) {
            //throw new IllegalArgumentException("version not supported");
        }
        if (node.hasAttribute("uom")) {
            String uom = ((URI) node.getAttributeValue("uom")).toString();
            if (UomOgcMapping.get(uom) == null) {
                throw new IllegalArgumentException("uom " + uom + " not supported");
            }
           
            sym.setUnitOfMeasure(UomOgcMapping.get(uom).getUnit());
        }
       
        return sym;
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.Symbolizer

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.