Search in sources :

Example 31 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 32 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)

Example 33 with LatLng

use of com.amap.api.maps.model.LatLng in project Dxditor by kimi2009.

the class MapPageActivity method initGPSData.

private void initGPSData() {
    try {
        InputStream is = MapPageActivity.this.getAssets().open("devicetestdata.txt");
        String jsonString = MyUtils.inputStream2String(is);
        JSONObject js = new JSONObject(jsonString);
        String re = js.getString("devices");
        Gson gson = new Gson();
        List<Device> devices = gson.fromJson(re, new TypeToken<List<Device>>() {
        }.getType());
        for (int i = 0; i < devices.size(); i++) {
            LatLng latlng = convert(MapPageActivity.this, devices.get(i).getLocationy() + "", devices.get(i).getLocationx() + "");
            addMarkersToMap(latlng, devices.get(i));
        }
        aMap.setOnMarkerClickListener(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JSONObject(org.json.JSONObject) InputStream(java.io.InputStream) Device(itor.topnetwork.com.dxditor.bean.Device) TypeToken(com.google.gson.reflect.TypeToken) Gson(com.google.gson.Gson) LatLng(com.amap.api.maps.model.LatLng) Point(android.graphics.Point) IOException(java.io.IOException)

Example 34 with LatLng

use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.

the class BusLineOverlay method addToMap.

/**
 * 添加公交线路到地图中。
 *
 * @since V2.1.0
 */
public void addToMap() {
    try {
        List<LatLonPoint> pointList = mBusLineItem.getDirectionsCoordinates();
        List<LatLng> listPolyline = AMapServicesUtil.convertArrList(pointList);
        mBusLinePolyline = mAMap.addPolyline(new PolylineOptions().addAll(listPolyline).color(getBusColor()).width(getBuslineWidth()));
        if (mBusStations.size() < 1) {
            return;
        }
        for (int i = 1; i < mBusStations.size() - 1; i++) {
            Marker marker = mAMap.addMarker(getMarkerOptions(i));
            mBusStationMarks.add(marker);
        }
        Marker markerStart = mAMap.addMarker(getMarkerOptions(0));
        mBusStationMarks.add(markerStart);
        Marker markerEnd = mAMap.addMarker(getMarkerOptions(mBusStations.size() - 1));
        mBusStationMarks.add(markerEnd);
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : LatLng(com.amap.api.maps.model.LatLng) Marker(com.amap.api.maps.model.Marker) LatLonPoint(com.amap.api.services.core.LatLonPoint) LatLonPoint(com.amap.api.services.core.LatLonPoint) PolylineOptions(com.amap.api.maps.model.PolylineOptions)

Example 35 with LatLng

use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.

the class BusRouteOverlay method checkBusToNextBusNoWalk.

/**
 * 如果换乘没有步行 检查bus最后一点和下一个step的bus起点是否一致
 *
 * @param busStep
 * @param busStep1
 */
private void checkBusToNextBusNoWalk(BusStep busStep, BusStep busStep1) {
    LatLng endbusLatLng = AMapUtil.convertToLatLng(getLastBuslinePoint(busStep));
    LatLng startbusLatLng = AMapUtil.convertToLatLng(getFirstBuslinePoint(busStep1));
    if (startbusLatLng.latitude - endbusLatLng.latitude > 0.0001 || startbusLatLng.longitude - endbusLatLng.longitude > 0.0001) {
        // 断线用带箭头的直线连?
        drawLineArrow(endbusLatLng, startbusLatLng);
    }
}
Also used : LatLng(com.amap.api.maps.model.LatLng)

Aggregations

LatLng (com.amap.api.maps.model.LatLng)49 LatLonPoint (com.amap.api.services.core.LatLonPoint)15 MarkerOptions (com.amap.api.maps.model.MarkerOptions)9 ArrayList (java.util.ArrayList)7 LatLngBounds (com.amap.api.maps.model.LatLngBounds)6 Marker (com.amap.api.maps.model.Marker)6 CameraUpdate (com.amap.api.maps.CameraUpdate)5 Bitmap (android.graphics.Bitmap)4 Point (android.graphics.Point)4 CameraPosition (com.amap.api.maps.model.CameraPosition)4 PolylineOptions (com.amap.api.maps.model.PolylineOptions)4 SuppressLint (android.annotation.SuppressLint)3 TextView (android.widget.TextView)3 Polyline (com.amap.api.maps.model.Polyline)3 Location (android.location.Location)2 View (android.view.View)2 BounceInterpolator (android.view.animation.BounceInterpolator)2 Interpolator (android.view.animation.Interpolator)2 ImageView (android.widget.ImageView)2 BindView (butterknife.BindView)2