当前位置: 首页>>代码示例>>Java>>正文


Java GoogleMap.animateCamera方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.animateCamera方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleMap.animateCamera方法的具体用法?Java GoogleMap.animateCamera怎么用?Java GoogleMap.animateCamera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.animateCamera方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: zoomToPolyline

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public static void zoomToPolyline(GoogleMap map, Polyline p) {
    if (p == null || p.getPoints().isEmpty())
        return;

    LatLngBounds.Builder builder = LatLngBounds.builder();

    for (LatLng latLng : p.getPoints()) {
        builder.include(latLng);
    }
    final LatLngBounds bounds = builder.build();

    try{
    map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));
    } catch (Exception e){
        e.printStackTrace();
    }
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:18,代码来源:MapUtils.java

示例2: fitMap

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public void fitMap(GoogleMap map, List<LatLng> locations, boolean animate, int padding) {
    if (map == null) {
        return;
    }
    LatLngBounds bounds = getLatLngBounds(locations);
    if (bounds == null ) {
        return;
    }
    CameraUpdate cUpdate = null;
    try {
        cUpdate = CameraUpdateFactory.newLatLngBounds(bounds, padding);
        if (animate) {
            map.animateCamera(cUpdate);
        } else {
            map.moveCamera(cUpdate);
        }
    } catch (Exception e) {
        Log.e(TAG, e != null && e.getMessage() != null ? e.getMessage() : "");
    }
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:21,代码来源:MeasurementsGoogleMapHelper.java

示例3: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.setMyLocationEnabled(true);
    googleMap.getUiSettings().setMyLocationButtonEnabled(true);
    googleMap.getUiSettings().setMapToolbarEnabled(false);
    LatLng latLng = mPointOfInterest.latLng;
    if (latLng != null) {
        googleMap.addMarker(new MarkerOptions().position(latLng)
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
        googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 16f));
    }
}
 
开发者ID:sathishmscict,项目名称:Pickr,代码行数:13,代码来源:DetailActivity.java

示例4: cameraCorrection

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private static void cameraCorrection(final Context ctx, final GoogleMap gmap, final LatLng start, final LatLng end, final VMargin padding) {
	GoogleMap.CancelableCallback cameraOnFinish=new GoogleMap.CancelableCallback(){
		@Override
		public void onFinish() {
			cameraCorrection(ctx, gmap, start, end, padding);
		}

		@Override
		public void onCancel() {
			// TODO: Implement this method
		}
	};
	Point addr_startPoint=gmap.getProjection().toScreenLocation(start);
	Point addr_endPoint = gmap.getProjection().toScreenLocation(end);
	DisplayMetrics dm=ctx.getResources().getDisplayMetrics();
	int maxX=dm.widthPixels;
	if (addr_startPoint.y < padding.searchbar_margin || addr_endPoint.y < padding.searchbar_margin) {
		gmap.animateCamera(CameraUpdateFactory.zoomBy(-1f), 1000, cameraOnFinish);
		android.util.Log.d("jos", "Batas atas");
	} else if (addr_startPoint.x < dp2px(ctx, 10) || addr_endPoint.x < dp2px(ctx, 10) || addr_startPoint.x > maxX - dp2px(ctx, 10) || addr_endPoint.x > maxX - dp2px(ctx, 10)) {
		gmap.animateCamera(CameraUpdateFactory.zoomBy(-0.2f), 1000, cameraOnFinish);
		android.util.Log.d("jos", "Batas samping");
	} else if (addr_startPoint.y > (dm.heightPixels - padding.tariffview_margin) || addr_endPoint.y > (dm.heightPixels - padding.tariffview_margin)) {
		gmap.animateCamera(CameraUpdateFactory.zoomBy(-0.2f), 1000, cameraOnFinish);
		android.util.Log.d("jos", "Batas bawah");
	}else{
		if(camcallback!=null) camcallback.onComplete();
	}
	android.util.Log.d("jos", "batas: " + (dm.heightPixels - padding.tariffview_margin));
	android.util.Log.d("jos", "marker: " + addr_endPoint.y);
	android.util.Log.d("jos", "70dp: " + dp2px(ctx, 70));
}
 
开发者ID:agusibrahim,项目名称:go-jay,代码行数:33,代码来源:Utils.java

示例5: requestCenterCamera

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public static void requestCenterCamera(final Context ctx, final GoogleMap gmap, final LatLng start, final LatLng end, final VMargin padding, OnCameraComplete x) {
	final LatLngBounds.Builder builder = new LatLngBounds.Builder();
	builder.include(start).include(end);
	camcallback=x;
	gmap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0), 1000, new GoogleMap.CancelableCallback(){
			@Override
			public void onFinish() {
				cameraCorrection(ctx, gmap, start, end, padding);
			}
			@Override
			public void onCancel() {
				// TODO: Implement this method
			}
		});
}
 
开发者ID:agusibrahim,项目名称:go-jay,代码行数:16,代码来源:Utils.java

示例6: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(new LatLng(eve.getPlace().getLat(),eve.getPlace().getLon()))
            .zoom(17)
            .bearing(0)
            .tilt(80)
            .build();
    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    googleMap.addMarker(new MarkerOptions().position(new LatLng(eve.getPlace().getLat(),eve.getPlace().getLon())));
}
 
开发者ID:picopalette,项目名称:event-me,代码行数:12,代码来源:EventDisplayActivity.java

示例7: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;

    //crt list
    crt[0] = new crtLocation(36.796043,10.176679 ,"Rue de Angleterre, Tunis");
    crt[1] = new crtLocation(36.811240,10.168087 ,"DNSP, Rue du Fort, Tunis");
    crt[2] = new crtLocation(36.768390,10.231351 ,"Centre National de Formation des volontaires");
    crt[3] = new crtLocation(36.765738,10.249805 ,"Comité Local megrine");
    crt[4] = new crtLocation(36.857147,10.188060 ,"Croissant Rouge Tunisien");
    crt[5] = new crtLocation(35.857905,10.598179 ,"comité local Hammam Sousse");
    crt[6] = new crtLocation(34.731843,10.759640,"Rue El Arbi Zarrouk, Sfax");
    crt[7] = new crtLocation(33.504106,11.088150 ,"Mouensa, Zarzis ");
    crt[8] = new crtLocation(36.441899,10.729911 ," Comité Regional De Nabeul");
    crt[9] = new crtLocation( 35.829321,10.638072 ,"Comité Local de Sousse");
    crt[10] = new crtLocation(33.137021,11.220034 ,"Comité Local Benguerdane");
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (int i = 0;i<11;i++) {
         marker = map.addMarker(new MarkerOptions()
                .position(new LatLng(crt[i].getX(), crt[i].getY()))
                .title("Croissant Rouge Tunisien")
                .snippet(crt[i].getAdresse()));
        builder.include(marker.getPosition());
    }

    


    LatLngBounds bounds = builder.build();
    int padding = 0; // offset from edges of the map in pixels
    CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
    googleMap.animateCamera(cu);
}
 
开发者ID:RRDL,项目名称:CRT,代码行数:34,代码来源:Notification.java

示例8: recapDisplayTrack

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
/**
 * Display the given Track on the given GoogleMap. The argument color indicates the desired color for
 * the Track to be shown. Also takes care to center the camera on the displayed Track. Used for recaps
 *
 * @param track  Track to be shown
 * @param googleMap map where the Track must be shown
 * @param color color for the Track to be shown
 */
public static void recapDisplayTrack(Track track, GoogleMap googleMap, int color) {
    if(track == null || googleMap == null) {
        throw new IllegalArgumentException();
    }

    if (track.getTotalCheckPoints() != 0) {
        // Build polyline and latitude, longitude bounds
        PolylineOptions polylineOptions = new PolylineOptions();
        List<CheckPoint> trackPoints = track.getCheckpoints();
        LatLngBounds.Builder builder = new LatLngBounds.Builder();

        for (CheckPoint checkPoint : trackPoints) {
            LatLng latLng = new LatLng(checkPoint.getLatitude(), checkPoint.getLongitude());
            polylineOptions.add(latLng);
            builder.include(latLng);
        }

        googleMap.addPolyline(polylineOptions.color(color));

        // Center camera on past run
        LatLngBounds bounds = builder.build();
        int padding = 40;
        CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, padding);
        googleMap.animateCamera(cameraUpdate);
    }
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:35,代码来源:UtilsUI.java

示例9: onClick

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onClick(View v)
{
    final FragmentManager fm = ((FragmentActivity) getActivity()).getSupportFragmentManager();
    final FragmentTransaction ft;
    
    final GoogleMap map = gMap;

    switch (v.getId())
    {

    case R.id.mapChooseButton:

        ft = fm.beginTransaction();
        final RMBTMapFilterFragment mapFilterFragment = new RMBTMapFilterFragment();
        ft.replace(R.id.fragment_content, mapFilterFragment, "map_filter");
        ft.addToBackStack("map_filter");
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        ft.commit();
        
        break;

    case R.id.mapLocateButton:

        if (map != null && geoLocation != null)
        {
            final Location location = geoLocation.getLastKnownLocation();
            if (location != null)
            {
                final LatLng latlng = new LatLng(location.getLatitude(), location.getLongitude());
                gMap.animateCamera(CameraUpdateFactory.newLatLng(latlng));
            }
        }
        break;

    case R.id.mapHelpButton:
        ((RMBTMainActivity) getActivity()).showUrl("", false, AppConstants.PAGE_TITLE_HELP); // TODO: put correct
                                                    // help url
        break;

    case R.id.mapZoomInButton:

        if (map != null)
            map.animateCamera(CameraUpdateFactory.zoomIn());

        break;

    case R.id.mapZoomOutButton:

        if (map != null)
            map.animateCamera(CameraUpdateFactory.zoomOut());

        break;

    case R.id.mapLocationSearchButton:
    	
    	if (map != null) {
    		MapLocationSearch.showDialog(this);
    	}
    	
    	break;
        
    default:
        break;
    }

}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:68,代码来源:RMBTMapFragment.java

示例10: zoomToMarker

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public static void zoomToMarker(GoogleMap map, CustomMarker m) {
    final LatLngBounds bounds = new LatLngBounds(m.getPosition(), m.getPosition());

    map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 400));
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:6,代码来源:MapUtils.java


注:本文中的com.google.android.gms.maps.GoogleMap.animateCamera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。