com.google.android.gms.maps.model.GroundOverlay Java Examples
The following examples show how to use
com.google.android.gms.maps.model.GroundOverlay.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KmlRenderer.java From android-maps-utils with Apache License 2.0 | 6 votes |
/** * 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 = getCachedGroundOverlayImage(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); } } }
Example #2
Source File: Renderer.java From android-maps-utils with Apache License 2.0 | 6 votes |
/** * Given a Marker, Polyline, Polygon or an array of these and removes it from the map * * @param mapObject map object or array of map objects to remove from the map */ protected void removeFromMap(Object mapObject) { if (mapObject instanceof Marker) { mMarkers.remove((Marker) mapObject); } else if (mapObject instanceof Polyline) { mPolylines.remove((Polyline) mapObject); } else if (mapObject instanceof Polygon) { mPolygons.remove((Polygon) mapObject); } else if (mapObject instanceof GroundOverlay) { mGroundOverlays.remove((GroundOverlay) mapObject); } else if (mapObject instanceof ArrayList) { for (Object mapObjectElement : (ArrayList) mapObject) { removeFromMap(mapObjectElement); } } }
Example #3
Source File: BaseNiboFragment.java From Nibo with MIT License | 5 votes |
public void addOverlay(LatLng place) { GroundOverlay groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions() .position(place, 100) .transparency(0.5f) .zIndex(3) .image(BitmapDescriptorFactory.fromBitmap(drawableToBitmap(getActivity().getResources().getDrawable(R.drawable.map_overlay))))); startOverlayAnimation(groundOverlay); }
Example #4
Source File: KmlRenderer.java From android-maps-utils with Apache License 2.0 | 5 votes |
/** * 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 (getCachedGroundOverlayImage(groundOverlayUrl) != null) { addGroundOverlayToMap(groundOverlayUrl, getGroundOverlayMap(), true); } else { mGroundOverlayUrls.add(groundOverlayUrl); } } } }
Example #5
Source File: KmlRenderer.java From android-maps-utils with Apache License 2.0 | 5 votes |
/** * Adds a ground overlay adds all the ground overlays onto the map and recursively adds all * ground overlays stored in the given containers * * @param groundOverlays ground overlays to add to the map * @param kmlContainers containers to check for ground overlays */ private void addGroundOverlays(HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays, Iterable<KmlContainer> kmlContainers) { addGroundOverlays(groundOverlays); for (KmlContainer container : kmlContainers) { addGroundOverlays(container.getGroundOverlayHashMap(), container.getContainers()); } }
Example #6
Source File: KmlRenderer.java From android-maps-utils with Apache License 2.0 | 5 votes |
/** * Stores all given data from KMZ file * * @param styles hashmap of styles * @param styleMaps hashmap of style maps * @param features hashmap of features * @param folders array of containers * @param groundOverlays hashmap of ground overlays * @param images hashmap of images */ /*package*/ void storeKmzData(HashMap<String, KmlStyle> styles, HashMap<String, String> styleMaps, HashMap<KmlPlacemark, Object> features, ArrayList<KmlContainer> folders, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays, HashMap<String, Bitmap> images) { storeData(styles, styleMaps, features, folders, groundOverlays); for (Map.Entry<String, Bitmap> entry : images.entrySet()) { cacheBitmap(entry.getKey(), entry.getValue()); } }
Example #7
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 5 votes |
@Override public void onGroundOverlayClick(GroundOverlay groundOverlay) { Collection collection = mAllObjects.get(groundOverlay); if (collection != null && collection.mGroundOverlayClickListener != null) { collection.mGroundOverlayClickListener.onGroundOverlayClick(groundOverlay); } }
Example #8
Source File: KmlContainer.java From android-maps-utils with Apache License 2.0 | 5 votes |
KmlContainer(HashMap<String, String> properties, HashMap<String, KmlStyle> styles, HashMap<KmlPlacemark, Object> placemarks, HashMap<String, String> styleMaps, ArrayList<KmlContainer> containers, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlay, String Id) { mProperties = properties; mPlacemarks = placemarks; mStyles = styles; mStyleMap = styleMaps; mContainers = containers; mGroundOverlays = groundOverlay; mContainerId = Id; }
Example #9
Source File: Renderer.java From android-maps-utils with Apache License 2.0 | 5 votes |
/** * Stores all given data * * @param styles hashmap of styles * @param styleMaps hashmap of style maps * @param features hashmap of features * @param folders array of containers * @param groundOverlays hashmap of ground overlays */ protected void storeData(HashMap<String, KmlStyle> styles, HashMap<String, String> styleMaps, HashMap<KmlPlacemark, Object> features, ArrayList<KmlContainer> folders, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays) { mStyles = styles; mStyleMaps = styleMaps; mFeatures.putAll(features); mContainers = folders; mGroundOverlayMap = groundOverlays; }
Example #10
Source File: Renderer.java From android-maps-utils with Apache License 2.0 | 5 votes |
/** * Removes all ground overlays in the given hashmap * * @param groundOverlays hashmap of ground overlays to remove */ protected void removeGroundOverlays(HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays) { for (GroundOverlay groundOverlay : groundOverlays.values()) { // Ground overlay values may be null if their image was not yet downloaded if (groundOverlay != null) { mGroundOverlays.remove(groundOverlay); } } }
Example #11
Source File: GroundOverlayClickFuncTest.java From RxGoogleMaps with Apache License 2.0 | 5 votes |
@Test public void shouldEmmitGroundOverlay() throws Exception { TestSubscriber<GroundOverlay> testSubscriber = new TestSubscriber<>(); new GroundOverlayClickFunc().call(googleMap) .subscribe(testSubscriber); verify(googleMap).setOnGroundOverlayClickListener(argumentCaptor.capture()); argumentCaptor.getValue().onGroundOverlayClick(null); testSubscriber.assertNoErrors(); testSubscriber.assertValueCount(1); testSubscriber.assertValue(null); }
Example #12
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
public void showAll() { for (GroundOverlay groundOverlay : getGroundOverlays()) { groundOverlay.setVisible(true); } }
Example #13
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
public GroundOverlay addGroundOverlay(GroundOverlayOptions opts) { GroundOverlay groundOverlay = mMap.addGroundOverlay(opts); super.add(groundOverlay); return groundOverlay; }
Example #14
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
public void hideAll() { for (GroundOverlay groundOverlay : getGroundOverlays()) { groundOverlay.setVisible(false); } }
Example #15
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
@Override protected void removeObjectFromMap(GroundOverlay object) { object.remove(); }
Example #16
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
public boolean remove(GroundOverlay groundOverlay) { return super.remove(groundOverlay); }
Example #17
Source File: ShapeActivity.java From Complete-Google-Map-API-Tutorial with Apache License 2.0 | 4 votes |
@Override public void onGroundOverlayClick(GroundOverlay groundOverlay) { onClick((CustomTag) groundOverlay.getTag()); }
Example #18
Source File: GroundOverlayManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
public java.util.Collection<GroundOverlay> getGroundOverlays() { return getObjects(); }
Example #19
Source File: KmlParser.java From android-maps-utils with Apache License 2.0 | 4 votes |
/** * @return A list of Ground Overlays */ /* package */ HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlays() { return mGroundOverlays; }
Example #20
Source File: KmlContainerParser.java From android-maps-utils with Apache License 2.0 | 4 votes |
/** * Creates a new KmlContainer objects and assigns specific elements read from the XmlPullParser * to the new KmlContainer. * * @param parser XmlPullParser object reading from a KML file * @return KmlContainer object with properties read from the XmlPullParser */ private static KmlContainer assignPropertiesToContainer(XmlPullParser parser) throws XmlPullParserException, IOException { String startTag = parser.getName(); String containerId = null; HashMap<String, String> containerProperties = new HashMap<String, String>(); HashMap<String, KmlStyle> containerStyles = new HashMap<String, KmlStyle>(); HashMap<? extends Feature, Object> containerPlacemarks = new HashMap<>(); ArrayList<KmlContainer> nestedContainers = new ArrayList<KmlContainer>(); HashMap<String, String> containerStyleMaps = new HashMap<String, String>(); HashMap<KmlGroundOverlay, GroundOverlay> containerGroundOverlays = new HashMap<KmlGroundOverlay, GroundOverlay>(); if (parser.getAttributeValue(null, "id") != null) { containerId = parser.getAttributeValue(null, "id"); } parser.next(); int eventType = parser.getEventType(); while (!(eventType == END_TAG && parser.getName().equals(startTag))) { if (eventType == START_TAG) { if (parser.getName().matches(UNSUPPORTED_REGEX)) { KmlParser.skip(parser); } else if (parser.getName().matches(CONTAINER_REGEX)) { nestedContainers.add(assignPropertiesToContainer(parser)); } else if (parser.getName().matches(PROPERTY_REGEX)) { containerProperties.put(parser.getName(), parser.nextText()); } else if (parser.getName().equals(STYLE_MAP)) { setContainerStyleMap(parser, containerStyleMaps); } else if (parser.getName().equals(STYLE)) { setContainerStyle(parser, containerStyles); } else if (parser.getName().equals(PLACEMARK)) { setContainerPlacemark(parser, (HashMap<KmlPlacemark, Object>) containerPlacemarks); } else if (parser.getName().equals(EXTENDED_DATA)) { setExtendedDataProperties(parser, containerProperties); } else if (parser.getName().equals(GROUND_OVERLAY)) { containerGroundOverlays .put(KmlFeatureParser.createGroundOverlay(parser), null); } } eventType = parser.next(); } return new KmlContainer(containerProperties, containerStyles, (HashMap<KmlPlacemark, Object>) containerPlacemarks, containerStyleMaps, nestedContainers, containerGroundOverlays, containerId); }
Example #21
Source File: GroundOverlayDemoActivity.java From android-samples with Apache License 2.0 | 4 votes |
/** * Toggles the visibility between 100% and 50% when a {@link GroundOverlay} is clicked. */ @Override public void onGroundOverlayClick(GroundOverlay groundOverlay) { // Toggle transparency value between 0.0f and 0.5f. Initial default value is 0.0f. groundOverlayRotated.setTransparency(0.5f - groundOverlayRotated.getTransparency()); }
Example #22
Source File: TagsDemoActivity.java From android-samples with Apache License 2.0 | 4 votes |
@Override public void onGroundOverlayClick(GroundOverlay groundOverlay) { onClick((CustomTag) groundOverlay.getTag()); }
Example #23
Source File: KmlRenderer.java From android-maps-utils with Apache License 2.0 | 3 votes |
/** * Stores all given data from KML file * * @param styles hashmap of styles * @param styleMaps hashmap of style maps * @param features hashmap of features * @param folders array of containers * @param groundOverlays hashmap of ground overlays */ /*package*/ void storeKmlData(HashMap<String, KmlStyle> styles, HashMap<String, String> styleMaps, HashMap<KmlPlacemark, Object> features, ArrayList<KmlContainer> folders, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays) { storeData(styles, styleMaps, features, folders, groundOverlays); }
Example #24
Source File: KmlContainer.java From android-maps-utils with Apache License 2.0 | 2 votes |
/** * Gets all of the ground overlays which were set in the container * * @return A set of ground overlays */ /* package */ HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlayHashMap() { return mGroundOverlays; }
Example #25
Source File: Renderer.java From android-maps-utils with Apache License 2.0 | 2 votes |
/** * Adds a ground overlay to the map * * @param groundOverlayOptions GroundOverlay style options to be added to the map * @return new GroundOverlay object created from the given GroundOverlayOptions */ protected GroundOverlay attachGroundOverlay(GroundOverlayOptions groundOverlayOptions) { return mGroundOverlays.addGroundOverlay(groundOverlayOptions); }
Example #26
Source File: Renderer.java From android-maps-utils with Apache License 2.0 | 2 votes |
/** * Gets the ground overlays on the current layer * * @return mGroundOverlayMap hashmap contains the ground overlays */ public HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlayMap() { return mGroundOverlayMap; }