Search in sources :

Example 21 with LatLonPoint

use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.

the class BusRouteOverlay method checkRailwayToNextTaxi.

private void checkRailwayToNextTaxi(BusStep busStep, BusStep busStep1) {
    LatLonPoint railwayLastPoint = busStep.getRailway().getArrivalstop().getLocation();
    LatLonPoint taxiFirstPoint = busStep1.getTaxi().getOrigin();
    if (!railwayLastPoint.equals(taxiFirstPoint)) {
        addWalkPolyLineByLatLonPoints(railwayLastPoint, taxiFirstPoint);
    }
}
Also used : LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 22 with LatLonPoint

use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.

the class DrivingRouteOverlay method addToMap.

/**
 * 添加驾车路线添加到地图上显示。
 */
public void addToMap() {
    initPolylineOptions();
    try {
        if (mAMap == null) {
            return;
        }
        if (mWidth == 0 || drivePath == null) {
            return;
        }
        mLatLngOfPath = new ArrayList<>();
        tmcs = new ArrayList<>();
        List<DriveStep> drivePaths = drivePath.getSteps();
        mPolylineOptions.add(startPoint);
        for (DriveStep step : drivePaths) {
            List<LatLonPoint> latLonPoints = step.getPolyline();
            List<TMC> tmcList = step.getTMCs();
            tmcs.addAll(tmcList);
            addDrivingStationMarkers(step, convertToLatLng(latLonPoints.get(0)));
            for (LatLonPoint latlonpoint : latLonPoints) {
                mPolylineOptions.add(convertToLatLng(latlonpoint));
                mLatLngOfPath.add(convertToLatLng(latlonpoint));
            }
        }
        mPolylineOptions.add(endPoint);
        if (startMarker != null) {
            startMarker.remove();
            startMarker = null;
        }
        if (endMarker != null) {
            endMarker.remove();
            endMarker = null;
        }
        addStartAndEndMarker();
        addThroughPointMarker();
        if (isColorFulLine && tmcs.size() > 0) {
            colorWayUpdate(tmcs);
            showColorPolyline();
        } else {
            showPolyline();
        }
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : DriveStep(com.amap.api.services.route.DriveStep) TMC(com.amap.api.services.route.TMC) LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 23 with LatLonPoint

use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.

the class DrivingRouteOverlay method colorWayUpdate.

/**
 * 根据不同的路段拥堵情况展示不同的颜色
 *
 * @param tmcSection
 */
private void colorWayUpdate(List<TMC> tmcSection) {
    if (mAMap == null) {
        return;
    }
    if (tmcSection == null || tmcSection.size() <= 0) {
        return;
    }
    TMC segmentTrafficStatus;
    mPolylineOptionsColor = null;
    mPolylineOptionsColor = new PolylineOptions();
    mPolylineOptionsColor.width(getRouteWidth());
    List<Integer> colorList = new ArrayList<Integer>();
    mPolylineOptionsColor.add(startPoint);
    mPolylineOptionsColor.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
    colorList.add(getDriveColor());
    for (int i = 0; i < tmcSection.size(); i++) {
        segmentTrafficStatus = tmcSection.get(i);
        int color = getColor(segmentTrafficStatus.getStatus());
        List<LatLonPoint> mPolyline = segmentTrafficStatus.getPolyline();
        for (int j = 1; j < mPolyline.size(); j++) {
            mPolylineOptionsColor.add(AMapUtil.convertToLatLng(mPolyline.get(j)));
            colorList.add(color);
        }
    }
    mPolylineOptionsColor.add(endPoint);
    colorList.add(getDriveColor());
    mPolylineOptionsColor.colorValues(colorList);
}
Also used : ArrayList(java.util.ArrayList) TMC(com.amap.api.services.route.TMC) LatLonPoint(com.amap.api.services.core.LatLonPoint) LatLonPoint(com.amap.api.services.core.LatLonPoint) PolylineOptions(com.amap.api.maps.model.PolylineOptions)

Example 24 with LatLonPoint

use of com.amap.api.services.core.LatLonPoint 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)

Aggregations

LatLonPoint (com.amap.api.services.core.LatLonPoint)24 LatLng (com.amap.api.maps.model.LatLng)5 PoiItem (com.amap.api.services.core.PoiItem)5 View (android.view.View)4 ArrayList (java.util.ArrayList)4 Intent (android.content.Intent)3 GeocodeSearch (com.amap.api.services.geocoder.GeocodeSearch)3 RecyclerView (android.support.v7.widget.RecyclerView)2 ImageView (android.widget.ImageView)2 PolylineOptions (com.amap.api.maps.model.PolylineOptions)2 LatLng (com.amap.api.maps2d.model.LatLng)2 GeocodeResult (com.amap.api.services.geocoder.GeocodeResult)2 RegeocodeResult (com.amap.api.services.geocoder.RegeocodeResult)2 PoiResult (com.amap.api.services.poisearch.PoiResult)2 PoiSearch (com.amap.api.services.poisearch.PoiSearch)2 TMC (com.amap.api.services.route.TMC)2 OnItemClickLisenter (com.jweihao.jdemo.utils.OnItemClickLisenter)2 Bundle (android.os.Bundle)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1