public DrivingRouteOverlay( Context context, AMap aMap, DrivePath drivePath, LatLonPoint latLonPoint, LatLonPoint latLonPoint2, List<LatLonPoint> list) { super(context); this.c = new ArrayList(); this.d = true; this.mAMap = aMap; this.a = drivePath; this.startPoint = a.a(latLonPoint); this.endPoint = a.a(latLonPoint2); this.b = list; this.e = context; }
/** 添加驾车路线添加到地图上显示。 */ 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(); 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); } else { showPolyline(); } } catch (Throwable e) { e.printStackTrace(); } }