/** * Sets relevant styling properties to the KmlStyle object that are found in the LineStyle tag * Supported tags include color, width * * @param style Style object to add properties to */ private static void createLineStyle(XmlPullParser parser, KmlStyle style) throws XmlPullParserException, IOException { int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("LineStyle"))) { if (eventType == START_TAG) { if (parser.getName().equals(COLOR_STYLE_COLOR)) { style.setOutlineColor(parser.nextText()); } else if (parser.getName().equals(LINE_STYLE_WIDTH)) { style.setWidth(Float.valueOf(parser.nextText())); } else if (parser.getName().equals(COLOR_STYLE_MODE)) { style.setLineColorMode(parser.nextText()); } } eventType = parser.next(); } }
public void testLineColor() throws Exception { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getPolygonOptions()); assertNotNull(kmlStyle.getPolylineOptions()); assertEquals(Color.BLACK, kmlStyle.getPolylineOptions().getColor()); assertEquals(Color.BLACK, kmlStyle.getPolygonOptions().getStrokeColor()); kmlStyle.setOutlineColor("FFFFFF"); assertEquals(Color.WHITE, kmlStyle.getPolylineOptions().getColor()); assertEquals(Color.WHITE, kmlStyle.getPolygonOptions().getStrokeColor()); }