/** * Adds all given ground overlays to the map * * @param groundOverlays hashmap of ground overlays to add to the map */ private void addGroundOverlays(HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays) { for (KmlGroundOverlay groundOverlay : groundOverlays.keySet()) { String groundOverlayUrl = groundOverlay.getImageUrl(); if (groundOverlayUrl != null && groundOverlay.getLatLngBox() != null) { // Can't draw overlay if url and coordinates are missing if (getImagesCache().get(groundOverlayUrl) != null) { addGroundOverlayToMap(groundOverlayUrl, mGroundOverlays, true); } else if (!mGroundOverlayUrls.contains(groundOverlayUrl)) { mGroundOverlayUrls.add(groundOverlayUrl); } } } }
return new KmlGroundOverlay(imageUrl, latLonBox, drawOrder, visibility, properties, rotation);
public void testGroundOverlay() throws Exception { XmlPullParser xmlPullParser = createParser(R.raw.amu_ground_overlay); KmlGroundOverlay groundOverlay = KmlFeatureParser.createGroundOverlay(xmlPullParser); assertNotNull(groundOverlay); assertEquals(groundOverlay.getProperty("name"), "Sample Ground Overlay"); assertNotNull(groundOverlay.getImageUrl()); assertEquals(groundOverlay.getGroundOverlayOptions().getZIndex(), 99.0f); assertTrue(groundOverlay.getGroundOverlayOptions().isVisible()); assertNotNull(groundOverlay.getLatLngBox()); xmlPullParser = createParser(R.raw.amu_ground_overlay_color); groundOverlay = KmlFeatureParser.createGroundOverlay(xmlPullParser); assertNotNull(groundOverlay); }
/** * Adds ground overlays from a given URL onto the map * * @param groundOverlayUrl url of ground overlay * @param groundOverlays hashmap of ground overlays to add to the map */ private void addGroundOverlayToMap(String groundOverlayUrl, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays, boolean containerVisibility) { BitmapDescriptor groundOverlayBitmap = BitmapDescriptorFactory .fromBitmap(getImagesCache().get(groundOverlayUrl)); for (KmlGroundOverlay kmlGroundOverlay : groundOverlays.keySet()) { if (kmlGroundOverlay.getImageUrl().equals(groundOverlayUrl)) { GroundOverlayOptions groundOverlayOptions = kmlGroundOverlay.getGroundOverlayOptions() .image(groundOverlayBitmap); GroundOverlay mapGroundOverlay = attachGroundOverlay(groundOverlayOptions); if (!containerVisibility) { mapGroundOverlay.setVisible(false); } groundOverlays.put(kmlGroundOverlay, mapGroundOverlay); } } }