Search in sources :

Example 1 with PolylineOptions

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

the class DrivingRouteOverlay method initPolylineOptions.

/**
 * 初始化线段属性
 */
private void initPolylineOptions() {
    mPolylineOptions = null;
    mPolylineOptions = new PolylineOptions();
    mPolylineOptions.color(getDriveColor()).width(getRouteWidth());
}
Also used : PolylineOptions(com.amap.api.maps.model.PolylineOptions)

Example 2 with PolylineOptions

use of com.amap.api.maps.model.PolylineOptions 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 3 with PolylineOptions

use of com.amap.api.maps.model.PolylineOptions 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 4 with PolylineOptions

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

the class WalkRouteOverlay method initPolylineOptions.

/**
 * 初始化线段属性
 */
private void initPolylineOptions() {
    if (walkStationDescriptor == null) {
        walkStationDescriptor = getWalkBitmapDescriptor();
    }
    mPolylineOptions = null;
    mPolylineOptions = new PolylineOptions();
    mPolylineOptions.color(getWalkColor()).width(getRouteWidth());
}
Also used : PolylineOptions(com.amap.api.maps.model.PolylineOptions)

Aggregations

PolylineOptions (com.amap.api.maps.model.PolylineOptions)4 LatLonPoint (com.amap.api.services.core.LatLonPoint)2 LatLng (com.amap.api.maps.model.LatLng)1 Marker (com.amap.api.maps.model.Marker)1 TMC (com.amap.api.services.route.TMC)1 ArrayList (java.util.ArrayList)1