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());
}
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();
}
}
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);
}
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());
}
Aggregations