Java Code Examples for com.amap.api.services.route.DriveStep#getPolyline()

The following examples show how to use com.amap.api.services.route.DriveStep#getPolyline() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DrivingRouteOverlay.java    From TraceByAmap with MIT License 4 votes vote down vote up
/**
    * 添加驾车路线添加到地图上显示。
    */
public void addToMap() {
	initPolylineOptions();
       try {
           if (mAMap == null) {
               return;
           }

           if (mWidth == 0 || drivePath == null) {
               return;
           }
           mLatLngsOfPath = new ArrayList<LatLng>();
           tmcs = new ArrayList<TMC>();
           List<DriveStep> drivePaths = drivePath.getSteps();
           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));
               	mLatLngsOfPath.add(convertToLatLng(latlonpoint));
			}
           }
           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();
       }
   }
 
Example 2
Source File: DrivingRouteOverlay.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 添加驾车路线添加到地图上显示。
 */
public void addToMap() {
    initPolylineOptions();
    try {
        if (mAMap == null) {
            return;
        }

        if (getRouteWidth() == 0 || drivePath == null) {
            return;
        }
        mLatLngsOfPath = new ArrayList<LatLng>();
        tmcs = new ArrayList<TMC>();
        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));
                mLatLngsOfPath.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();
    }
}
 
Example 3
Source File: DrivingRouteOverlay.java    From BmapLite with Apache License 2.0 4 votes vote down vote up
/**
 * 添加驾车路线添加到地图上显示。
 */
public void addToMap() {
    initPolylineOptions();
    try {
        if (mAMap == null) {
            return;
        }

        if (getRouteWidth() == 0 || drivePath == null) {
            return;
        }
        mLatLngsOfPath = new ArrayList<LatLng>();
        tmcs = new ArrayList<TMC>();
        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));
                mLatLngsOfPath.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();
    }
}