Package org.geotools.styling

Examples of org.geotools.styling.Stroke


        assertEquals(2.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
    }
   
    @Test
    public void testRescaleLocalUOM() throws Exception {
        Stroke original = sb.createStroke(Color.RED, 2, new float[] {5, 10});
        original.setWidth(ff.literal("2m"));
        original.accept(visitor);
        Stroke clone = (Stroke) visitor.getCopy();
       
        assertEquals("4m", clone.getWidth().evaluate(null, String.class));
    }
View Full Code Here


        assertEquals("4m", clone.getWidth().evaluate(null, String.class));
    }
   
    @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();
       
View Full Code Here

        assertEquals("4px", clone.getStroke().getWidth().evaluate(null, String.class));
    }
   
    @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

     * @return the created style.
     */
    public static Style createPolygonStyle() {

        // create a partially opaque outline stroke
        Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1),
                filterFactory.literal(0.5));

        // create a partial opaque fill
        Fill fill = styleFactory.createFill(filterFactory.literal(Color.CYAN), filterFactory.literal(0.5));

View Full Code Here

     * Create a default line style.
     *
     * @return the created style.
     */
    public static Style createLineStyle() {
        Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1));

        /*
         * Setting the geometryPropertyName arg to null signals that we want to
         * draw the default geomettry of features
         */
 
View Full Code Here

        Fill notEq = sf.createFill(ff.literal("#FF0000"));
        assertEqualsContract(clone, notEq, fill);
    }

    public void testStroke() {
        Stroke stroke = sf.getDefaultStroke();
        Stroke clone = visitor.copy( stroke );
        assertCopy(stroke, clone);

        Stroke notEq = sf.createStroke(ff.literal("#FF0000"), ff
                .literal(10));
        assertEqualsContract(clone, notEq, stroke);

        // a stroke is a complex object with lots of properties,
        // need more extensive tests here.
        Stroke dashArray = sf.getDefaultStroke();
        dashArray.setDashArray(new float[] { 1.0f, 2.0f, 3.0f });

        Stroke dashArray2 = (Stroke) ((Cloneable)dashArray).clone();
        assertEqualsContract(dashArray, dashArray2);
    }
View Full Code Here

        }

        for( GraphicalSymbol gs : graphic.graphicalSymbols() ) {
            if ((gs != null) && (gs instanceof Mark)) {
                Mark mark = (Mark) gs;
                Stroke stroke = mark.getStroke();
                if (stroke != null) {
                    Color colour = color(stroke);
                    if (colour == null) {
                        return null;
                    }
                    Expression opacity = stroke.getOpacity();
                    if (opacity == null)
                        opacity = ff.literal(1.0);
                    float alpha = (float) Filters.asDouble(opacity);
                    colour = new Color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, alpha);
                    if (colour != null) {
View Full Code Here

         * @param hints
         * @throws OperationNotSupportedException
         */
        public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints )
                throws OperationNotSupportedException {
            Stroke symbol = StyleFactoryFinder.createStyleFactory().getDefaultStroke();
   
            for (int i = 0; i < value.length; i++) {
                if ((value[i] == null) || value[i].getElement() == null) {
                    continue;
                }
   
                Element e = value[i].getElement();
                if(elems[GRAPHICFILL].getName().equals(e.getName()))
                    symbol.setGraphicFill((Graphic)value[i].getValue());
   
                if(elems[GRAPHICSTROKE].getName().equals(e.getName()))
                    symbol.setGraphicStroke((Graphic)value[i].getValue());
   
                if(elems[CSSPARAMETER].getName().equals(e.getName())){
                    Expression css = (Expression)value[i].getValue();
                    // TODO apply the css
                }
View Full Code Here

         * @param hints
         * @throws OperationNotSupportedException
         */
        public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints )
                throws OperationNotSupportedException {
            Stroke symbol = StyleFactoryFinder.createStyleFactory().getDefaultStroke();

            for (int i = 0; i < value.length; i++) {
                if ((value[i] == null) || value[i].getElement() == null) {
                    continue;
                }

                Element e = value[i].getElement();
                if(elems[GRAPHICFILL].getName().equals(e.getName()))
                    symbol.setGraphicFill((Graphic)value[i].getValue());

                if(elems[CSSPARAMETER].getName().equals(e.getName())){
                    Expression css = (Expression)value[i].getValue();
                    // TODO apply the css
                }
View Full Code Here

    /**
     * Create a Style to draw polygon features
     */
    private static Style createPolygonStyle(Color strokeColor, Color fillColor) {
        // create a partially opaque outline stroke
        Stroke stroke = styleFactory.createStroke(
                filterFactory.literal(strokeColor),
                filterFactory.literal(1),
                filterFactory.literal(0.5));

        // create a partial opaque fill
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.