Search in sources :

Example 6 with LatLng

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());
        }
    }
}
Also used : SuggestionCity(com.amap.api.services.core.SuggestionCity) PoiItem(com.amap.api.services.core.PoiItem) LatLng(com.amap.api.maps.model.LatLng) LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 7 with LatLng

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());
}
Also used : Bitmap(android.graphics.Bitmap) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) CloseableReference(com.facebook.common.references.CloseableReference) LatLng(com.amap.api.maps.model.LatLng) ImagePipeline(com.facebook.imagepipeline.core.ImagePipeline) BaseBitmapDataSubscriber(com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber) DataSource(com.facebook.datasource.DataSource)

Example 8 with LatLng

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);
}
Also used : MarkerOptions(com.amap.api.maps.model.MarkerOptions) LatLng(com.amap.api.maps.model.LatLng) Marker(com.amap.api.maps.model.Marker) CameraUpdate(com.amap.api.maps.CameraUpdate)

Aggregations

LatLng (com.amap.api.maps.model.LatLng)8 Marker (com.amap.api.maps.model.Marker)3 Bitmap (android.graphics.Bitmap)2 CameraUpdate (com.amap.api.maps.CameraUpdate)2 LatLonPoint (com.amap.api.services.core.LatLonPoint)2 CloseableReference (com.facebook.common.references.CloseableReference)2 DataSource (com.facebook.datasource.DataSource)2 ImagePipeline (com.facebook.imagepipeline.core.ImagePipeline)2 BaseBitmapDataSubscriber (com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber)2 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)2 Point (android.graphics.Point)1 View (android.view.View)1 BounceInterpolator (android.view.animation.BounceInterpolator)1 Interpolator (android.view.animation.Interpolator)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 OnClick (butterknife.OnClick)1 AMap (com.amap.api.maps.AMap)1