コード例 #1
0
  public void updateSelfLocation(Location loc) {
    ;
    if (map == null) {
      return;
    }

    if (selfMarker == null) {
      selfMarker = new MapMarker();
      map.addMapObject(selfMarker);
    }

    if (selfMarker != null) {
      selfMarker.setCoordinate(new GeoCoordinate(loc.getLatitude(), loc.getLongitude()));
    }
  }
コード例 #2
0
        public void onCalculateRouteFinished(
            RouteManager.Error errorCode, List<RouteResult> result) {

          if (errorCode == RouteManager.Error.NONE && result.get(0).getRoute() != null) {

            // create a map route object and place it on the map
            mapRoute = new MapRoute(result.get(0).getRoute());
            map.addMapObject(mapRoute);

            // Get the bounding box containing the route and zoom in
            GeoBoundingBox gbb = result.get(0).getRoute().getBoundingBox();
            map.zoomTo(gbb, Map.Animation.NONE, Map.MOVE_PRESERVE_ORIENTATION);

            textViewResult.setText(
                String.format(
                    "Route calculated with %d maneuvers.",
                    result.get(0).getRoute().getManeuvers().size()));
          } else {
            textViewResult.setText(
                String.format("Route calculation failed: %s", errorCode.toString()));
          }
        }