/** * Parses the IconStyle, LineStyle and PolyStyle tags into a KmlStyle object */ /* package */ static KmlStyle createStyle(XmlPullParser parser) throws IOException, XmlPullParserException { KmlStyle styleProperties = new KmlStyle(); setStyleId(parser.getAttributeValue(null, "id"), styleProperties); int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals("Style"))) { if (eventType == START_TAG) { if (parser.getName().equals("IconStyle")) { createIconStyle(parser, styleProperties); } else if (parser.getName().equals("LineStyle")) { createLineStyle(parser, styleProperties); } else if (parser.getName().equals("PolyStyle")) { createPolyStyle(parser, styleProperties); } else if (parser.getName().equals("BalloonStyle")) { createBalloonStyle(parser, styleProperties); } } eventType = parser.next(); } return styleProperties; }
mStyles.put(null, new KmlStyle());
public void testAssignStyleMap() { HashMap<String, String> styleMap = new HashMap<String, String>(); styleMap.put("BlueKey", "BlueValue"); HashMap<String, KmlStyle> styles = new HashMap<String, KmlStyle>(); KmlStyle blueStyle = new KmlStyle(); KmlStyle redStyle = new KmlStyle(); styles.put("BlueValue", blueStyle); styles.put("RedValue", redStyle); KmlRenderer renderer = new KmlRenderer(null, null); renderer.assignStyleMap(styleMap, styles); assertNotNull(styles.get("BlueKey")); assertEquals(styles.get("BlueKey"), styles.get("BlueValue")); styles.put("BlueValue", null); renderer.assignStyleMap(styleMap, styles); assertEquals(styles.get("BlueKey"), null); styleMap.put("BlueKey", "RedValue"); renderer.assignStyleMap(styleMap, styles); assertNotNull(styleMap.get("BlueKey")); assertEquals(styles.get("BlueKey"), redStyle); } }
public void testStyleId() throws Exception { KmlStyle kmlStyle = new KmlStyle(); kmlStyle.setStyleId("BlueLine"); assertEquals("BlueLine", kmlStyle.getStyleId()); }
public void testMarkerColor() { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getMarkerOptions()); }
public void testColorFormatting() throws Exception { KmlStyle kmlStyle = new KmlStyle(); // AABBGGRR -> AARRGGBB. kmlStyle.setFillColor("ff579D00"); assertEquals(Color.parseColor("#009D57"), kmlStyle.getPolygonOptions().getFillColor()); // Alpha w/ missing 0. kmlStyle.setFillColor(" D579D00"); assertEquals(Color.parseColor("#0D009D57"), kmlStyle.getPolygonOptions().getFillColor()); }
public void testFillColor() throws Exception { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getPolygonOptions()); kmlStyle.setFillColor("000000"); int fillColor = Color.parseColor("#000000"); assertEquals(fillColor, kmlStyle.getPolygonOptions().getFillColor()); }
public void testFill() throws Exception { KmlStyle kmlStyle = new KmlStyle(); kmlStyle.setFill(true); assertTrue(kmlStyle.hasFill()); kmlStyle.setFill(false); assertFalse(kmlStyle.hasFill()); }
public void testHeading() throws Exception { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getMarkerOptions()); assertEquals(kmlStyle.getMarkerOptions().getRotation(), 0.0f); kmlStyle.setHeading(3); assertEquals(kmlStyle.getMarkerOptions().getRotation(), 3.0f); }
public void testWidth() throws Exception { KmlStyle kmlStyle = new KmlStyle(); assertNotNull(kmlStyle); assertNotNull(kmlStyle.getPolygonOptions()); assertNotNull(kmlStyle.getPolylineOptions()); assertEquals(kmlStyle.getPolylineOptions().getWidth(), 10.0f); assertEquals(kmlStyle.getPolygonOptions().getStrokeWidth(), 10.0f); kmlStyle.setWidth(11.0f); assertEquals(kmlStyle.getPolylineOptions().getWidth(), 11.0f); assertEquals(kmlStyle.getPolygonOptions().getStrokeWidth(), 11.0f); }
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()); }