use of com.amap.api.services.route.DriveStep 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();
}
}
use of com.amap.api.services.route.DriveStep in project LivingInCampus by DulCoder.
the class DriveRouteDetailActivity method getIntentData.
private void getIntentData() {
Intent intent = getIntent();
if (intent == null) {
return;
}
mDrivePath = intent.getParcelableExtra("drive_path");
mDriveRouteResult = intent.getParcelableExtra("drive_result");
for (int i = 0; i < mDrivePath.getSteps().size(); i++) {
DriveStep step = mDrivePath.getSteps().get(i);
List<TMC> tmclist = step.getTMCs();
for (int j = 0; j < tmclist.size(); j++) {
String s = "" + tmclist.get(j).getPolyline().size();
Log.i("MY", s + tmclist.get(j).getStatus() + tmclist.get(j).getDistance() + tmclist.get(j).getPolyline().toString());
}
}
}
use of com.amap.api.services.route.DriveStep in project LivingInCampus by DulCoder.
the class DriveSegmentListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(mContext, R.layout.item_bus_segment, null);
holder.driveDirIcon = (ImageView) convertView.findViewById(R.id.bus_dir_icon);
holder.driveLineName = (TextView) convertView.findViewById(R.id.bus_line_name);
holder.driveDirUp = (ImageView) convertView.findViewById(R.id.bus_dir_icon_up);
holder.driveDirDown = (ImageView) convertView.findViewById(R.id.bus_dir_icon_down);
holder.splitLine = (ImageView) convertView.findViewById(R.id.bus_seg_split_line);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final DriveStep item = mItemList.get(position);
if (position == 0) {
holder.driveDirIcon.setImageResource(R.drawable.dir_start);
holder.driveLineName.setText("出发");
holder.driveDirUp.setVisibility(View.GONE);
holder.driveDirDown.setVisibility(View.VISIBLE);
holder.splitLine.setVisibility(View.GONE);
return convertView;
} else if (position == mItemList.size() - 1) {
holder.driveDirIcon.setImageResource(R.drawable.dir_end);
holder.driveLineName.setText("到达终点");
holder.driveDirUp.setVisibility(View.VISIBLE);
holder.driveDirDown.setVisibility(View.GONE);
holder.splitLine.setVisibility(View.VISIBLE);
return convertView;
} else {
String actionName = item.getAction();
int resID = AMapUtil.getDriveActionID(actionName);
holder.driveDirIcon.setImageResource(resID);
holder.driveLineName.setText(item.getInstruction());
holder.driveDirUp.setVisibility(View.VISIBLE);
holder.driveDirDown.setVisibility(View.VISIBLE);
holder.splitLine.setVisibility(View.VISIBLE);
return convertView;
}
}
Aggregations