예제 #1
0
  @Override
  public void onGetWalkingRouteResult(WalkingRouteResult result) {
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
      Toast.makeText(NewMapActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT).show();
    }
    if (result.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) {
      // 起终点或途经点地址有岐义,通过以下接口获取建议查询信息
      // result.getSuggestAddrInfo()
      return;
    }
    if (result.error == SearchResult.ERRORNO.NO_ERROR) {

      // mBtnPre.setVisibility(View.VISIBLE);
      // mBtnNext.setVisibility(View.VISIBLE);
      route = result.getRouteLines().get(0);
      WalkingRouteOverlay overlay = new MyWalkingRouteOverlay(mBaiduMap);
      mBaiduMap.setOnMarkerClickListener(overlay);
      routeOverlay = overlay;
      overlay.setData(result.getRouteLines().get(0));
      overlay.addToMap();
      overlay.zoomToSpan();
    }
  }
예제 #2
0
  @Override
  public void onGetWalkingRouteResult(final WalkingRouteResult result) {
    mRoutePlanSearch.destroy();
    mRoutePlanSearch = null;

    if (result != null && result.error == SearchResult.ERRORNO.NO_ERROR) {
      final List<WalkingRouteLine> list = result.getRouteLines();
      if (list != null && list.size() > 0) {
        final WalkingRouteLine walkingRouteLine = list.get(0);
        final WalkingRouteOverlay overlay = new WalkingRouteOverlay(mBaiduMap);
        overlay.setData(walkingRouteLine);
        overlay.addToMap();
        overlay.zoomToSpan();
      }
    }
  }