本文整理汇总了Java中com.amap.api.maps2d.CameraUpdateFactory类的典型用法代码示例。如果您正苦于以下问题:Java CameraUpdateFactory类的具体用法?Java CameraUpdateFactory怎么用?Java CameraUpdateFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CameraUpdateFactory类属于com.amap.api.maps2d包,在下文中一共展示了CameraUpdateFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLocationChanged
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onLocationChanged(NimLocation location) {
if (location != null && location.hasCoordinates()) {
if (firstLocation) {
firstLocation = false;
myAddressInfo = location.getFullAddr();
double latitude = location.getLatitude();
double longitude = location.getLongitude();
myLatLng = new LatLng(latitude, longitude);
// 缩放到可见区
int boundPadding = getResources().getDimensionPixelSize(R.dimen.friend_map_bound_padding);
LatLngBounds bounds = LatLngBounds.builder().include(myLatLng).include(desLatLng).build();
CameraUpdate camera = CameraUpdateFactory.newLatLngBounds(bounds, boundPadding);
amap.moveCamera(camera);
updateMyMarkerLatLng();
updateSendStatus();
}
} else {
showLocationFailTip();
}
clearTimeoutHandler();
}
示例2: onLocationChanged
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (mListener != null && aMapLocation != null) {
if (aMapLocation != null
&& aMapLocation.getErrorCode() == 0) {
LatLng location = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
if (!mFirstFix) {
mFirstFix = true;
addCircle(location, aMapLocation.getAccuracy());//添加定位精度圆
addMarker(location);//添加定位图标
mSensorHelper.setCurrentMarker(mLocMarker);//定位图标旋转
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 18));
} else {
mCircle.setCenter(location);
mCircle.setRadius(aMapLocation.getAccuracy());
mLocMarker.setPosition(location);
mAMap.moveCamera(CameraUpdateFactory.changeLatLng(location));
}
} else {
String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
Log.e("AmapErr", errText);
}
}
}
示例3: initMap
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
private void initMap() {
if (aMap == null) {
aMap = mapView.getMap();
mUiSettings = aMap.getUiSettings();
}
// 自定义系统定位小蓝点
MyLocationStyle myLocationStyle = new MyLocationStyle();
myLocationStyle.myLocationIcon(BitmapDescriptorFactory
.fromResource(R.drawable.unchecked));// 设置小蓝点的图标
myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));// 设置圆形的边框颜色
myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));// 设置圆形的填充颜色
myLocationStyle.strokeWidth(0f);// 设置圆形的边框粗细
aMap.setMyLocationStyle(myLocationStyle);
aMap.setMyLocationRotateAngle(180);
aMap.setLocationSource(this);// 设置定位监听
mUiSettings.setMyLocationButtonEnabled(false); // 是否显示默认的定位按钮
aMap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
mUiSettings.setScaleControlsEnabled(true);// 设置地图默认的比例尺是否显示
mUiSettings.setZoomControlsEnabled(false);
aMap.moveCamera(CameraUpdateFactory.zoomTo(16));
initMapListener();
}
示例4: initMapLocationStyle
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void initMapLocationStyle() {
if (map == null) {
map = ((SupportMapFragment) (getActivity()
.getSupportFragmentManager()).findFragmentById(R.id.map))
.getMap();
mUiSettings = map.getUiSettings();
mUiSettings.setZoomControlsEnabled(false);
mUiSettings.setMyLocationButtonEnabled(true);
map.moveCamera(CameraUpdateFactory.zoomTo(16));
MyLocationStyle myLocationStyle = new MyLocationStyle();
myLocationStyle.myLocationIcon(BitmapDescriptorFactory
.fromResource(R.drawable.location_marker));
myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));// 设置圆形的边框颜色
myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));// 设置圆形的填充颜色
map.setMyLocationStyle(myLocationStyle);
map.setLocationSource(this);
map.setMyLocationEnabled(true);// 重点没这个方法位置图标显示不了
}
}
示例5: onLocationChanged
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
AbLogUtil.i(mContext, "onLocationChanged ");
if (mListener != null && aMapLocation != null) {
if (aMapLocation != null
&& aMapLocation.getErrorCode() == 0) {
aMap.moveCamera(CameraUpdateFactory.zoomTo(16));
mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点
String aoiname = aMapLocation.getAoiName();
double lat = aMapLocation.getLatitude();
double lon = aMapLocation.getLongitude();
String location = changeLocationStr(lon,lat);
showAround(location);
AbLogUtil.d(mContext,"location:"+location);
} else {
String errText = "定位失败," + aMapLocation.getErrorCode()+ ": " + aMapLocation.getErrorInfo();
Log.e("AmapErr", errText);
}
}
}
示例6: initMapView
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
private void initMapView() {
if (aMap == null) {
aMap = mapView.getMap();
aMap.setOnMapClickListener(this);// add the listener for click for amap object
}
LatLng shenzhen = new LatLng(22.5362, 113.9454);
aMap.addMarker(new MarkerOptions().position(shenzhen).title("Marker in Shenzhen"));
aMap.moveCamera(CameraUpdateFactory.newLatLng(shenzhen));
}
示例7: cameraUpdate
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
private void cameraUpdate(){
LatLng pos = new LatLng(droneLocationLat, droneLocationLng);
float zoomlevel = (float) 18.0;
CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(pos, zoomlevel);
aMap.moveCamera(cu);
}
示例8: locationAddressInfo
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
private void locationAddressInfo(double lat, double lng, String address) {
LatLng latlng = new LatLng(lat, lng);
CameraUpdate camera = CameraUpdateFactory.newCameraPosition(new CameraPosition(latlng, amap.getCameraPosition().zoom, 0, 0));
amap.moveCamera(camera);
addressInfo = address;
latitude = lat;
longitude = lng;
setPinInfoPanel(true);
}
示例9: initMap
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
public void initMap(){
if (aMap == null) {
aMap = mapView.getMap();
aMap.setOnMarkerClickListener(this);
addMarkersToMap();
changeCamera(
CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(32.012354, 119.106243), 10, 30, 30)));
}
}
示例10: setLocation
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
private void setLocation(double latitude,double longitude){
if(aMap == null){
return;
}
aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(
latitude, longitude)));
MarkerOptions markerOption = new MarkerOptions();
markerOption.position(new LatLng(latitude,
longitude));
markerOption.draggable(true);
Marker marker = aMap.addMarker(markerOption);
marker.setObject("11");//这里可以存储用户数据
}
示例11: zoomToSpan
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
/**
* 移动镜头到当前的视角。
*
* @since V2.1.0
*/
public void zoomToSpan() {
if (mPois != null && mPois.size() > 0) {
if (mamap == null)
return;
LatLngBounds bounds = getLatLngBounds();
mamap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
}
}
示例12: init
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
private void init(){
if(mAMap == null){
mAMap=mMapView.getMap();
}
latLngNow=new LatLng(31.25,121.45);
CameraUpdate cu=CameraUpdateFactory.changeLatLng(latLngNow);
mAMap.moveCamera(cu);
requestWeather(latLngNow);
mAMap.setOnMapClickListener(this);
city_btn.setOnClickListener(this);
}
示例13: onLocationChanged
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onLocationChanged(AMapLocation location) {
// this.location = location;
if (mListener != null && location != null) {
mListener.onLocationChanged(location);
}
if (!locationChange) {
if (location != null) {
LatLng latlng = new LatLng(location.getLatitude(),
location.getLongitude());
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latlng).zoom(18).build();
map.animateCamera(CameraUpdateFactory
.newCameraPosition(cameraPosition));
if (latlng != null) {
String keyWord = location.getCity();
PoiSearch.Query query = new PoiSearch.Query(
keyWord,
"汽车服务|汽车销售|汽车维修|摩托车服务|餐饮服务|购物服务|生活服务|体育休闲服务|医疗保健服务|风景名胜|商务住宅|政府机构及社会团体|科教文化服务|交通设施服务|金融保险服务|公司企业|道路附属设施|地名地址信息|公共设施",
"");// (第三个参数)这里可以传空字符串,空字符串代表全国在全国范围内进行搜索
query.setPageNum(1);
query.setPageSize(40);
PoiSearch poiSearch = new PoiSearch(getActivity(), query);
poiSearch.setBound(new SearchBound(new LatLonPoint(
latlng.latitude, latlng.longitude), 3000));
poiSearch.setOnPoiSearchListener(this);
poiSearch.searchPOIAsyn();
}
locationChange = true;
}
}
}
示例14: lookAt
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
public void lookAt(double latitude, double longitude, String title, String snippet) {
LatLng latLng = new LatLng(latitude, longitude);
AMap map = this.getMap();
map.clear();
MarkerOptions markerOptions = new MarkerOptions().position(latLng).title(title).snippet(snippet)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
Marker marker = map.addMarker(markerOptions);
if (title != null) {
marker.showInfoWindow();
}
map.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(latLng, 15, 0, 0)));
}
示例15: onMapLoaded
import com.amap.api.maps2d.CameraUpdateFactory; //导入依赖的package包/类
@Override
public void onMapLoaded() {
// 设置所有maker显示在当前可视区域地图中
LatLngBounds bounds = new LatLngBounds.Builder().include(new LatLng(34.341568, 108.940174)).build();
aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 10));
}