Java源码示例:com.amap.api.services.route.WalkRouteResult
示例1
@Override
public void onWalkRouteSearched(WalkRouteResult result, int code) {
mAmap.clear();// 清理地图上的所有覆盖物
if (code == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getPaths() != null) {
if (result.getPaths().size() > 0) {
final WalkPath walkPath = result.getPaths()
.get(0);
WalkRouteOverlay overlay = new WalkRouteOverlay(getActivity(), mAmap, walkPath,
result.getStartPos(),
result.getTargetPos());
overlay.setNodeIconVisibility(false);//设置节点marker是否显示
overlay.removeFromMap();
overlay.addToMap();
overlay.zoomToSpan();
setLineInfo((int) walkPath.getDistance(), (int) walkPath.getDuration() / 60);
List<String> details = new ArrayList<>();
if (null != walkPath.getSteps() && !walkPath.getSteps().isEmpty()) {
for (WalkStep step : walkPath.getSteps()) {
details.add(step.getInstruction());
}
}
setRouteDetailsAdapter(details);
}
}
}
}
示例2
@Override
public void onWalkRouteSearched(WalkRouteResult result, int code) {
mAmap.clear();// 清理地图上的所有覆盖物
if (code == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getPaths() != null) {
if (result.getPaths().size() > 0) {
final WalkPath walkPath = result.getPaths()
.get(0);
WalkRouteOverlay overlay = new WalkRouteOverlay(getActivity(), mAmap, walkPath,
result.getStartPos(),
result.getTargetPos());
overlay.setNodeIconVisibility(false);//设置节点marker是否显示
overlay.removeFromMap();
overlay.addToMap();
overlay.zoomToSpan();
setLineInfo((int) walkPath.getDistance(), (int) walkPath.getDuration() / 60);
List<String> details = new ArrayList<>();
if (null != walkPath.getSteps() && !walkPath.getSteps().isEmpty()) {
for (WalkStep step : walkPath.getSteps()) {
details.add(step.getInstruction());
}
}
setRouteDetailsAdapter(details);
}
}
}
}
示例3
@Override
public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) {
if (i == RIGHTCODE) {
WalkPath walkPath = walkRouteResult.getPaths().get(0);
RoutePlan routePlan = initAndSetRoutePlan(WALK, walkPath, 0);
addPlan(walkRouteResult.getWalkQuery().getFromAndTo(), routePlan);
}
}
示例4
/**
* 步行路线搜索结果方法回调
*/
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
dissmissProgressDialog();
aMap.clear();// 清理地图上的所有覆盖物
if (errorCode == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getPaths() != null) {
if (result.getPaths().size() > 0) {
mWalkRouteResult = result;
final WalkPath walkPath = mWalkRouteResult.getPaths()
.get(0);
if(walkPath == null) {
return;
}
WalkRouteOverlay walkRouteOverlay = new WalkRouteOverlay(
this, aMap, walkPath,
mWalkRouteResult.getStartPos(),
mWalkRouteResult.getTargetPos());
walkRouteOverlay.removeFromMap();
walkRouteOverlay.addToMap();
walkRouteOverlay.zoomToSpan();
mBottomLayout.setVisibility(View.VISIBLE);
int dis = (int) walkPath.getDistance();
int dur = (int) walkPath.getDuration();
String des = AMapUtil.getFriendlyTime(dur)+"("+AMapUtil.getFriendlyLength(dis)+")";
mRotueTimeDes.setText(des);
mRouteDetailDes.setVisibility(View.GONE);
mBottomLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext,
WalkRouteDetailActivity.class);
intent.putExtra("walk_path", walkPath);
intent.putExtra("walk_result",
mWalkRouteResult);
startActivity(intent);
}
});
} else if (result != null && result.getPaths() == null) {
ToastUtil.show(mContext, R.string.no_result);
}
} else {
ToastUtil.show(mContext, R.string.no_result);
}
} else {
ToastUtil.showerror(this.getApplicationContext(), errorCode);
}
}
示例5
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
dissmissProgressDialog();
aMap.clear();// 清理地图上的所有覆盖物
if (errorCode == AMapException.CODE_AMAP_SUCCESS) {
if (result != null && result.getPaths() != null) {
if (result.getPaths().size() > 0) {
mWalkRouteResult = result;
final WalkPath walkPath = mWalkRouteResult.getPaths()
.get(0);
if(walkPath == null) {
return;
}
WalkRouteOverlay walkRouteOverlay = new WalkRouteOverlay(
this, aMap, walkPath,
mWalkRouteResult.getStartPos(),
mWalkRouteResult.getTargetPos());
walkRouteOverlay.removeFromMap();
walkRouteOverlay.addToMap();
walkRouteOverlay.zoomToSpan();
mBottomLayout.setVisibility(View.VISIBLE);
int dis = (int) walkPath.getDistance();
int dur = (int) walkPath.getDuration();
String des = AMapUtil.getFriendlyTime(dur)+"("+AMapUtil.getFriendlyLength(dis)+")";
mRotueTimeDes.setText(des);
mRouteDetailDes.setVisibility(View.GONE);
mBottomLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext,
WalkRouteDetailActivity.class);
intent.putExtra("walk_path", walkPath);
intent.putExtra("walk_result",
mWalkRouteResult);
startActivity(intent);
}
});
} else if (result != null && result.getPaths() == null) {
ToastUtil.show(mContext, R.string.no_result);
}
} else {
ToastUtil.show(mContext, R.string.no_result);
}
} else {
ToastUtil.showerror(this.getApplicationContext(), errorCode);
}
}
示例6
@Override
public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) {
}
示例7
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
}
示例8
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
}
示例9
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
}
示例10
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
}
示例11
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
}
示例12
@Override
public void onWalkRouteSearched(WalkRouteResult result, int errorCode) {
}
示例13
@Override
public void onWalkRouteSearched(WalkRouteResult arg0, int arg1) {
// TODO Auto-generated method stub
}