本文整理汇总了Java中com.amap.api.services.core.LatLonPoint类的典型用法代码示例。如果您正苦于以下问题:Java LatLonPoint类的具体用法?Java LatLonPoint怎么用?Java LatLonPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LatLonPoint类属于com.amap.api.services.core包,在下文中一共展示了LatLonPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLocationChanged
import com.amap.api.services.core.LatLonPoint; //导入依赖的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);
}
}
}
示例2: onCameraChangeFinish
import com.amap.api.services.core.LatLonPoint; //导入依赖的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);
}
示例3: onLocationChanged
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
/**
* 实现定位
* @param amapLocation
*/
@Override
public void onLocationChanged(AMapLocation amapLocation) {
if (mListener != null && amapLocation != null) {
if (amapLocation != null
&&amapLocation.getErrorCode() == 0) {
if(isFirstTime){//只要第一次的数据,当然,也可以在这里关闭定位
// mlocationClient.stopLocation();//停止定位
mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
lvHolder.title = "[位置]";
lvHolder.address = amapLocation.getProvider()+amapLocation.getCity()+amapLocation.getStreet()+amapLocation.getStreetNum();
lvHolder.lp = new LatLonPoint(amapLocation.getLatitude(),amapLocation.getLongitude());
mEndMarker.setPosition(new LatLng(amapLocation.getLatitude(),amapLocation.getLongitude()));
data.add(0,lvHolder);
doSearchQuery();
}
} else {
String errText = "定位失败," + amapLocation.getErrorCode()+ ": " + amapLocation.getErrorInfo();
Log.e("AmapErr",errText);
}
}
}
示例4: onCameraChangeFinish
import com.amap.api.services.core.LatLonPoint; //导入依赖的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();
}
示例5: SearchPOI
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
public void SearchPOI(LatLng latLng){
PoiSearch.Query query = new PoiSearch.Query("郑州","","");
query.setPageSize(1);// 设置每页最多返回多少条poiitem
query.setPageNum(1);//设置查询页码
PoiSearch poiSearch = new PoiSearch(this, query);
List<LatLonPoint> points =new ArrayList<LatLonPoint>();
points.add(new LatLonPoint(latLng.latitude+0.0001,latLng.longitude+0.0001));
points.add(new LatLonPoint(latLng.latitude-0.0001,latLng.longitude-0.0001));
points.add(new LatLonPoint(latLng.latitude-0.0001,latLng.longitude+0.0001));
points.add(new LatLonPoint(latLng.latitude+0.0001,latLng.longitude-0.0001));
poiSearch.setBound(new PoiSearch.SearchBound(points));//设置多边形区域
poiSearch.setOnPoiSearchListener(this);
poiSearch.searchPOIAsyn();
}
示例6: queryAddress
import com.amap.api.services.core.LatLonPoint; //导入依赖的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;
}
示例7: onLocationChanged
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aLocation) {
if (mListener != null && aLocation != null && aLocation.getAMapException().getErrorCode() == 0) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
.getLongitude()));// 定位雷达小图标
float bearing = aMap.getCameraPosition().bearing;
aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
aMap.getMinZoomLevel();
double a = aLocation.getLatitude();// 维度
double b = aLocation.getLongitude();// 精度
lp = new LatLonPoint(a, b);
doSearchQuery();
}
}
示例8: onItemClick
import com.amap.api.services.core.LatLonPoint; //导入依赖的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)));
}
示例9: onPoiSearched
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult result, int code) {
if (result != null && result.getPois().size() > 0) {
ArrayList<PoiItem> list = result.getPois();
for (int i = 0; i < list.size(); i++) {
String storeName = list.get(i).getTitle();
String addressName = list.get(i).getCityName()
+ list.get(i).getAdName() + list.get(i).getSnippet();
LatLonPoint point = list.get(i).getLatLonPoint();
PoiAddressSave poi = new PoiAddressSave(storeName, addressName,
point);
poiAddressList.add(poi);
}
if (poiAddressList != null && poiAddressList.size() > 0) {
CommonAdapter<PoiAddressSave> adapter = getPresenter().initAdapter(getActivity(),
poiAddressList, R.layout.listitem_fragmentmap);
getPresenter().adapterListView(listView, adapter);
}
}
}
示例10: search
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
public void search(String keyCode, String POI) {
PoiSearch.Query query = new PoiSearch.Query(keyCode, POI, "郑州市");
query.setPageSize(10);
query.setPageNum(0);
PoiSearch poisearch = new PoiSearch(this, query);
poisearch.setOnPoiSearchListener(this);
LatLonPoint point = new LatLonPoint(mLocation.getLatitude(),
mLocation.getLongitude());
Toast.makeText(getApplicationContext(),
mLocation.getLatitude() + "||" + mLocation.getAltitude(),
Toast.LENGTH_SHORT).show();
// 第一个参数为自己的定位点,第二个为搜索半径
poisearch.setBound(new SearchBound(point, 3000, true));
poisearch.searchPOIAsyn();
}
示例11: toSearch
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
/**
* ctgr POI 类型的组合,比如定义如下组合:餐馆|电影院|景点 (POI类型请在网站“相关下载”处获取)。设置空,为全部POI类型。
*/
private void toSearch(String ctgr, LatLonPoint lp, String city) {
// query = new PoiSearch.Query("", ctgr, city);//
// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国)
System.out.println(ctgr + "==" + city);
currentPage=0;
query = new PoiSearch.Query("", ctgr, city);// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国)
query.setPageSize(10);// 设置每页最多返回多少条poiitem
query.setPageNum(currentPage);// 设置查第一页
query.setLimitDiscount(false);
query.setLimitGroupbuy(false);
if (lp != null) {
poiSearch = new PoiSearch(context, query);
poiSearch.setOnPoiSearchListener(this);
// 设置搜索区域为以lp点为圆心,其周围2000米范围
poiSearch.setBound(new PoiSearch.SearchBound(lp, scope, true));//TODO 搜索距离
poiSearch.searchPOIAsyn();// 异步搜索
}
}
示例12: onClick
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.ib_back) {
finish();
} else if (i == R.id.btn_route) {
ArrayList<PoiItem> pois = poiResult.getPois();
if (pois != null && pois.size() > 0) {
PoiItem poiItem = pois.get(0);
LatLonPoint latLonPoint = pois.get(0).getLatLonPoint();
startURI(poiItem.getTitle(), latLonPoint.getLatitude(), latLonPoint.getLongitude());
poiItem = null;
latLonPoint = null;
}
pois = null;
}
}
示例13: onMapLongClick
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
@Override
public void onMapLongClick(LatLng point) {
aMap.setOnMarkerClickListener(this);// 设置点击marker事件监听器
aMap.setOnInfoWindowClickListener(this);// 设置点击infoWindow事件监听器
if (CURP == null) {
ToastUtil.showLong(getActivity(), R.string.no_location);
}
if (mCurPoint != null) {
mCurPoint.remove();
}
// aMap.setOnMapClickListener(this);
double lat = point.latitude;
double lon = point.longitude;
getAddress(new LatLonPoint(lat, lon));
mpositionLatLng = point;
}
示例14: scroll
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
private void scroll() {
mScrollLayout.setToOpen();
listView = (ListView) findViewById(R.id.list_view);
listviewAdapter = new ListviewAdapter(this, poiItems);
listView.setAdapter(listviewAdapter);
if (poiItems != null && poiItems.size() != 0 && isLocation) {
LatLonPoint latLonPoint = poiItems.get(0).getLatLonPoint();
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude()), 17));
}
}
示例15: onMessageEvent
import com.amap.api.services.core.LatLonPoint; //导入依赖的package包/类
/**
* 获取终点信息
* @param tip
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(Tip tip) {
tvEnd.setText("到 "+tip.getDistrict());
LatLonPoint endLp = tip.getPoint();
endList.clear();
endList.add(new NaviLatLng(endLp.getLatitude(),endLp.getLongitude()));
}