private void placeBootprint(LatLng latLng, float direction) { if (mMap != null) { final BitmapDescriptor bootprint; // pick left/right print if (mTotalSteps++ % 2 == 0) { bootprint = mLeftBootprint; } else { bootprint = mRightBootprint; } final GroundOverlay overlay = mMap.addGroundOverlay( new GroundOverlayOptions().position( latLng, BOOTPRINT_SIZE_METERS ).bearing( (float) (direction / Math.PI * 180d) ).image(bootprint) ); mBootprintLocations.add(overlay); removeAndUpdateBootprints(); } }
private void removeAndUpdateBootprints() { if (mBootprintLocations.size() >= MAX_BOOTPRINTS) { final GroundOverlay removedOverlay = mBootprintLocations.remove(0); removedOverlay.remove(); } for (int i = 0; i < mBootprintLocations.size(); i++) { GroundOverlay bootprint = mBootprintLocations.get(i); int footprintsLeft = MAX_BOOTPRINTS - mBootprintLocations.size(); float transparency = 1f - ((i + footprintsLeft) / (float) MAX_BOOTPRINTS); bootprint.setTransparency((2f * transparency / 3f) + .33f); } }
@Override public void call(final Subscriber<? super GroundOverlay> subscriber) { GoogleMap.OnGroundOverlayClickListener listener = new GoogleMap.OnGroundOverlayClickListener() { @Override public void onGroundOverlayClick(GroundOverlay groundOverlay) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(groundOverlay); } } }; map.setOnGroundOverlayClickListener(listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { map.setOnGroundOverlayClickListener(null); } })); }
/** * 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(mImagesCache.get(groundOverlayUrl)); for (KmlGroundOverlay kmlGroundOverlay : groundOverlays.keySet()) { if (kmlGroundOverlay.getImageUrl().equals(groundOverlayUrl)) { GroundOverlayOptions groundOverlayOptions = kmlGroundOverlay.getGroundOverlayOptions() .image(groundOverlayBitmap); GroundOverlay mapGroundOverlay = mMap.addGroundOverlay(groundOverlayOptions); if (containerVisibility == false) { mapGroundOverlay.setVisible(false); } groundOverlays.put(kmlGroundOverlay, mapGroundOverlay); } } }
public final GroundOverlay addGroundOverlay(GroundOverlayOptions paramGroundOverlayOptions) { try { com.google.android.gms.maps.model.internal.c localc = this.Br.addGroundOverlay(paramGroundOverlayOptions); if (localc != null) { GroundOverlay localGroundOverlay = new GroundOverlay(localc); return localGroundOverlay; } return null; } catch (RemoteException localRemoteException) { throw new RuntimeRemoteException(localRemoteException); } }
/** * 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); } } }
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); }
/** * Remove this tile layer * @param args * @param callbackContext * @throws JSONException */ protected void remove(JSONArray args, CallbackContext callbackContext) throws JSONException { String id = args.getString(1); GroundOverlay groundOverlay = (GroundOverlay)this.objects.get(id); if (groundOverlay == null) { this.sendNoResult(callbackContext); return; } String propertyId = "gOverlay_property_" + id; this.objects.remove(propertyId); groundOverlay.remove(); this.sendNoResult(callbackContext); }
/** * Set visibility for the object * @param args * @param callbackContext * @throws JSONException */ protected void setVisible(JSONArray args, CallbackContext callbackContext) throws JSONException { boolean visible = args.getBoolean(2); String id = args.getString(1); GroundOverlay groundOverlay = (GroundOverlay)this.objects.get(id); if (groundOverlay == null) { this.sendNoResult(callbackContext); return; } groundOverlay.setVisible(visible); this.sendNoResult(callbackContext); }
/** * Set image of the ground-overlay * @param args * @param callbackContext * @throws JSONException */ @SuppressWarnings("unused") private void setImage(final JSONArray args, final CallbackContext callbackContext) throws JSONException { String id = args.getString(1); GroundOverlay groundOverlay = (GroundOverlay)this.objects.get(id); String url = args.getString(2); String propertyId = "gOverlay_property_" + id; JSONObject opts = (JSONObject) this.objects.get(propertyId); opts.put("url", url); _createGroundOverlay(opts, callbackContext); }
/** * Set bounds * @param args * @param callbackContext * @throws JSONException */ @SuppressWarnings("unused") private void setBounds(final JSONArray args, final CallbackContext callbackContext) throws JSONException { String id = args.getString(1); GroundOverlay groundOverlay = (GroundOverlay)this.objects.get(id); JSONArray points = args.getJSONArray(2); LatLngBounds bounds = PluginUtil.JSONArray2LatLngBounds(points); groundOverlay.setPositionFromBounds(bounds); this.sendNoResult(callbackContext); }
@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); }
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; }
/** * Stores all given data and adds it onto the map * * @param styles hashmap of styles * @param styleMaps hashmap of style maps * @param placemarks hashmap of placemarks * @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> placemarks, ArrayList<KmlContainer> folders, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays) { mStyles = styles; mStyleMaps = styleMaps; mPlacemarks = placemarks; mContainers = folders; mGroundOverlays = groundOverlays; }
/** * 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()); } }
/** * 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 (mImagesCache.get(groundOverlayUrl) != null) { addGroundOverlayToMap(groundOverlayUrl, mGroundOverlays, true); } else if (!mGroundOverlayUrls.contains(groundOverlayUrl)) { mGroundOverlayUrls.add(groundOverlayUrl); } } } }
/** * Creates a new KmlParser object * * @param parser parser containing the KML file to parse */ /* package */ KmlParser(XmlPullParser parser) { mParser = parser; mPlacemarks = new HashMap<KmlPlacemark, Object>(); mContainers = new ArrayList<KmlContainer>(); mStyles = new HashMap<String, KmlStyle>(); mStyleMaps = new HashMap<String, String>(); mGroundOverlays = new HashMap<KmlGroundOverlay, GroundOverlay>(); }
public GetStopResponseListener bind(String stopId, Marker marker, GoogleMap map, SpiceManager spiceManager, List<GroundOverlay> busMarkers) { mStopId = stopId; mMarker = marker; mMap = map; mSpiceManager = spiceManager; mIconGenerator = new IconGenerator(mContext); mBusMarkers = busMarkers; return this; }
@Override public void onRequestSuccess(GetDeparturesResponse getDeparturesResponse) { for (GroundOverlay bus : mBusMarkers) { bus.remove(); } processResponse(getDeparturesResponse); }
@UiThread protected void addIcon(String text, LatLng position) { GroundOverlayOptions groundOverlay = new GroundOverlayOptions() .image(BitmapDescriptorFactory.fromBitmap(mIconGenerator.makeIcon(text))) .position(position, 80); final GroundOverlay marker = mMap.addGroundOverlay(groundOverlay); mBusMarkers.add(marker); }
public StopPointRenderer(@NotNull Context context, GoogleMap map, ClusterManager<Stop> clusterManager, SpiceManager spiceManager, List<GroundOverlay> busMarkers) { super(context, map, clusterManager); mSpiceManager = spiceManager; mContext = context; mBusMarkers = busMarkers; CUMtdApplication app = (CUMtdApplication) context.getApplicationContext(); if (app != null) t = app.getTracker(); }
/** * Stores all given data and adds it onto the map * * @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; mGroundOverlays = groundOverlays; }
/** * 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); } } } }
@Override public void onGroundOverlayClick(GroundOverlay groundOverlay) { Log.i(LOG_TAG, "onGroundOverlayClick ..."); }
@Override public final GroundOverlay addGroundOverlay(GroundOverlayOptions options) { return map.addGroundOverlay(options); }
private void onGroundOverlayClick(GroundOverlay groundOverlay, LatLng point) { String overlayId = "groundOverlay_" + groundOverlay.getId(); this.onOverlayEvent("overlay_click", overlayId, point); }