com.amap.api.services.route.DriveStep Java Examples

The following examples show how to use com.amap.api.services.route.DriveStep. 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: DriveRouteDetailActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
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());
		}
	}
}
 
Example #2
Source File: DriveSegmentListAdapter.java    From TraceByAmap with MIT License 5 votes vote down vote up
public DriveSegmentListAdapter(Context context, List<DriveStep> list) {
	this.mContext = context;
	mItemList.add(new DriveStep());
	for (DriveStep driveStep : list) {
		mItemList.add(driveStep);
	}
	mItemList.add(new DriveStep());
}
 
Example #3
Source File: DrivingRouteOverlay.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * @param driveStep
 * @param latLng
 */
private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) {
    addStationMarker(new MarkerOptions()
            .position(latLng)
            .title("\u65B9\u5411:" + driveStep.getAction()
                    + "\n\u9053\u8DEF:" + driveStep.getRoad())
            .snippet(driveStep.getInstruction()).visible(nodeIconVisible)
            .anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor()));
}
 
Example #4
Source File: DrivingRouteOverlay.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param driveStep
 * @param latLng
 */
private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) {
    addStationMarker(new MarkerOptions()
            .position(latLng)
            .title("\u65B9\u5411:" + driveStep.getAction()
                    + "\n\u9053\u8DEF:" + driveStep.getRoad())
            .snippet(driveStep.getInstruction()).visible(nodeIconVisible)
            .anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor()));
}
 
Example #5
Source File: DrivingRouteOverlay.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
/**
 * @param driveStep
 * @param latLng
 */
private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) {
    addStationMarker(new MarkerOptions()
            .position(latLng)
            .title("\u65B9\u5411:" + driveStep.getAction()
                    + "\n\u9053\u8DEF:" + driveStep.getRoad())
            .snippet(driveStep.getInstruction()).visible(nodeIconVisible)
            .anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor()));
}
 
Example #6
Source File: DriveSegmentListAdapter.java    From TraceByAmap with MIT License 4 votes vote down vote up
@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;
	}
	
}
 
Example #7
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 #8
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 #9
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();
    }
}