本文整理汇总了Java中com.amap.api.services.geocoder.RegeocodeQuery类的典型用法代码示例。如果您正苦于以下问题:Java RegeocodeQuery类的具体用法?Java RegeocodeQuery怎么用?Java RegeocodeQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegeocodeQuery类属于com.amap.api.services.geocoder包,在下文中一共展示了RegeocodeQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCameraChangeFinish
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
LatLng target = cameraPosition.target;
lp = new LatLonPoint(target.latitude, target.longitude);
GeocodeSearch geocoderSearch = new GeocodeSearch(this);
geocoderSearch.setOnGeocodeSearchListener(new GeocodeSearch.OnGeocodeSearchListener() {
@Override
public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
if (rCode == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getRegeocodeAddress() != null
&& result.getRegeocodeAddress().getPois() != null) {
listviewAdapter.setData(result.getRegeocodeAddress().getPois());
}
} else {
ToastUtils.showToast(mContext, String.valueOf(rCode));
}
}
@Override
public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
}
});
RegeocodeQuery query = new RegeocodeQuery(lp, 200, GeocodeSearch.AMAP);
geocoderSearch.getFromLocationAsyn(query);
}
示例2: onCameraChangeFinish
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
/**
* 在地图状态改变完成时回调此方法。
* @param cameraPosition
*/
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
//当地图定位成功的时候该方法也会回调,为了避免不必要的搜索,因此此处增加一个判断
if(isFirstTime){
isFirstTime = false;
return;
}
//隐藏数据
mRecyclerView.setVisibility(View.GONE);
//展示dialogView
progressDialogView.setVisibility(View.VISIBLE);
findViewById(R.id.ll_progressbar).setVisibility(View.VISIBLE);
tvHint.setText(R.string.loading);
//marker 动画
jumpPoint(mEndMarker);
lvHolder.lp = new LatLonPoint(cameraPosition.target.latitude,cameraPosition.target.longitude);
RegeocodeQuery query = new RegeocodeQuery(lvHolder.lp, 200,
GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
geocoderSearch.getFromLocationAsyn(query);// 设置异步逆地理编码请求
doSearchQuery();
}
示例3: queryAddress
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
public boolean queryAddress(NimLocation location) {
boolean ret = false;
LatLonPoint point = new LatLonPoint(location.getLatitude(), location.getLongitude());
RegeocodeQuery query = new RegeocodeQuery(point, 100, GeocodeSearch.AMAP);
try {
RegeocodeAddress address = search.getFromLocation(query);
if (address != null && !TextUtils.isEmpty(address.getFormatAddress())) {
locationFromAmapAddress(location, address);
ret = true;
}
} catch (AMapException e) {
e.printStackTrace();
}
return ret;
}
示例4: getAddress
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
/**
* 响应逆地理编码
*/
public void getAddress(final LatLonPoint latLonPoint) {
// showDialog();
RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 200,
GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
geocoderSearch.getFromLocationAsyn(query);// 设置同步逆地理编码请求
}
示例5: getAddress
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
/**
* 响应逆地理编码
*/
public void getAddress(LatLonPoint latLonPoint) {
// showDialog();
RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 200,
GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
geocoderSearch.getFromLocationAsyn(query);// 设置同步逆地理编码请求
}
示例6: reverseGeocode
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
/**
* @description: 开启一个反向地理编码的任务,通过EventReverseGeocodingResult返回结果
* @author: chenshiqiang E-mail:[email protected]
* @param loc
*/
public static void reverseGeocode(final LatLng loc, final Object model){
GeocodeSearch geocoderSearch = new GeocodeSearch(App.app);
geocoderSearch.setOnGeocodeSearchListener(new OnGeocodeSearchListener() {
@Override
public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
if (rCode == 0) {
if (result != null && result.getRegeocodeAddress() != null
&& result.getRegeocodeAddress().getFormatAddress() != null) {
String address = result.getRegeocodeAddress().getFormatAddress();
if(TextUtils.isEmpty(address)){
EventBus.getDefault().post(
new EventReverseGeocodingResult(loc, null, model));
}else{
EventBus.getDefault().post(
new EventReverseGeocodingResult(loc, address, model));
}
}
}
}
@Override
public void onGeocodeSearched(GeocodeResult arg0, int arg1) {
}
});
// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
RegeocodeQuery query = new RegeocodeQuery(new LatLonPoint(loc.latitude, loc.longitude),
1000,
GeocodeSearch.AMAP);
geocoderSearch.getFromLocationAsyn(query);// 设置同步逆地理编码请求
}
示例7: onCreate
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
protected void onCreate(WriteActivity view, Bundle savedState) {
super.onCreate(view, savedState);
provider = new ImageProvider(getView());
mGeocoderSearch = new GeocodeSearch(getView());
mGeocoderSearch.setOnGeocodeSearchListener(this);
location = LocationModel.getInstance().getCurLocation();
if (location != null) {
mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP));
}
}
示例8: initMyPoint
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
private void initMyPoint() {
Location location = LocationModel.getInstance().getCurLocation();
moveTo(location.getLatitude(), location.getLongitude(), 13);
mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP));
MarkerOptions markerOption = new MarkerOptions();
markerOption.icon(BitmapDescriptorFactory
.fromResource(R.drawable.location_marker));
mMyLocation = aMap.addMarker(markerOption);
mPoint = new LatLng(location.getLatitude(),location.getLongitude());
LocationModel.getInstance().registerLocationChange(newLocation -> mMyLocation.setPosition(new LatLng(location.latitude,location.longitude)));
}
示例9: onMapClick
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
public void onMapClick(LatLng latLng) {
if (mLastMarker != null) mLastMarker.destroy();
mPoint = latLng;
MarkerOptions markerOption = new MarkerOptions();
markerOption.position(latLng);
markerOption.icon(BitmapDescriptorFactory
.fromResource(R.drawable.location_point_bigger_red));
mLastMarker = aMap.addMarker(markerOption);
mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(latLng.latitude,latLng.longitude), 50,GeocodeSearch.AMAP));
}
示例10: onMarkerClick
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.equals(mMyLocation)){
if (mLastMarker != null) mLastMarker.destroy();
mPoint = marker.getPosition();
mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(marker.getPosition().latitude,marker.getPosition().longitude), 50,GeocodeSearch.AMAP));
}
return true;
}
示例11: handleMessage
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case GET_MAP_CAMERA_LOCATION_INFO:
if (!CommonUtil.isFastDoubleClick(2000) && shouldGetMorePost && currentCameraLatLng != null) {
RegeocodeQuery query = new RegeocodeQuery(currentCameraLatLng, 200, GeocodeSearch.AMAP);
geocodeSearch.getFromLocationAsyn(query);
}
break;
}
}
示例12: search
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
public void search(double latitude, double longitude , float radius) {
RegeocodeQuery regecodeQuery = new RegeocodeQuery(new LatLonPoint(
latitude, longitude), radius, GeocodeSearch.AMAP);
mGeocodeSearch.getFromLocationAsyn(regecodeQuery);
}
示例13: start
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
@Override
public void start() {
new GetStoreInfoBiz().get(mView.getAdvertisementId(), new GetStoreInfoBiz.Listener() {
@Override
public void succeed(final StoreInfo storeInfo) {
mHandler.post(new Runnable() {
@Override
public void run() {
mStoreInfo = storeInfo;
setVoiceStatusTextViewText(mStoreInfo.getAverageDb());
mView.setSummaryTextViewText(mStoreInfo.getSummary());
if (mStoreInfo == null) {
AppLog.error("StoreInfo is null.");
}
mView.changeLocationToStore(storeInfo.getLatitude(), storeInfo.getLongitude());
// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系
RegeocodeQuery query = new RegeocodeQuery
(
new LatLonPoint(mStoreInfo.getLatitude(), mStoreInfo.getLongitude()),
200,
GeocodeSearch.AMAP
);
// 设置同步逆地理编码请求
mGeocodeSearch.getFromLocationAsyn(query);
new DownloadPic().getById(mStoreInfo.getImageId(), new DownloadPic.Listener() {
@Override
public void succeed(final Bitmap bm) {
mHandler.post(new Runnable() {
@Override
public void run() {
mView.setImageViewByBtm(bm);
}
});
}
@Override
public void failed() {
}
});
}
});
}
@Override
public void failed() {
}
});
}
示例14: search
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
public void search(double latitude, double longitude) {
RegeocodeQuery regecodeQuery = new RegeocodeQuery(new LatLonPoint(
latitude, longitude), SEARCH_RADIUS, GeocodeSearch.AMAP);
mGeocodeSearch.getFromLocationAsyn(regecodeQuery);
}
示例15: getAddress
import com.amap.api.services.geocoder.RegeocodeQuery; //导入依赖的package包/类
/**
* 响应逆地理编码
*/
public void getAddress(LatLonPoint latLonPoint) {
RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 200,
GeocodeSearch.AMAP);
geocoderSearch.getFromLocationAsyn(query);// 设置同步逆地理编码请求
}