示例#1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.maptab);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    layout1 = (LinearLayout) findViewById(R.id.maptab1);
    //		layout2 = (LinearLayout)findViewById(R.id.maptab2);

    BroadcastReceiver myReceiver =
        new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
            Toast.makeText(context, "브로드캐스팅", 1000).show();
            //				layout1.setVisibility(View.GONE);
            //				layout2.setVisibility(View.VISIBLE);
          }
        };
    IntentFilter filter = new IntentFilter("bbb");
    registerReceiver(myReceiver, filter);

    final MapController mc = mapView.getController();
    GeoPoint point = new GeoPoint(37298025, 126972817);
    mc.animateTo(point);
    mc.setZoom(16);

    putBoardMarker();
  }
示例#2
0
  public void showBudburstSpeciesOnMap(boolean hasHandler) {

    // TODO Auto-generated method stub
    otDBH = new OneTimeDBHelper(MapViewMain.this);

    GeoPoint gPoint = new GeoPoint((int) (mLatitude * 1000000), (int) (mLongitude * 1000000));

    mMapView.setBuiltInZoomControls(true);
    mMapView.invalidate();

    if (getMyListsFromDB()) {
      Log.i("K", "Get species lists from the database");

      // add overlays on the map
      mMapView.getOverlays().clear();
      mMapView.getOverlays().add(new SpeciesMapOverlay(mMapView, mMarker, mPlantList));
      mMapView.getOverlays().add(mMyOverLay);

      titleBar.setText("Total number of species : " + mPlantList.size());

      mMapController.setCenter(gPoint);

      if (hasHandler) {
        mHandlerDone = true;
        mHandler.sendEmptyMessage(GET_MY_OBSERVED_LISTS);
        mMapController.setZoom(12);
      }
    } else {
      Toast.makeText(MapViewMain.this, "Please make your own observation", Toast.LENGTH_SHORT)
          .show();
      Log.i("K", "No species lists in the database.");
    }
  }
  private void setZoomLevel() {
    Object[] keys = map.keySet().toArray();
    OverlayItem item;
    if (keys.length > 1) {
      int minLatitude = Integer.MAX_VALUE;
      int maxLatitude = Integer.MIN_VALUE;
      int minLongitude = Integer.MAX_VALUE;
      int maxLongitude = Integer.MIN_VALUE;

      for (Object key : keys) {
        item = map.get((String) key);
        GeoPoint p = item.getPoint();
        int lati = p.getLatitudeE6();
        int lon = p.getLongitudeE6();

        maxLatitude = Math.max(lati, maxLatitude);
        minLatitude = Math.min(lati, minLatitude);
        maxLongitude = Math.max(lon, maxLongitude);
        minLongitude = Math.min(lon, minLongitude);
      }
      mapController.zoomToSpan(
          Math.abs(maxLatitude - minLatitude), Math.abs(maxLongitude - minLongitude));
      mapController.animateTo(
          new GeoPoint((maxLatitude + minLatitude) / 2, (maxLongitude + minLongitude) / 2));

    } else {
      String key = (String) keys[0];
      item = map.get(key);
      mapController.animateTo(item.getPoint());
      while (mapController.zoomIn()) {}

      mapController.zoomOut();
    }
  }
示例#4
0
  private void updateISSLocation() {
    if (CheckForUpdate()) {
      posOverlay.setLocation(currentlocation);
      mControl.animateTo(GetISSPos());

      if (!dataSent) {
        if (FirstLock && !SecondLock) {
          posOverlay.setLock(1);
          dataSent = true;
        }

        if (SecondLock) {
          posOverlay.setLock(2);
          dataSent = true;
        }
      }
    } else if (pastlocation.getLatitude() != 0.0) {
      double latdist = jsonlocation.getLatitude() - pastlocation.getLatitude();
      double longdist = jsonlocation.getLongitude() - pastlocation.getLongitude();
      if (longdist < -300) {
        longdist = 180 + longdist;
      }
      double changelat = (latdist / 60) * TimeSinceLastUpdate;
      double changelong = (longdist / 60) * TimeSinceLastUpdate;
      currentlocation.setLatitude(jsonlocation.getLatitude() + changelat);
      currentlocation.setLongitude(jsonlocation.getLongitude() + changelong);
      posOverlay.setLocation(currentlocation);
      mControl.animateTo(GetISSPos());
    }
  }
示例#5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tabs);

    // Adding the zoom option
    mapView = (MapView) findViewById(R.id.MapView);
    LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.zoom);
    View zoomView = mapView;

    zoomLayout.addView(
        zoomView,
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mapView.displayZoomControls(true);

    mc = mapView.getController();
    String coordinates[] = {"32.2217429", " -110.926479"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));

    mc.animateTo(p);
    mc.setZoom(10);
    mapView.invalidate();
    mapView.setSatellite(false);
    mapView.setStreetView(false);
    // bTakePicture = (Button)findViewById(R.id.bTakePicture);
    // bTakePicture.setOnClickListener(this);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Displaying Zooming controls
    MapView mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);

    MapController mc = mapView.getController();
    double lat = Double.parseDouble("10.35410"); // latitude
    double lon = Double.parseDouble("123.91145"); // longitude
    GeoPoint geoPoint = new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
    mc.animateTo(geoPoint);
    mc.setZoom(15);
    mapView.invalidate();

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.marker);
    AddItemizedOverlay itemizedOverlay = new AddItemizedOverlay(drawable, this);

    OverlayItem overlayitem = new OverlayItem(geoPoint, "Hello", "Talamban Campus");

    itemizedOverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedOverlay);
  }
 protected void centerMap() {
   if (locationHelper.getLastLocation() != null) {
     GeoPoint geoPoint = geoPoint(locationHelper.getLastLocation());
     MapController controller = mapView.getController();
     controller.animateTo(geoPoint);
   }
 }
示例#8
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.qtplace);

    // Set spinner content
    spnService = (Spinner) findViewById(R.id.spnPlace);
    ArrayAdapter<String> spnAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spnArr);
    spnAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spnService.setAdapter(spnAdapter);

    // Set mapview content
    mapView = (MapView) findViewById(R.id.map_view);
    mapController = mapView.getController();

    mapView.setBuiltInZoomControls(true);

    // Get prefrences
    mapController.animateTo(testpoint);
    mapController.setZoom(14);

    // Set current location
    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    LocationListener ll = new myLocationListenner();
    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);

    // Get distance
    txtDistance = (EditText) findViewById(R.id.txtDistance);

    // Set pointer in map
    mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.google_map_marker);
    itemizeOverlay = new CustomItemizeOverlay(drawable, this);
  }
示例#9
0
 protected void setPointerFromCursor(Cursor c, int zoomLevel) {
   final GeoPoint gp = MapsUtils.getGeoPoint(c);
   if (mCurrentPointer == null || !mCurrentPointer.equals(gp)) {
     setPointer(gp);
     mMapController.setCenter(gp);
     mMapController.setZoom(zoomLevel);
     mCurrentPointer = gp;
   }
 }
示例#10
0
  public void navigaleToMapItem(int itemType, String itemIndex) {
    mapItem item = findItem(itemType, itemIndex);

    if (item != null) {
      mc.animateTo(item.gp);
      mc.setZoom(mZoomMax);
    } else {
      navigateToPoint(parent.naviPoint);
    }
  }
示例#11
0
  void updateLocation(final double lat, final double lon) {
    _lastPosition = Position.valueOf(lat, lon);

    Log.d(TAG, "Starting updateLocation " + lat + ", " + lon);

    Log.d(TAG, "My Location: " + _myLocationOverlay.getMyLocation());
    _mc.animateTo(new GeoPoint((int) Math.round(lat * 1E6), (int) Math.round(lon * 1E6)));
    _mc.setZoom(DEFAULT_ZOOM_VALUE);

    getAndDisplayResultsFor(lat, lon);
  }
示例#12
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapV = (MapView) findViewById(R.id.mapView);

    mapV.displayZoomControls(true);
    mapV.setBuiltInZoomControls(true);
    mapV.setSaveEnabled(true);

    initlocation.setLatitude(0.1);
    initlocation.setLongitude(0.1);

    GeoP =
        new GeoPoint(
            (int) (initlocation.getLatitude() * 1E6), (int) (initlocation.getLongitude() * 1E6));

    posOverlay = new MapOverlay();
    List<Overlay> overlays = mapV.getOverlays();
    overlays.add(posOverlay);

    mControl = mapV.getController();
    mControl.animateTo(GeoP);
    mControl.setZoom(5);

    Bitmap iss = BitmapFactory.decodeResource(getResources(), R.drawable.iss);
    Bitmap logo = BitmapFactory.decodeResource(getResources(), R.drawable.logo);
    Bitmap logotext = BitmapFactory.decodeResource(getResources(), R.drawable.logotext);
    Bitmap tracker = BitmapFactory.decodeResource(getResources(), R.drawable.isstracker);
    posOverlay.SetImages(iss, logo, logotext, tracker);
    posOverlay.setLocation(initlocation);

    if (CheckNetwork(getApplicationContext())) {
      startUpdateTimer();
    } else {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setMessage(
          "No data connection found, please check you have a mobile data connection or wifi enabled.");
      builder.setNegativeButton(
          "Quit",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
              finish();
            }
          });
      AlertDialog alert = builder.create();

      alert.show();
    }
  }
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   MapController mc = mapView.getController();
   switch (keyCode) {
     case KeyEvent.KEYCODE_I:
       mc.zoomIn();
       break;
     case KeyEvent.KEYCODE_O:
       mc.zoomOut();
       break;
   }
   return super.onKeyDown(keyCode, event);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    map = (MapView) findViewById(R.id.mvMain);
    map.setBuiltInZoomControls(true);
    Touchy t = new Touchy(); // Overlay para detectar toques en lapantalla
    oveList = map.getOverlays(); // obtiene todos los overlays que se dibujan en el mapa
    oveList.add(t); // agrega nuestro overlay de ultimo en la lista
    compass =
        new MyLocationOverlay(
            MainActivity.this, map); // se crea un nuevo Overlay de la localizacion actual
    oveList.add(compass); // se agrega el overlay de la localizacion
    controller = map.getController(); // se obtinenen los controles del mapa
    GeoPoint point = new GeoPoint(51643234, 7848593); // se crea un nuevo Geopoint
    controller.animateTo(point); // se indica a los controles que nos lleven al punto indicado
    controller.setZoom(6); // se hace un zoon de nivel 6
    d =
        getResources()
            .getDrawable(
                R.drawable.ic_launcher); // se crea un objeto dibujable por medio de un recurso

    // placing pintpoint at location
    lm =
        (LocationManager)
            getSystemService(Context.LOCATION_SERVICE); // manager para la localizacion GPS
    Criteria crit =
        new Criteria(); // un objeto criterio que maneja el mejor criterio de selleccion del
    // provider
    towers = lm.getBestProvider(crit, false); // se obtiene un proveedor de localizacion
    Location location =
        lm.getLastKnownLocation(towers); // se obtine la localizacion del provedor seleccionado

    // si hay una localizacion
    if (location != null) {
      lat = (int) location.getLatitude(); // se obtiene la lat  y long
      lon = (int) location.getLongitude();
      GeoPoint ourLocation = new GeoPoint(lat, lon); // se crea un nuevo punto
      // se crea un overlay para mostrar un dibujo en el punto indicado por la lat y lon
      OverlayItem overlayItem = new OverlayItem(ourLocation, "what's up", "2nd string");
      CustonPinpoint custom =
          new CustonPinpoint(
              d, MainActivity.this); // se crea un punto personal con el objeto dibujable
      custom.insertPinpoint(overlayItem); // se le dan los datos de la posicion en el mapa
      oveList.add(custom); // se agrega el punto en la lista de overlays
    } else {
      // cuando todo se va al carajo
      Toast.makeText(MainActivity.this, "no se puede encontrar un provider", Toast.LENGTH_LONG)
          .show();
    }
  }
  private void inicializeMap() {
    mapView = (MapView) findViewById(R.id.map);
    mapView.setBuiltInZoomControls(true);
    mapController = mapView.getController();
    mapController.setZoom(16);
    if (latitud != 0 && longitud != 0) {
      int lat = (int) (latitud * 1E6);
      int lon = (int) (longitud * 1E6);

      mapController.animateTo(new GeoPoint(lat, lon));
      mapController.setCenter(new GeoPoint(lat, lon));
    }
    centerMyPosition();
  }
示例#16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setActionBarContentView(R.layout.mapslist);
    initActionBar();

    Bundle bundle = getIntent().getExtras();
    session = bundle.getString("session");

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

    // Server Connection and convert response to string
    sc = new ServerConnection(this);
    String params = getResources().getString(R.string.llistatXarxes) + "?session=" + session;
    String result = sc.getDataConnection(params);

    // Recogemos los puntos
    // parse json data
    try {
      OverlayItem itemNet;
      JSONArray jArray = new JSONArray(result);

      prepareDraw();

      for (int i = 0; i < jArray.length(); i++) {
        JSONObject json_data = jArray.getJSONObject(i);
        itemNet =
            new OverlayItem(
                new GeoPoint(
                    (int) (json_data.getDouble("Lat") * 1E6),
                    (int) (json_data.getDouble("Lon") * 1E6)),
                json_data.getString("Nom"),
                null);
        int idXarxa = json_data.getInt("IdXarxa");
        itemizedOverlay.addOverlay(idXarxa, itemNet);
      }
      mapView.getOverlays().clear();
      mapView.getOverlays().add(itemizedOverlay);

      // Recogemos el centro de los puntos y lo centramos
      GeoPoint point = itemizedOverlay.getCenter();
      controlMap.animateTo(point);

    } catch (JSONException e) {
      Log.e("log_tag", "Error parsing data " + e.toString());
    }
    controlMap.setZoom(8);
  }
示例#17
0
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.activity_guidemap);

    guideMapView = (MapView) findViewById(R.id.guideMapView);
    guideMapView.setBuiltInZoomControls(true);

    Intent intent = getIntent();
    GeoPoint geoPoint = getGeoPoint(intent.getStringExtra("msg"));

    MapController mapController = guideMapView.getController();
    mapController.setCenter(geoPoint);
    mapController.setZoom(18);
  }
 /**
  * Deze functie zet de meegegeven parameter, dit is een aders of plaats om naar een adres object
  * en zorgt ervoor dat de kaart op dit adres wordt gecentreerd en ingezoomd
  *
  * @param location
  * @return GeoPoint
  */
 public GeoPoint createGeopoint(String location) {
   Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault());
   List<Address> start = null;
   try {
     start = geoCoder.getFromLocationName(location, 1);
   } catch (IOException e) {
     e.printStackTrace();
   }
   p =
       new GeoPoint(
           (int) (start.get(0).getLatitude() * 1E6), (int) (start.get(0).getLongitude() * 1E6));
   mc.animateTo(p);
   mc.setZoom(13);
   return p;
 }
示例#19
0
  /** Called when a menu item is selected. */
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case LOCATION_MOCKUP_SWITCH_ID:
        if (locationSource.getMode() == LocationSource.REAL_MODE) {
          // From REAL mode to MOCK mode:
          locationSource.setMode(LocationSource.MOCK_MODE);
          item.setTitle(R.string.map_menu_realGPS);
        } else {
          // From MOCK mode to REAL mode:
          locationSource.setMode(LocationSource.REAL_MODE);
          item.setTitle(R.string.map_menu_mockGPS);
        }
        break;
      case START_AR_VIEW_ID:
        startARViewBasic();
        break;
      case CENTER_MAP_ON_CURRENT_LOCATION_ID:
        Location lastLoc = locationListener.getLastLocation();
        if (lastLoc != null) myMapCtrl.animateTo(location2GP(locationListener.getLastLocation()));
        break;
    }

    return super.onOptionsItemSelected(item);
  }
示例#20
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // MapView and Controller
    map = (MapView) findViewById(R.id.map);
    map.setBuiltInZoomControls(true);
    myMapController = map.getController();
    myMapController.setZoom(17);

    // MyLocationOverlay
    myLocationOverlay = new MyLocationOverlay(this, map);
    myLocationOverlay.enableMyLocation();
    map.getOverlays().add(myLocationOverlay);

    // Get Overlays
    mapOverlays = map.getOverlays();
    drawable = this.getResources().getDrawable(R.drawable.marker);
    itemizedOverlay = new HelloItemizedOverlay(drawable);

    // Add Marker on RP E6
    GeoPoint point = new GeoPoint(1445450, 103784260);
    OverlayItem overlayitem = new OverlayItem(point, "Hello!", "This is Republic Polytechnic E6");

    itemizedOverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedOverlay);
  }
示例#21
0
  // Set Map Center position
  public void setMapCenter(GeoPoint point) {
    MapController ctl = mapView.getController();
    if (point == null) {

      Location loc = mCurrentLocation;
      if (loc == null) {
        ctl.setCenter(mDefaultCurrentLocation);
      } else {
        ctl.setCenter(
            new GeoPoint((int) (loc.getLatitude() * 1e6), (int) (loc.getLongitude() * 1e6)));
      }
    } else {

      ctl.setCenter(point);
    }
  }
示例#22
0
 public void onLocationChanged(Location location) {
   int lat = (int) (location.getLatitude() * 1E6);
   int lng = (int) (location.getLongitude() * 1E6);
   GeoPoint point = new GeoPoint(lat, lng);
   createMarker();
   mapController.animateTo(point);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_activity);

    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);

    double intentLatitude = getIntent().getDoubleExtra(Constants.EXTRA_POINT_LAT, 0.0);
    double intentLongitude = getIntent().getDoubleExtra(Constants.EXTRA_POINT_LON, 0.0);

    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mZoom = ZOOM_GLOBAL;

    if ((intentLatitude != 0.0) && (intentLongitude != 0.0)) {
      // the activity has been lauched with a commune's coordinate in extras
      mMapCenter = GeoUtils.convertLatLon(intentLatitude, intentLongitude);
      mZoom = ZOOM_FOCUSED;

    } else if (Constants.DEMO) {
      double lat = 47.07;
      double lon = 4.88;
      mMapCenter = GeoUtils.convertLatLon(lat, lon);
    } else {
      String provider = mLocationManager.getBestProvider(criteria, true);
      Location location = mLocationManager.getLastKnownLocation(provider);
      if (location != null) {
        mMapCenter = GeoUtils.convertGeoPoint(location);
      } else {
        double lat = 47.07;
        double lon = 4.88;
        mMapCenter = GeoUtils.convertLatLon(lat, lon);
      }
    }
    mMapView = (POIMapView) findViewById(R.id.mapview);
    mMapView.setBuiltInZoomControls(true);
    mMapController = mMapView.getController();
    mMapController.setZoom(mZoom);
    mMapController.animateTo(mMapCenter);
    mMapView.setSatellite(MODE_SATELLITE);
    mMapView.setOnPanChangeListener(this);

    mHandler = new UIHandler();

    initOverlay();
    updateUI();
  }
    @Override
    protected Boolean doInBackground(Void... params) {

      List<Overlay> mapOverlays = mMap.getOverlays();
      mapOverlays.clear();
      /*
       * Where i am
       */
      Drawable meDrawable = getResources().getDrawable(R.drawable.me);
      CustomItemizedOverlay meItemizedOverlay = new CustomItemizedOverlay(meDrawable, mContext);
      GeoPoint mePoint =
          new GeoPoint(
              (int) (getLocation().getLatitude() * 1e6),
              (int) (getLocation().getLongitude() * 1e6));
      OverlayItem meOverlayitem = new OverlayItem(mePoint, "Hello", "I'm here");
      meItemizedOverlay.addOverlay(meOverlayitem);
      mapOverlays.add(meItemizedOverlay);

      records = GDGApi.getRecords(mContext, messageUtil);
      if (records != null && records.size() > 0) {
        for (int i = 0; i < records.size(); i++) {
          Record rec = records.get(i);
          Drawable drawable = null;
          if (rec.user.equals(mUserName)) {
            drawable = getResources().getDrawable(R.drawable.my_post);
          } else {
            drawable = getResources().getDrawable(R.drawable.other);
          }
          CustomItemizedOverlay itemizedOverlay = new CustomItemizedOverlay(drawable, mContext);
          itemizedOverlay.record = rec;
          GeoPoint point =
              new GeoPoint((int) (rec.locLatitude * 1e6), (int) (rec.locLongitude * 1e6));
          OverlayItem overlayitem = new OverlayItem(point, rec.title, rec.body);
          itemizedOverlay.addOverlay(overlayitem);
          mapOverlays.add(itemizedOverlay);
        }
      } else {
        messageUtil.showToastMessage(getString(R.string.error_no_records));
      }

      MapController mapController = mMap.getController();
      mapController.animateTo(mePoint);
      mapController.setZoom(12);

      return false;
    }
示例#25
0
 @Override
 public boolean dispatchKeyEvent(KeyEvent event) {
   if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) {
     zoomValue = zoomValue + 1;
     mc.setZoom(zoomValue);
   } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN) {
     zoomValue = zoomValue - 1;
     mc.setZoom(zoomValue);
   } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT) {
     mMode = false;
     changeMapMode();
   } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT) {
     mMode = true;
     changeMapMode();
   }
   return super.dispatchKeyEvent(event);
 }
示例#26
0
  private void initMapView() {
    mapView = (MapView) findViewById(R.id.mapview);
    mapCtrl = mapView.getController();

    final int maxZoomLevel = mapView.getMaxZoomLevel() - zoomCorrection;
    mapCtrl.setZoom(maxZoomLevel);
    mapView.setBuiltInZoomControls(true);
    mapView.setSatellite(true);
  }
示例#27
0
 private void setupMap() {
   mapView = (MapView) findViewById(R.id.mapLocation);
   mapView.setBuiltInZoomControls(true);
   mapView.setSatellite(false);
   mc = mapView.getController();
   drawable = this.getResources().getDrawable(R.drawable.arrow);
   list = mapView.getOverlays();
   mc.setZoom(15); // 1 ~ 21
 }
示例#28
0
 @Override
 public void onStart() {
   super.onStart();
   mapController = mapView.getController();
   mapController.setCenter(homeLocation);
   mapOverlays = mapView.getOverlays();
   mapOverlays.add(new MapKeyOverlay(this, null, 0, null));
   mapView.invalidate();
 }
示例#29
0
  private void showPosition() {
    final GeoPoint myLocation = _myLocationOverlay.getMyLocation();

    if (myLocation != null) {
      updateLocation(myLocation);
      _mc.animateTo(myLocation);
    } else {
      showNoLocationDialog();
    }
  }
示例#30
0
 public boolean onKeyDown(int keyCode, KeyEvent e) {
   if (keyCode == KeyEvent.KEYCODE_S) {
     mapView.setSatellite(!mapView.isSatellite());
     return true;
   } else if (keyCode == KeyEvent.KEYCODE_T) {
     mapView.setTraffic(!mapView.isTraffic());
     mapControl.animateTo(gp); // To ensure change displays immediately
   }
   return (super.onKeyDown(keyCode, e));
 }