本文整理汇总了Java中com.amap.api.maps2d.model.CameraPosition类的典型用法代码示例。如果您正苦于以下问题:Java CameraPosition类的具体用法?Java CameraPosition怎么用?Java CameraPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraPosition类属于com.amap.api.maps2d.model包,在下文中一共展示了CameraPosition类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: locationAddressInfo
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的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);
}
示例2: onCameraChangeFinish
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
if (!locating) {
queryLatLngAddress(cameraPosition.target);
} else {
latitude = cameraPosition.target.latitude;
longitude = cameraPosition.target.longitude;
}
updateMyLocationStatus(cameraPosition);
}
示例3: updateMyLocationStatus
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
private void updateMyLocationStatus(CameraPosition cameraPosition) {
if(Math.abs(-1 - cacheLatitude) < 0.1f) {
// 定位失败
return;
}
LatLng source = new LatLng(cacheLatitude, cacheLongitude);
LatLng target = cameraPosition.target;
float distance = AMapUtils.calculateLineDistance(source, target);
boolean showMyLocation = distance > 50;
btnMyLocation.setVisibility(showMyLocation ? View.VISIBLE:View.GONE);
updateSendStatus();
}
示例4: initMap
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的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)));
}
}
示例5: onLocationChanged
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的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;
}
}
}
示例6: onCameraChangeFinish
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
LatLng latLng = cameraPosition.target;
double lat = latLng.latitude;
double lon = latLng.longitude;
String locationStr = changeLocationStr(lon,lat);
AbLogUtil.d(mContext, "移动后的坐标:" + locationStr);
Intent locationChange = new Intent();
locationChange.setAction(Global.EShow_Broadcast_Action.ACTION_LOCATION_CHANGED);
locationChange.putExtra(AroundPlaceFragment.INTENT_CURRENT_LOCATION,locationStr);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(locationChange);
}
示例7: lookAt
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的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)));
}
示例8: onLocationChanged
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
@Override
public void onLocationChanged(AMapLocation aLocation) {
if (mListener != null && aLocation != null) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
//获取位置信息
geoLat = aLocation.getLatitude();
geoLon = aLocation.getLongitude();
LocationInfo.setLat(geoLat);
LocationInfo.setLon(geoLon);
LocationInfo.setCityName(aLocation.getCity());
LocationInfo.setCityCode(aLocation.getCityCode());
LocationInfo.setAddress(aLocation.getAddress());
if (geoLon == null || geoLat == null) return;
//添加用户覆盖物
userCurrentLatLng = new LatLng(geoLat, geoLon);
if (myMark != null) {
myMark.destroy();
}
//设置圆形范围,颜色等参数
aMap.addCircle(new CircleOptions().center(userCurrentLatLng).radius(1000).strokeColor(Color.GREEN).strokeWidth(1.0f));
//设置缩放级别
aMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(userCurrentLatLng, 18, 0, 30)));
if (isFirstGetPost && (LocationInfo.getLat() != 0.0 || LocationInfo.getLon() != 0.0)) {
getPost();
isFirstGetPost = false;
}
}
}
示例9: onCameraChangeFinish
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
/**
* 当地图的可视区域改变结束时
*
* @param cameraPosition
*/
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
shouldGetMorePost = true;
//latLonPoint参数表示一个Latlng,第二参数表示范围多少米,GeocodeSearch.AMAP表示是国测局坐标系还是GPS原生坐标系
currentCameraLatLng = new LatLonPoint(cameraPosition.target.latitude,
cameraPosition.target.longitude);
//为了不频繁的请求数据,限定移动地图视野停止3秒后再获取数据
handler.sendEmptyMessageDelayed(message.what = GET_MAP_CAMERA_LOCATION_INFO, 3000);
}
示例10: onCameraChange
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
@Override
public void onCameraChange(CameraPosition arg0) {}
示例11: onCameraChange
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
@Override
public void onCameraChange(CameraPosition cameraPosition) {
}
示例12: onCameraChange
import com.amap.api.maps2d.model.CameraPosition; //导入依赖的package包/类
/**
* 当地图的可视区域改变时
*
* @param cameraPosition
*/
@Override
public void onCameraChange(CameraPosition cameraPosition) {
shouldGetMorePost = false;
}