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

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

源代码1 项目: 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);
        }
    }
}
 
private void addGroundOverlays()
{
	googleMap.clear();
	GroundOverlayOptions groundOverlayOptions = new GroundOverlayOptions();
	groundOverlayOptions.image(BitmapDescriptorFactory.fromResource(R.drawable.city)).anchor(0, 1);
	groundOverlayOptions.position(new LatLng(40, -74), 8600f, 6500f);
	groundOverlayOptions.bearing(0);
	groundOverlayOptions.clickable(true);

	googleMap.addGroundOverlay(groundOverlayOptions).setTag(new CustomTag("ground overlay"));
	googleMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(40, -74)));
}
 
源代码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 项目: richmaps   文件: RichLayer.java
public void refresh() {
    CameraPosition cameraPosition = map.getCameraPosition();
    if (cameraPosition.zoom >= MINIMUM_ZOOM_LEVEL) {
        Projection projection = map.getProjection();

        prepareBitmap();
        draw(bitmap, projection);

        float mapWidth = (float) SphericalUtil.computeDistanceBetween(
                projection.getVisibleRegion().nearLeft,
                projection.getVisibleRegion().nearRight);

        if (overlay == null) {
            GroundOverlayOptions background = new GroundOverlayOptions()
                    .image(BitmapDescriptorFactory.fromBitmap(bitmap))
                    .position(cameraPosition.target, mapWidth)
                    .bearing(cameraPosition.bearing)
                    .zIndex(zIndex);
            overlay = map.addGroundOverlay(background);
        } else {
            overlay.setImage(BitmapDescriptorFactory.fromBitmap(bitmap));
            overlay.setPosition(cameraPosition.target);
            overlay.setDimensions(mapWidth);
            overlay.setBearing(cameraPosition.bearing);
        }
    } else {
        if (overlay != null) {
            overlay.remove();
            overlay = null;
        }
    }
}
 
源代码5 项目: Android-GoogleMaps-Part1   文件: MapFragment.java
private void drawOverlay( LatLng location, int width, int height ) {
    GroundOverlayOptions options = new GroundOverlayOptions();
    options.position(location, width, height);

    options.image( BitmapDescriptorFactory
            .fromBitmap( BitmapFactory
                .decodeResource( getResources(), R.mipmap.ic_launcher ) ) );
    getMap().addGroundOverlay(options);
}
 
@Override
public void onMapReady(GoogleMap map) {
    // Register a listener to respond to clicks on GroundOverlays.
    map.setOnGroundOverlayClickListener(this);

    map.moveCamera(CameraUpdateFactory.newLatLngZoom(NEWARK, 11));

    images.clear();
    images.add(BitmapDescriptorFactory.fromResource(R.drawable.newark_nj_1922));
    images.add(BitmapDescriptorFactory.fromResource(R.drawable.newark_prudential_sunny));

    // Add a small, rotated overlay that is clickable by default
    // (set by the initial state of the checkbox.)
    groundOverlayRotated = map.addGroundOverlay(new GroundOverlayOptions()
            .image(images.get(1)).anchor(0, 1)
            .position(NEAR_NEWARK, 4300f, 3025f)
            .bearing(30)
            .clickable(((CheckBox) findViewById(R.id.toggleClickability)).isChecked()));

    // Add a large overlay at Newark on top of the smaller overlay.
    groundOverlay = map.addGroundOverlay(new GroundOverlayOptions()
            .image(images.get(currentEntry)).anchor(0, 1)
            .position(NEWARK, 8600f, 6500f));

    transparencyBar.setOnSeekBarChangeListener(this);

    // Override the default content description on the view, for accessibility mode.
    // Ideally this string would be localised.
    map.setContentDescription("Google Map with ground overlay.");
}
 
源代码7 项目: AndroidDemoProjects   文件: MapFragment.java
private void drawOverlay( LatLng location, int width, int height ) {
    GroundOverlayOptions options = new GroundOverlayOptions();
    options.position(location, width, height);

    options.image( BitmapDescriptorFactory
            .fromBitmap( BitmapFactory
                .decodeResource( getResources(), R.mipmap.ic_launcher ) ) );
    getMap().addGroundOverlay(options);
}
 
源代码8 项目: android-maps-utils   文件: KmlGroundOverlay.java
/**
 * Creates a new Ground Overlay
 *
 * @param imageUrl   url of the ground overlay image
 * @param latLonBox  bounds of the image
 * @param drawOrder  z index of the image
 * @param visibility true if visible, false otherwise
 * @param properties properties hashmap
 * @param rotation   rotation of image
 */
/* package */ KmlGroundOverlay(String imageUrl, LatLngBounds latLonBox, float drawOrder,
                               int visibility, HashMap<String, String> properties, float rotation) {
    mGroundOverlayOptions = new GroundOverlayOptions();
    mImageUrl = imageUrl;
    mProperties = properties;
    if (latLonBox == null) {
        throw new IllegalArgumentException("No LatLonBox given");
    }
    mLatLngBox = latLonBox;
    mGroundOverlayOptions.positionFromBounds(latLonBox);
    mGroundOverlayOptions.bearing(rotation);
    mGroundOverlayOptions.zIndex(drawOrder);
    mGroundOverlayOptions.visible(visibility != 0);
}
 
源代码9 项目: android-samples   文件: TagsDemoActivity.java
private void addObjectsToMap() {
    // A circle centered on Adelaide.
    mAdelaideCircle = mMap.addCircle(new CircleOptions()
            .center(ADELAIDE)
            .radius(500000)
            .fillColor(Color.argb(150, 66, 173, 244))
            .strokeColor(Color.rgb(66, 173, 244))
            .clickable(true));
    mAdelaideCircle.setTag(new CustomTag("Adelaide circle"));

    // A ground overlay at Sydney.
    mSydneyGroundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions()
            .image(BitmapDescriptorFactory.fromResource(R.drawable.harbour_bridge))
            .position(SYDNEY, 700000)
            .clickable(true));
    mSydneyGroundOverlay.setTag(new CustomTag("Sydney ground overlay"));

    // A marker at Hobart.
    mHobartMarker = mMap.addMarker(new MarkerOptions().position(HOBART));
    mHobartMarker.setTag(new CustomTag("Hobart marker"));

    // A polygon centered at Darwin.
    mDarwinPolygon = mMap.addPolygon(new PolygonOptions()
            .add(
                    new LatLng(DARWIN.latitude + 3, DARWIN.longitude - 3),
                    new LatLng(DARWIN.latitude + 3, DARWIN.longitude + 3),
                    new LatLng(DARWIN.latitude - 3, DARWIN.longitude + 3),
                    new LatLng(DARWIN.latitude - 3, DARWIN.longitude - 3))
            .fillColor(Color.argb(150, 34, 173, 24))
            .strokeColor(Color.rgb(34, 173, 24))
            .clickable(true));
    mDarwinPolygon.setTag(new CustomTag("Darwin polygon"));

    // A polyline from Perth to Brisbane.
    mPolyline = mMap.addPolyline(new PolylineOptions()
            .add(PERTH, BRISBANE)
            .color(Color.rgb(103, 24, 173))
            .width(30)
            .clickable(true));
    mPolyline.setTag(new CustomTag("Perth to Brisbane polyline"));
}
 
@Override
public IGroundOverlayDelegate addGroundOverlay(GroundOverlayOptions options)
        throws RemoteException {
    Log.d(TAG, "not yet usable: addGroundOverlay");
    return new GroundOverlayImpl(options); // TODO
}
 
源代码11 项目: android-maps-utils   文件: GroundOverlayManager.java
public GroundOverlay addGroundOverlay(GroundOverlayOptions opts) {
    GroundOverlay groundOverlay = mMap.addGroundOverlay(opts);
    super.add(groundOverlay);
    return groundOverlay;
}
 
源代码12 项目: android-maps-utils   文件: GroundOverlayManager.java
public void addAll(java.util.Collection<GroundOverlayOptions> opts) {
    for (GroundOverlayOptions opt : opts) {
        addGroundOverlay(opt);
    }
}
 
源代码13 项目: android-maps-utils   文件: GroundOverlayManager.java
public void addAll(java.util.Collection<GroundOverlayOptions> opts, boolean defaultVisible) {
    for (GroundOverlayOptions opt : opts) {
        addGroundOverlay(opt).setVisible(defaultVisible);
    }
}
 
public GroundOverlayImpl(GroundOverlayOptions options) {
    
}
 
源代码15 项目: 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);
}
 
源代码16 项目: android-maps-utils   文件: KmlGroundOverlay.java
/**
 * Gets the ground overlay option of the ground overlay on the map
 *
 * @return GroundOverlayOptions
 */
/* package */ GroundOverlayOptions getGroundOverlayOptions() {
    return mGroundOverlayOptions;
}
 
 类方法
 同包方法