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


Java CameraPosition.Builder方法代码示例

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


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

示例1: updateCamera

import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
/**
 * Updates camera
 * @param shouldAnimate flag indicating if the camera should be animated or moved immediately
 * @param zoom zoom level
 */
private void updateCamera(boolean shouldAnimate, float zoom){

    if(MapLayout.location ==null)
        return;

    CameraPosition.Builder cameraPositionBuilder = new CameraPosition.Builder().target(MapLayout.location);

    cameraPositionBuilder.zoom(zoom);

    CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPositionBuilder.build());

    if(shouldAnimate)
        mGoogleMap.animateCamera(cameraUpdate);
    else
        mGoogleMap.moveCamera(cameraUpdate);
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:22,代码来源:MapLayout.java

示例2: onMapReady

import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
@Override
public void onMapReady(final GoogleMap googleMap) {
  this.googleMap = googleMap;
  CameraPosition.Builder cameraBuilder = new CameraPosition.Builder().zoom(13);
  LatLng myLatLng;

  setStopMarkers();

  if (locationMarker != null) {
    locationMarker.remove();
    locationMarker = null;
  }

  if (lastLocation != null) {
    myLatLng = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
    cameraBuilder.target(myLatLng);
    CameraPosition cameraPosition = cameraBuilder.build();
    googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    googleMap.setOnMarkerClickListener(new OnMarkerClickListener());

    MapUtils.moveMapToLocation(lastLocation, googleMap, new CameraPosition.Builder().zoom(13));
    setMyLocationMarker(lastLocation);
  }

  subscriptionRxBus = rxBus.observeEvents(RxMessage.class).subscribe(handleRxMessages());
}
 
开发者ID:eleith,项目名称:calchoochoo,代码行数:27,代码来源:MapSearchFragment.java

示例3: centerCamera

import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
public void centerCamera() {
    if (location != null) {
        CameraPosition.Builder builder = new CameraPosition.Builder();
        builder.zoom(16);
        builder.target(location);

        this.mMap.animateCamera(CameraUpdateFactory.newCameraPosition(builder.build()));
    }
}
 
开发者ID:guipenedo,项目名称:PokeRadar,代码行数:10,代码来源:MapsActivity.java

示例4: onMapReady

import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    final SharedPreferences settings = mAppPrefs.prefs;

    final CameraPosition.Builder camera = new CameraPosition.Builder();
    camera.bearing(settings.getFloat(PREF_BEA, DEFAULT_BEARING));
    camera.tilt(settings.getFloat(PREF_TILT, DEFAULT_TILT));
    camera.zoom(settings.getFloat(PREF_ZOOM, DEFAULT_ZOOM_LEVEL));
    camera.target(new LatLng(settings.getFloat(PREF_LAT, DEFAULT_LATITUDE),
            settings.getFloat(PREF_LNG, DEFAULT_LONGITUDE)));

    googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(camera.build()));
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:GoogleMapFragment.java

示例5: moveMapToLocation

import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
static public void moveMapToLocation(Location location, GoogleMap googleMap, CameraPosition.Builder cameraBuilder) {
  LatLng myLatLng = new LatLng(location.getLatitude(), location.getLongitude());
  cameraBuilder.target(myLatLng);
  CameraPosition cameraPosition = cameraBuilder.build();
  googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
 
开发者ID:eleith,项目名称:calchoochoo,代码行数:7,代码来源:MapUtils.java


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