예제 #1
0
  private void showMapViewRoutes(List<GPSInfo> lstWgs84HashMap) {
    ArrayList<GeoPoint> lstWgs84GeoPoint = RoutesHelper.getWgs84GeoPoint(lstWgs84HashMap);

    // mRoutesOverlay
    if (mMapView != null) {
      try {
        if (mRoutesOverlay != null) {
          if (mMapView.getOverlays().contains(mRoutesOverlay)) {
            mMapView.getOverlays().remove(mRoutesOverlay);
            mRoutesOverlay = null;
          }
        }
        mRoutesOverlay = new RoutesOverlay(mPathActivity, mMapView);
        {
          mRoutesOverlay.setOnOverlayEventListener(this);

          mRoutesOverlay.setData(lstWgs84GeoPoint);
        }
        mMapView.getOverlays().add(0, mRoutesOverlay);
        mMapView.invalidate();
        mMapView.getController().animateTo(lstWgs84GeoPoint.get(0));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
예제 #2
0
 // 居中显示车辆位置或当前位
 private void toPointCenter() {
   Location location = GlobalApplication.getLocation();
   if (location != null) {
     GeoPoint geopoint =
         new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6));
     mMapView.getController().setCenter(geopoint);
   }
 }
예제 #3
0
 private void toCaricoCenter() {
   GeoPoint carGeoPoint = mApplication.getCarPosition().getGps();
   if (carGeoPoint != null) {
     mMapView.getController().setCenter(carGeoPoint);
   } else {
     toPointCenter();
   }
 }
예제 #4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mBMapMan = new BMapManager(getApplication());
    mBMapMan.init("C852FAE280E276186DE82EB547721866666283B0", null);
    super.initMapActivity(mBMapMan);

    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    mapOverlays = mapView.getOverlays();

    // first overlay
    drawable = getResources().getDrawable(R.drawable.marker);
    itemizedOverlay = new CustomItemizedOverlay<CustomOverlayItem>(drawable, mapView);

    GeoPoint point = new GeoPoint((int) (39.90923 * 1E6), (int) (116.397428 * 1E6));
    CustomOverlayItem overlayItem =
        new CustomOverlayItem(
            point,
            "Tomorrow Never Dies (1997)",
            "(M gives Bond his mission in Daimler car)",
            "http://ia.media-imdb.com/images/M/MV5BMTM1MTk2ODQxNV5BMl5BanBnXkFtZTcwOTY5MDg0NA@@._V1._SX40_CR0,0,40,54_.jpg");
    itemizedOverlay.addOverlay(overlayItem);

    GeoPoint point2 = new GeoPoint((int) (39.9022 * 1E6), (int) (116.3922 * 1E6));
    CustomOverlayItem overlayItem2 =
        new CustomOverlayItem(
            point2,
            "GoldenEye (1995)",
            "(Interiors Russian defence ministry council chambers in St Petersburg)",
            "http://ia.media-imdb.com/images/M/MV5BMzk2OTg4MTk1NF5BMl5BanBnXkFtZTcwNjExNTgzNA@@._V1._SX40_CR0,0,40,54_.jpg");
    itemizedOverlay.addOverlay(overlayItem2);

    mapOverlays.add(itemizedOverlay);

    // second overlay
    drawable2 = getResources().getDrawable(R.drawable.marker2);
    itemizedOverlay2 = new CustomItemizedOverlay<CustomOverlayItem>(drawable2, mapView);

    GeoPoint point3 = new GeoPoint((int) (39.917723 * 1E6), (int) (116.3722 * 1E6));
    CustomOverlayItem overlayItem3 =
        new CustomOverlayItem(point3, "Sliding Doors (1998)", "(interiors)", null);
    itemizedOverlay2.addOverlay(overlayItem3);

    GeoPoint point4 = new GeoPoint((int) (51.51738 * 1E6), (int) (-0.08186 * 1E6));
    CustomOverlayItem overlayItem4 =
        new CustomOverlayItem(
            point4,
            "Mission: Impossible (1996)",
            "(Ethan & Jim cafe meeting)",
            "http://ia.media-imdb.com/images/M/MV5BMjAyNjk5Njk0MV5BMl5BanBnXkFtZTcwOTA4MjIyMQ@@._V1._SX40_CR0,0,40,54_.jpg");
    itemizedOverlay2.addOverlay(overlayItem4);

    mapOverlays.add(itemizedOverlay2);

    final MapController mc = mapView.getController();
    mc.animateTo(point2);
    mc.setZoom(16);
  }
 /**
  * Create a new BalloonItemizedOverlay
  *
  * @param defaultMarker - A bounded Drawable to be drawn on the map for each item in the overlay.
  * @param mapView - The view upon which the overlay items are to be drawn.
  */
 public BalloonItemizedOverlay(Drawable defaultMarker, MapView mapView) {
   super(defaultMarker);
   this.mapView = mapView;
   viewOffset = 0;
   mc = mapView.getController();
 }