/** * Sets a marker info window if no <text> tag was found in the KML document. This method sets * the marker title as the text found in the <name> start tag and the snippet as <description> * * @param style Style to apply */ private void setMarkerInfoWindow(KmlStyle style, Marker marker, final KmlPlacemark placemark) { boolean hasName = placemark.hasProperty("name"); boolean hasDescription = placemark.hasProperty("description"); boolean hasBalloonOptions = style.hasBalloonStyle(); boolean hasBalloonText = style.getBalloonOptions().containsKey("text"); if (hasBalloonOptions && hasBalloonText) { marker.setTitle(style.getBalloonOptions().get("text")); createInfoWindow(); } else if (hasBalloonOptions && hasName) { marker.setTitle(placemark.getProperty("name")); createInfoWindow(); } else if (hasName && hasDescription) { marker.setTitle(placemark.getProperty("name")); marker.setSnippet(placemark.getProperty("description")); createInfoWindow(); } else if (hasDescription) { marker.setTitle(placemark.getProperty("description")); createInfoWindow(); } else if (hasName) { marker.setTitle(placemark.getProperty("name")); createInfoWindow(); } }
public void testProperties() throws Exception { XmlPullParser xmlPullParser = createParser(R.raw.amu_multigeometry_placemarks); KmlPlacemark placemark = KmlFeatureParser.createPlacemark(xmlPullParser); assertTrue( placemark.hasProperties()); assertEquals( placemark .getProperty("name"), "Placemark Test"); assertNull( placemark .getProperty("description")); }
public void testExtendedData() throws Exception { XmlPullParser xmlPullParser = createParser(R.raw.amu_multiple_placemarks); KmlPlacemark placemark = KmlFeatureParser.createPlacemark(xmlPullParser); assertNotNull(placemark.getProperty("holeNumber")); }
public void testMultiGeometries() throws Exception { XmlPullParser xmlPullParser = createParser(R.raw.amu_nested_multigeometry); KmlPlacemark feature = KmlFeatureParser.createPlacemark(xmlPullParser); assertEquals(feature.getProperty("name"), "multiPointLine"); assertEquals(feature.getProperty("description"), "Nested MultiGeometry structure"); assertEquals(feature.getGeometry().getGeometryType(), "MultiGeometry"); ArrayList<Geometry> objects = (ArrayList<Geometry>) feature.getGeometry().getGeometryObject(); assertEquals(objects.get(0).getGeometryType(), "Point"); assertEquals(objects.get(1).getGeometryType(), "LineString"); assertEquals(objects.get(2).getGeometryType(), "MultiGeometry"); ArrayList<Geometry> subObjects = (ArrayList<Geometry>) objects.get(2).getGeometryObject(); assertEquals(subObjects.get(0).getGeometryType(), "Point"); assertEquals(subObjects.get(1).getGeometryType(), "LineString"); }
drawOrder = Float.parseFloat(placemark.getProperty("drawOrder")); } catch (NumberFormatException e) { hasDrawOrder = false;