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


Java CameraUpdateFactory类代码示例

本文整理汇总了Java中com.amap.api.maps.CameraUpdateFactory的典型用法代码示例。如果您正苦于以下问题:Java CameraUpdateFactory类的具体用法?Java CameraUpdateFactory怎么用?Java CameraUpdateFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onLocationChanged

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    if (mListener != null && aMapLocation != null) {
        if (aMapLocation != null && aMapLocation.getErrorCode() == 0) {
            mAMapLocation = aMapLocation;
            mlocationClient.stopLocation();
            mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点
            lp = new LatLonPoint(aMapLocation.getLatitude(), aMapLocation.getLongitude());
            mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lp.getLatitude(), lp.getLongitude()), 17));
            doSearchQuery(aMapLocation.getPoiName().trim(), aMapLocation.getCityCode(), false);
        } else {
            String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
            ToastUtils.showToast(this, errText);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:PoiAroundSearchActivity.java

示例2: initMap

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
/**
 * 地图实例化
 */
private void initMap() {
    if (amap == null) {
        amap = mMapView.getMap();
        amap.setLocationSource(this);//设置了定位的监听,这里要实现LocationSource接口
        amap.getUiSettings().setMyLocationButtonEnabled(true); // 是否显示定位按钮
        amap.setMyLocationEnabled(true);//显示定位层并且可以触发定位,默认是flase
        amap.moveCamera(CameraUpdateFactory.zoomTo(15));//设置地图缩放级别
        MyLocationStyle myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类
        myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE);//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。
        myLocationStyle.strokeColor(Color.TRANSPARENT);//设置定位蓝点精度圆圈的边框颜色
        myLocationStyle.radiusFillColor(Color.TRANSPARENT);//设置定位蓝点精度圆圈的填充颜色
        amap.setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style
        lvHolder = new ListViewHoldier();
        //天添加屏幕移动的监听
        amap.setOnCameraChangeListener(this);
        // 初始化Marker添加到地图
        mEndMarker = amap.addMarker(new MarkerOptions().icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.end))));
        //初始化 geocoderSearch
        geocoderSearch = new GeocodeSearch(this);
        //注册 逆地理编码异步处理回调接口
        geocoderSearch.setOnGeocodeSearchListener(this);

    }
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:28,代码来源:PiclocationActivity.java

示例3: initMap

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
/**
 * 初始化AMap对象
 */
private void initMap() {
    if (amap == null) {
        amap = mapview.getMap();
        //设置显示定位按钮 并且可以点击
        UiSettings settings = amap.getUiSettings();
        amap.setLocationSource(this);//设置了定位的监听,这里要实现LocationSource接口
        // 是否显示定位按钮
        settings.setMyLocationButtonEnabled(true);
        amap.setMyLocationEnabled(true);//显示定位层并且可以触发定位,默认是flase
        mAMapNavi = AMapNavi.getInstance(getApplicationContext());
        mAMapNavi.addAMapNaviListener(this);
        amap.moveCamera(CameraUpdateFactory.zoomTo(15));

    }
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:19,代码来源:NavigationActivity.java

示例4: onCreateView

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View sView = inflater.inflate(R.layout.fragment_map_simple, container, false);

    mMapView = (MapView) sView.findViewById(R.id.map_simple);
    mMapView.onCreate(savedInstanceState);

    AMap map = mMapView.getMap();
    map.setMapType(AMap.MAP_TYPE_NIGHT);
    map.getUiSettings().setZoomControlsEnabled(false);
    map.getUiSettings().setAllGesturesEnabled(false);

    LatLng loc = new LatLng(39.9793157, 116.3107618);
    CameraUpdate mCameraUpdate = CameraUpdateFactory.newCameraPosition(new CameraPosition(loc,14 ,0,0));
    map.animateCamera(mCameraUpdate, 1000, null);

    if(mCircleTask == null) {
        mCircleTask = new CircleTask(map, loc, 15, 20, 40);
    }

    return sView;
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:25,代码来源:MapFragmentSimple.java

示例5: initAmap

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
/**
 * 初始化地图显示样式
 * @param map
 */
private void initAmap(AMap map){
    this.mAmap = map;
    //照传入的CameraUpdate参数移动可视区域。
    map.animateCamera(CameraUpdateFactory.zoomTo(19));
    //设置定位源
    map.setLocationSource(mAmapStateListener);
    //显示室内地图
    map.showIndoorMap(true);
    //设置是否打开定位图层
    map.setMyLocationEnabled(true);
    MyLocationStyle style = new MyLocationStyle();
    //去除定位中心圆圈
    style.strokeWidth(0);
    style.radiusFillColor(Color.TRANSPARENT);
    //定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动
    style.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
    map.setMyLocationStyle(style);
    //去除缩放按钮
    UiSettings settings = map.getUiSettings();
    settings.setZoomControlsEnabled(false);
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:26,代码来源:AmapWrapper.java

示例6: prepareAnimation

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
private void prepareAnimation(final List<List<LatLng>> drawSource){
    mapInstance.clear();
    this.mDrawSource = drawSource;
    mSegmentIndex = 0;
    if(isFirstAnimation) {
        isFirstAnimation = false;
        TaskHanler.getInstance().sendTaskDelayed(new Runnable() {
            @Override
            public void run() {
                mapInstance.moveToSpecficCamera(CameraUpdateFactory.newCameraPosition(
                        new CameraPosition(drawSource.get(mSegmentIndex).get(0), 16, 0, 0)));
            }
        }, 1000);
    }
    else {
        mapInstance.moveToSpecficCamera(CameraUpdateFactory.newCameraPosition(
                new CameraPosition(drawSource.get(mSegmentIndex).get(0), 16, 0, 0)));
    }

    mapInstance.drawTrackAnimation(drawSource.get(mSegmentIndex), mSegmentIndex, new TrackLineMoveListener());
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:22,代码来源:ReviewPresenterImpl.java

示例7: onActivityResult

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode){
        case 1:
            if(resultCode == RESULT_OK){
                SearchResultItem item = data.getParcelableExtra("poiData");
                if(!item.getItemDetail().equals("NONE")){
                    //TODO zoom map and add mark
                    aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(item.getItemLatLng(), 17f));
                    aMap.addMarker(new MarkerOptions().position(item.getItemLatLng()));
                }
            }
            break;
        default:
            break;
    }
}
 
开发者ID:BoldFei,项目名称:Zmap_test,代码行数:18,代码来源:MainActivity.java

示例8: onLocationGet

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
/**
     * LocationTask中定位完成后调用了此方法
     */
    @Override
    public void onLocationGet(PositionEntity entity) {

        if (mIsFirst && location != null) {
                mStartPosition = new LatLng(location.getLatitude(), location.getLongitude());
//            addRoundFence();
            mIsFirst = false;

        }else {
            mStartPosition = new LatLng(entity.latitue, entity.longitude);
        }


        CameraUpdate cameraUpate = CameraUpdateFactory.newLatLngZoom(
                mStartPosition, mAmap.getCameraPosition().zoom);
        mAmap.animateCamera(cameraUpate); //动画的方式更新地图状态


        logUtil.e("onLocationGet-" + "定位完成"+"--mStartPosition="+mStartPosition.toString());
    }
 
开发者ID:larrySmile02,项目名称:MultipleViewMap,代码行数:24,代码来源:GdmapAdminActivity.java

示例9: onItemClick

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    LatLonPoint ll = list.get(position).getLatLonPoint();
    double a = ll.getLatitude();
    double b = ll.getLongitude();
    aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(a, b)));

}
 
开发者ID:jiangzehui,项目名称:xmpp,代码行数:9,代码来源:LocationActivity.java

示例10: drawFence

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
private void drawFence(GeoFence fence) {
	switch (fence.getType()) {
		case GeoFence.TYPE_ROUND :
		case GeoFence.TYPE_AMAPPOI :
			drawCircle(fence);
			break;
		case GeoFence.TYPE_POLYGON :
		case GeoFence.TYPE_DISTRICT :
			drawPolygon(fence);
			break;
		default :
			break;
	}

	// 设置所有maker显示在当前可视区域地图中
	LatLngBounds bounds = boundsBuilder.build();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:19,代码来源:GeoFence_District_Activity.java

示例11: drawFence

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
private void drawFence(GeoFence fence) {
	switch (fence.getType()) {
		case GeoFence.TYPE_ROUND :
		case GeoFence.TYPE_AMAPPOI :
			drawCircle(fence);
			break;
		case GeoFence.TYPE_POLYGON :
		case GeoFence.TYPE_DISTRICT :
			drawPolygon(fence);
			break;
		default :
			break;
	}

	// 设置所有maker显示在当前可视区域地图中
	LatLngBounds bounds = boundsBuilder.build();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));

	removeMarkers();
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:21,代码来源:GeoFence_Nearby_Activity.java

示例12: drawFence

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
private void drawFence(GeoFence fence) {
	switch (fence.getType()) {
		case GeoFence.TYPE_ROUND :
		case GeoFence.TYPE_AMAPPOI :
			drawCircle(fence);
			break;
		case GeoFence.TYPE_POLYGON :
		case GeoFence.TYPE_DISTRICT :
			drawPolygon(fence);
			break;
		default :
			break;
	}

	// 设置所有maker显示在当前可视区域地图中
	LatLngBounds bounds = boundsBuilder.build();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));
	polygonPoints.clear();
	removeMarkers();
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:21,代码来源:GeoFence_Polygon_Activity.java

示例13: setRegion

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
@ReactProp(name = "region")
public void setRegion(MapView mapView, @Nullable ReadableMap region) {
    if (region == null) return;
    AMap map = mapView.getMap();
    Double lat = region.getDouble("latitude");
    Double lng = region.getDouble("longitude");
    Double lngDelta = region.getDouble("longitudeDelta");
    Double latDelta = region.getDouble("latitudeDelta");
    LatLngBounds bounds = new LatLngBounds(
        new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
        new LatLng(lat + latDelta / 2, lng + lngDelta / 2)  // northeast
    );
    if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) {
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10));
        boundsToMove = bounds;
    } else {
        map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
    }
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:20,代码来源:AMapViewManager.java

示例14: updateExtraData

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void updateExtraData(MapView view, Object extraData) {
    // if boundsToMove is not null, we now have the MapView's width/height, so we can apply
    // a proper camera move
    if (boundsToMove != null) {
      HashMap<String, Float> data = (HashMap<String, Float>) extraData;
      float width = data.get("width");
      float height = data.get("height");
      view.getMap().moveCamera(
          CameraUpdateFactory.newLatLngBounds(
              boundsToMove,
              (int) width,
              (int) height,
              0
          )
      );
      boundsToMove = null;
    }
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:20,代码来源:AMapViewManager.java

示例15: onRegeocodeSearched

import com.amap.api.maps.CameraUpdateFactory; //导入依赖的package包/类
/**
	 * 逆地理编码回调
	 */
	@Override
	public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
//		dismissDialog();
		if (rCode == 0) {
			if (result != null && result.getRegeocodeAddress() != null
					&& result.getRegeocodeAddress().getFormatAddress() != null) {
				addressName = result.getRegeocodeAddress().getFormatAddress()
						+ "附近";
				aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
						AMapUtil.convertToLatLng(latLonPoint), 15));
				regeoMarker.setPosition(AMapUtil.convertToLatLng(latLonPoint));
				ToastUtil.show(GeocoderActivity.this, addressName);
			} else {
				ToastUtil.show(GeocoderActivity.this, R.string.no_result);
			}
		} else if (rCode == 27) {
			ToastUtil.show(GeocoderActivity.this, R.string.error_network);
		} else if (rCode == 32) {
			ToastUtil.show(GeocoderActivity.this, R.string.error_key);
		} else {
			ToastUtil.show(GeocoderActivity.this,
					getString(R.string.error_other) + rCode);
		}
	}
 
开发者ID:Tsroad,项目名称:Road,代码行数:28,代码来源:GeocoderActivity.java


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