Package slash.navigation.kml.binding20

Examples of slash.navigation.kml.binding20.LineStyle


        /**
         * Encodes a KML IconStyle + LineStyle from a polygon style and symbolizer.
         */
        protected void setLineStyle(Style style, SimpleFeature feature, Stroke stroke) {
            LineStyle ls = style.createAndSetLineStyle();

            if (stroke != null) {
                // opacity
                Double opacity = stroke.getOpacity().evaluate(feature, Double.class);
                if (opacity == null || Double.isNaN(opacity)) {
                    opacity = 1.0;
                }

                Color color = null;
                Expression sc = stroke.getColor();
                if (sc != null) {
                    color = (Color) sc.evaluate(feature, Color.class);
                }
                if (color == null) {
                    color = Color.DARK_GRAY;
                }
                ls.setColor(colorToHex(color, opacity));

                // width
                Double width = null;
                Expression sw = stroke.getWidth();
                if (sw != null) {
                    width = sw.evaluate(feature, Double.class);
                }
                if (width == null) {
                    width = 1d;
                }
                ls.setWidth(width);
            } else {
                // default
                ls.setColor("ffaaaaaa");
                ls.setWidth(1);
            }
        }
View Full Code Here


public class KmlFormatIT {
    @Test
    public void testReader() throws FileNotFoundException, JAXBException {
        Reader reader = new FileReader(TEST_PATH + "from20.kml");
        Kml kml = (Kml) newUnmarshaller20().unmarshal(reader);
        assertNotNull(kml);
        assertNotNull(kml.getFolder());
        assertEquals(3, kml.getFolder().getDocumentOrFolderOrGroundOverlay().size());
    }
View Full Code Here

    }

    @Test
    public void testInputStream() throws FileNotFoundException, JAXBException {
        InputStream in = new FileInputStream(TEST_PATH + "from20.kml");
        Kml kml = (Kml) newUnmarshaller20().unmarshal(in);
        assertNotNull(kml);
        assertNotNull(kml.getFolder());
        assertEquals(3, kml.getFolder().getDocumentOrFolderOrGroundOverlay().size());
    }
View Full Code Here

    }

    @Test
    public void testUnmarshal20() throws IOException, JAXBException {
        Reader reader = new FileReader(TEST_PATH + "from20.kml");
        Kml kml = unmarshal20(reader);
        assertNotNull(kml);
        assertNotNull(kml.getFolder());
        assertEquals(3, kml.getFolder().getDocumentOrFolderOrGroundOverlay().size());
    }
View Full Code Here

TOP

Related Classes of slash.navigation.kml.binding20.LineStyle

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.