Package org.geotools.styling

Examples of org.geotools.styling.Stroke


     */
    public void setStroke( Stroke aLine, Mode mode, Color defaultColor ) {
        listen(false);
        try {
            boolean enabled = true;
            Stroke line = aLine;

            if (line == null) {
                StyleBuilder builder = new StyleBuilder();
                line = builder.createStroke(defaultColor);
                enabled = false;
View Full Code Here


        SimpleFeatureType schema = featureCollection.getSchema();
        geometryName.setInput(schema);
        String name = DEFAULT_GEOMETRY;

        Stroke stroke = null;
        Fill fill = null;
        Graphic graphic = null;
        TextSymbolizer text = null;
        LabelPlacement placement = null;
View Full Code Here

        {
            UomRescaleStyleVisitor visitor = null;
           
            StyleBuilder styleBuilder = new StyleBuilder();

            Stroke stroke = null;
            LineSymbolizerImpl lineSymb = (LineSymbolizerImpl) styleBuilder.createLineSymbolizer(stroke);
            lineSymb.setUnitOfMeasure(SI.METER);
           
            visitor = new UomRescaleStyleVisitor(10);
View Full Code Here

           

            // creates the symbolizer for the test
            Expression color = styleBuilder.colorExpression(Color.RED);
            Expression width = styleBuilder.attributeExpression("width");
            Stroke stroke = styleBuilder.createStroke(color, width);
            LineSymbolizerImpl lineSymb = (LineSymbolizerImpl) styleBuilder.createLineSymbolizer(stroke);
            lineSymb.setUnitOfMeasure(uom);

           
            // rescales symbolizer
            visitor = new UomRescaleStyleVisitor(scaleMetersToPixel);

            lineSymb.accept(visitor);
            LineSymbolizer rescaledLineSymb = (LineSymbolizer) visitor.getCopy();

           
            // tests results
            org.opengis.style.Stroke rescaledStroke = rescaledLineSymb.getStroke();
            Expression rescaledWidth = rescaledStroke.getWidth();
            double rescaledWidthValue = rescaledWidth.evaluate(feature, Double.class);
            double expectedRescaledWidthValue = computeExpectedRescaleSize(widthValue, scaleMetersToPixel, uom);
           
            assertEquals(stroke.getColor(), rescaledStroke.getColor());
            assertEquals(expectedRescaledWidthValue, rescaledWidthValue, 0d);
            assertNotSame(SI.METER, rescaledLineSymb.getUnitOfMeasure());
            assertNotSame(rescaledLineSymb, lineSymb);
        }
        catch (Exception e2)
View Full Code Here

    public void testRescaleGraphicFillStrokes() {
        // create a graphic that needs rescaling
        StyleBuilder sb = new StyleBuilder();
       
        // a graphic stroke
        Stroke stroke = sb.createStroke();
        stroke.setColor(null);
        stroke.setGraphicStroke(sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(1)), null));
       
        // a graphic fill
        Fill fill = sb.createFill();
        fill.setColor(null);
        fill.setGraphicFill(sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));
View Full Code Here

    }

    public void test() throws Exception {
        SLDMockData.stroke(document, document);

        Stroke stroke = (Stroke) parse();
        assertNotNull(stroke);

        assertEquals(Integer.parseInt("12", 16), SLD.color(stroke.getColor()).getRed());
        assertEquals(Integer.parseInt("34", 16), SLD.color(stroke.getColor()).getGreen());
        assertEquals(Integer.parseInt("56", 16), SLD.color(stroke.getColor()).getBlue());

        assertNotNull(stroke.getGraphicFill());
        assertEquals("butt", Filters.asString(stroke.getLineCap()));
        assertEquals("mitre", Filters.asString(stroke.getLineJoin()));

        assertEquals(1.1d, stroke.getDashArray()[0], 0.000001);
        assertEquals(2.2d, stroke.getDashArray()[1], 0.000001);
        assertEquals(3.3d, stroke.getDashArray()[2], 0.000001);
        assertEquals(4.4d, stroke.getDashArray()[3], 0.000001);

        assertEquals(1.0, Filters.asDouble(stroke.getOpacity()), 0d);
    }
View Full Code Here

        assertEquals("MyLineSymbolizer", sym.getName());
        assertEquals("Example Symbol", sym.getDescription().getTitle().toString());
        assertEquals("This is just a simple example of a line symbolizer.",
            sym.getDescription().getAbstract().toString());
       
        Stroke s = sym.getStroke();
        assertEquals(255, s.getColor().evaluate(null, Color.class).getBlue());
        assertEquals(new Integer(2), s.getWidth().evaluate(null, Integer.class));
    }
View Full Code Here

     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        String wkName = (String) node.getChildValue("WellKnownName");
        Stroke stroke = (Stroke) node.getChildValue("Stroke");
        Fill fill = (Fill) node.getChildValue("Fill");

        Mark mark = styleFactory.createMark();

        if (wkName != null) {
View Full Code Here

        assertNotNull( clone );
    }
   
    @Test
    public void testStroke() throws Exception {
        Stroke original = sb.createStroke(Color.RED, 2, new float[] {5, 10});
        original.accept(visitor);
        Stroke clone = (Stroke) visitor.getCopy();
       
        assertEquals(4.0d, clone.getWidth().evaluate(null, Double.class), 0d);
        assertEquals(10.0f, clone.getDashArray()[0], 0d);
        assertEquals(20.0f, clone.getDashArray()[1], 0d);
    }
View Full Code Here

    public void testRescaleGraphicFillStrokes() {
        // create a graphic that needs rescaling
        StyleBuilder sb = new StyleBuilder();
       
        // a graphic stroke
        Stroke stroke = sb.createStroke();
        stroke.setColor(null);
        stroke.setGraphicStroke(sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(1)), null));
       
        // a graphic fill
        Fill fill = sb.createFill();
        fill.setColor(null);
        fill.setGraphicFill(sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));
View Full Code Here

TOP

Related Classes of org.geotools.styling.Stroke

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.