Search in sources :

Example 1 with BitmapDescriptor

use of com.google.android.gms.maps.model.BitmapDescriptor in project android-maps-utils by googlemaps.

the class DefaultClusterRenderer method onBeforeClusterRendered.

/**
     * Called before the marker for a Cluster is added to the map.
     * The default implementation draws a circle with a rough count of the number of items.
     */
protected void onBeforeClusterRendered(Cluster<T> cluster, MarkerOptions markerOptions) {
    int bucket = getBucket(cluster);
    BitmapDescriptor descriptor = mIcons.get(bucket);
    if (descriptor == null) {
        mColoredCircleBackground.getPaint().setColor(getColor(bucket));
        descriptor = BitmapDescriptorFactory.fromBitmap(mIconGenerator.makeIcon(getClusterText(bucket)));
        mIcons.put(bucket, descriptor);
    }
    // TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
    markerOptions.icon(descriptor);
}
Also used : BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) Point(com.google.maps.android.geometry.Point) SuppressLint(android.annotation.SuppressLint)

Example 2 with BitmapDescriptor

use of com.google.android.gms.maps.model.BitmapDescriptor in project android-maps-utils by googlemaps.

the class KmlRenderer method scaleBitmap.

/**
     * Enlarges or shrinks a bitmap image based on the scale provided
     * @param style     Style to retrieve iconUrl and scale from
     * @param placemarks
     * @param placemark Placemark object to set the image to
     */
private void scaleBitmap(KmlStyle style, HashMap<KmlPlacemark, Object> placemarks, KmlPlacemark placemark) {
    double bitmapScale = style.getIconScale();
    String bitmapUrl = style.getIconUrl();
    Bitmap bitmapImage = getImagesCache().get(bitmapUrl);
    BitmapDescriptor scaledBitmap = scaleIcon(bitmapImage, bitmapScale);
    ((Marker) placemarks.get(placemark)).setIcon(scaledBitmap);
}
Also used : Bitmap(android.graphics.Bitmap) BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) Marker(com.google.android.gms.maps.model.Marker)

Example 3 with BitmapDescriptor

use of com.google.android.gms.maps.model.BitmapDescriptor in project coins-android by bubelov.

the class StaticClusterRenderer method onBeforeClusterRendered.

/**
     * Called before the marker for a Cluster is added to the map.
     * The default implementation draws a circle with a rough count of the number of items.
     */
protected void onBeforeClusterRendered(Cluster<T> cluster, MarkerOptions markerOptions) {
    int bucket = getBucket(cluster);
    BitmapDescriptor descriptor = mIcons.get(bucket);
    if (descriptor == null) {
        mColoredCircleBackground.getPaint().setColor(getColor(bucket));
        descriptor = BitmapDescriptorFactory.fromBitmap(mIconGenerator.makeIcon(getClusterText(bucket)));
        mIcons.put(bucket, descriptor);
    }
    // TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
    markerOptions.icon(descriptor);
}
Also used : BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) Point(com.google.maps.android.geometry.Point) SuppressLint(android.annotation.SuppressLint)

Example 4 with BitmapDescriptor

use of com.google.android.gms.maps.model.BitmapDescriptor in project wigle-wifi-wardriving by wiglenet.

the class KmlRenderer method scaleBitmap.

/**
 * Enlarges or shrinks a bitmap image based on the scale provided
 * @param style     Style to retrieve iconUrl and scale from
 * @param placemark Placemark object to set the image to
 */
private void scaleBitmap(KmlStyle style, HashMap<KmlPlacemark, Object> placemarks, KmlPlacemark placemark) {
    double bitmapScale = style.getIconScale();
    String bitmapUrl = style.getIconUrl();
    Bitmap bitmapImage = mImagesCache.get(bitmapUrl);
    BitmapDescriptor scaledBitmap = scaleIcon(bitmapImage, bitmapScale);
    ((Marker) placemarks.get(placemark)).setIcon(scaledBitmap);
}
Also used : Bitmap(android.graphics.Bitmap) BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) Marker(com.google.android.gms.maps.model.Marker)

Example 5 with BitmapDescriptor

use of com.google.android.gms.maps.model.BitmapDescriptor in project wigle-wifi-wardriving by wiglenet.

the class KmlRenderer method addGroundOverlayToMap.

/**
 * 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);
        }
    }
}
Also used : GroundOverlayOptions(com.google.android.gms.maps.model.GroundOverlayOptions) BitmapDescriptor(com.google.android.gms.maps.model.BitmapDescriptor) GroundOverlay(com.google.android.gms.maps.model.GroundOverlay)

Aggregations

BitmapDescriptor (com.google.android.gms.maps.model.BitmapDescriptor)28 Bitmap (android.graphics.Bitmap)9 LatLng (com.google.android.gms.maps.model.LatLng)9 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)8 Marker (com.google.android.gms.maps.model.Marker)6 SuppressLint (android.annotation.SuppressLint)4 GroundOverlayOptions (com.google.android.gms.maps.model.GroundOverlayOptions)4 Point (com.google.maps.android.geometry.Point)4 RemoteImageLoader (com.omkarmoghe.pokemap.helpers.RemoteImageLoader)4 GeoJsonPointStyle (com.google.maps.android.geojson.GeoJsonPointStyle)3 FortDataOuterClass (POGOProtos.Map.Fort.FortDataOuterClass)2 GoogleMap (com.google.android.gms.maps.GoogleMap)2 GroundOverlay (com.google.android.gms.maps.model.GroundOverlay)2 IALatLng (com.indooratlas.android.sdk.resources.IALatLng)2 GymMarkerExtended (com.omkarmoghe.pokemap.models.map.GymMarkerExtended)2 PokemonMarkerExtended (com.omkarmoghe.pokemap.models.map.PokemonMarkerExtended)2 PokestopMarkerExtended (com.omkarmoghe.pokemap.models.map.PokestopMarkerExtended)2 Pokestop (com.pokegoapi.api.map.fort.Pokestop)2 CatchablePokemon (com.pokegoapi.api.map.pokemon.CatchablePokemon)2 PokemonIdOuterClass (POGOProtos.Enums.PokemonIdOuterClass)1