类com.google.android.gms.maps.model.GroundOverlay源码实例Demo

下面列出了怎么用com.google.android.gms.maps.model.GroundOverlay的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: android-maps-utils   文件: Renderer.java
/**
 * 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);
        }
    }
}
 
源代码2 项目: android-maps-utils   文件: KmlRenderer.java
/**
 * 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);
        }
    }
}
 
源代码3 项目: Nibo   文件: BaseNiboFragment.java
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);
}
 
源代码4 项目: RxGoogleMaps   文件: GroundOverlayClickFuncTest.java
@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);
}
 
源代码5 项目: android-maps-utils   文件: Renderer.java
/**
 * 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);
        }
    }
}
 
源代码6 项目: android-maps-utils   文件: Renderer.java
/**
 * 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;
}
 
源代码7 项目: android-maps-utils   文件: KmlContainer.java
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;
}
 
源代码8 项目: android-maps-utils   文件: KmlRenderer.java
/**
 * 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());
    }
}
 
源代码9 项目: android-maps-utils   文件: KmlRenderer.java
/**
 * 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());
    }
}
 
源代码10 项目: android-maps-utils   文件: KmlRenderer.java
/**
 * 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);
            }
        }
    }
}
 
源代码11 项目: android-maps-utils   文件: GroundOverlayManager.java
@Override
public void onGroundOverlayClick(GroundOverlay groundOverlay) {
    Collection collection = mAllObjects.get(groundOverlay);
    if (collection != null && collection.mGroundOverlayClickListener != null) {
        collection.mGroundOverlayClickListener.onGroundOverlayClick(groundOverlay);
    }
}
 
@Override
public void onGroundOverlayClick(GroundOverlay groundOverlay)
{
	onClick((CustomTag) groundOverlay.getTag());
}
 
源代码13 项目: android-samples   文件: TagsDemoActivity.java
@Override
public void onGroundOverlayClick(GroundOverlay groundOverlay) {
    onClick((CustomTag) groundOverlay.getTag());
}
 
/**
 * 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());
}
 
源代码15 项目: android-maps-utils   文件: KmlContainerParser.java
/**
 * 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);
}
 
源代码16 项目: android-maps-utils   文件: KmlParser.java
/**
 * @return A list of Ground Overlays
 */
/* package */ HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlays() {
    return mGroundOverlays;
}
 
源代码17 项目: android-maps-utils   文件: GroundOverlayManager.java
@Override
protected void removeObjectFromMap(GroundOverlay object) {
    object.remove();
}
 
源代码18 项目: android-maps-utils   文件: GroundOverlayManager.java
public GroundOverlay addGroundOverlay(GroundOverlayOptions opts) {
    GroundOverlay groundOverlay = mMap.addGroundOverlay(opts);
    super.add(groundOverlay);
    return groundOverlay;
}
 
源代码19 项目: android-maps-utils   文件: GroundOverlayManager.java
public void showAll() {
    for (GroundOverlay groundOverlay : getGroundOverlays()) {
        groundOverlay.setVisible(true);
    }
}
 
源代码20 项目: android-maps-utils   文件: GroundOverlayManager.java
public void hideAll() {
    for (GroundOverlay groundOverlay : getGroundOverlays()) {
        groundOverlay.setVisible(false);
    }
}
 
源代码21 项目: android-maps-utils   文件: GroundOverlayManager.java
public boolean remove(GroundOverlay groundOverlay) {
    return super.remove(groundOverlay);
}
 
源代码22 项目: android-maps-utils   文件: GroundOverlayManager.java
public java.util.Collection<GroundOverlay> getGroundOverlays() {
    return getObjects();
}
 
源代码23 项目: android-maps-utils   文件: KmlRenderer.java
/**
 * 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);
}
 
源代码24 项目: android-maps-utils   文件: Renderer.java
/**
 * Gets the ground overlays on the current layer
 *
 * @return mGroundOverlayMap hashmap contains the ground overlays
 */
public HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlayMap() {
    return mGroundOverlayMap;
}
 
源代码25 项目: android-maps-utils   文件: Renderer.java
/**
 * 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);
}
 
源代码26 项目: android-maps-utils   文件: KmlContainer.java
/**
 * 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;
}
 
 类方法
 同包方法