use of com.amap.api.maps.model.LatLng in project ride-read-android by Ride-Read.
the class MapFragment method onPoiSearched.
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
if (null == poiResult)
return;
List<PoiItem> poiList = poiResult.getPois();
if (!ListUtils.isEmpty(poiList)) {
PoiItem firstResult = poiList.get(0);
LatLonPoint resultPoint = firstResult.getLatLonPoint();
LatLng resultLatLng = new LatLng(resultPoint.getLatitude(), resultPoint.getLongitude());
mAMap.moveCamera(CameraUpdateFactory.changeLatLng(resultLatLng));
ToastUtils.show("搜索结果为:" + firstResult.getAdName());
} else {
List<SuggestionCity> suggestionCitys = poiResult.getSearchSuggestionCitys();
if (!ListUtils.isEmpty(suggestionCitys)) {
ToastUtils.show("搜索失败,建议搜索填写:" + suggestionCitys.get(0).getCityName());
}
}
}
use of com.amap.api.maps.model.LatLng in project ride-read-android by Ride-Read.
the class MapFragment method addMoment2Map.
private void addMoment2Map(final MapMoment moment) {
final LatLng latLng = new LatLng(moment.getLatitude(), moment.getLongitude());
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(moment.getPictures().get(0) + QiNiuUtils.CROP_SMALL_100)).setProgressiveRenderingEnabled(true).build();
ImagePipeline imagePipeline = Fresco.getImagePipeline();
DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, Utils.getAppContext());
dataSource.subscribe(new BaseBitmapDataSubscriber() {
@Override
public void onNewResultImpl(@Nullable Bitmap bitmap) {
addMomentMarker(latLng, bitmap, moment);
}
@Override
public void onFailureImpl(DataSource dataSource) {
}
}, CallerThreadExecutor.getInstance());
}
use of com.amap.api.maps.model.LatLng in project YourEyes by SevenLJY.
the class MapActivity method updatePosition.
/**
* updatePosition():更新地图位置
* 在更新位置加上marker
* */
private void updatePosition(LatLng location) {
LatLng pos = location;
//创建一个设置经纬度的CameraUpdate
CameraUpdate cuLoc = CameraUpdateFactory.changeLatLng(pos);
//更新地图显示区域
aMap.moveCamera(cuLoc);
//清除地图所有覆盖物
aMap.clear();
//创建一个MarkerOptions对象并使用自定义图标
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(pos);
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.smallplaceholder));
markerOptions.draggable(true);
//添加marker
Marker marker = aMap.addMarker(markerOptions);
}
Aggregations