Ejemplo n.º 1
0
 protected void parseLaunchIntentLocation() {
   Intent intent = getIntent();
   if (intent != null && intent.getData() != null) {
     Uri data = intent.getData();
     if ("http".equalsIgnoreCase(data.getScheme())
         && "download.osmand.net".equals(data.getHost())
         && "/go".equals(data.getPath())) {
       String lat = data.getQueryParameter("lat");
       String lon = data.getQueryParameter("lon");
       if (lat != null && lon != null) {
         try {
           double lt = Double.parseDouble(lat);
           double ln = Double.parseDouble(lon);
           String zoom = data.getQueryParameter("z");
           int z = settings.getLastKnownMapZoom();
           if (zoom != null) {
             z = Integer.parseInt(zoom);
           }
           settings.setMapLocationToShow(lt, ln, z, getString(R.string.shared_location));
         } catch (NumberFormatException e) {
         }
       }
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    int pos = ((android.widget.AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
    int itemId = item.getItemId();
    if (itemId == R.id.showmod) {
      OsmandSettings settings = getMyApplication().getSettings();
      OsmPoint info = (OsmPoint) listAdapter.getItem(pos);
      settings.setMapLocationToShow(
          info.getLatitude(), info.getLongitude(), settings.getLastKnownMapZoom());
      MapActivity.launchMapActivityMoveToTop(LocalOpenstreetmapActivity.this);
      return true;
    } else if (itemId == R.id.deletemod) {
      OsmPoint info = (OsmPoint) listAdapter.getItem(pos);
      if (info.getGroup() == OsmPoint.Group.POI) {
        dbpoi.deletePOI((OpenstreetmapPoint) info);
      } else if (info.getGroup() == OsmPoint.Group.BUG) {
        dbbug.deleteAllBugModifications((OsmNotesPoint) info);
      }
      listAdapter.delete(info);
      return true;
    } else if (itemId == R.id.uploadmods) {
      toUpload = new OsmPoint[] {listAdapter.getItem(pos)};
      showDialog(DIALOG_PROGRESS_UPLOAD);
      return true;
    }

    return super.onContextItemSelected(item);
  }
Ejemplo n.º 3
0
 private void selectModel(HistoryEntry model) {
   helper.selectEntry(model, this);
   OsmandSettings settings = OsmandSettings.getOsmandSettings(SearchHistoryActivity.this);
   settings.setMapLocationToShow(
       model.getLat(), model.getLon(), settings.getLastKnownMapZoom(), null, model.getName());
   MapActivity.launchMapActivityMoveToTop(this);
 }
 public void showOnMap(boolean navigateTo) {
   if (searchPoint == null) {
     return;
   }
   String historyName = null;
   String objectName = "";
   int zoom = 12;
   if (!Algoritms.isEmpty(street2) && !Algoritms.isEmpty(street)) {
     String cityName = !Algoritms.isEmpty(postcode) ? postcode : city;
     objectName = street;
     historyName =
         MessageFormat.format(
             getString(R.string.search_history_int_streets), street, street2, cityName);
     zoom = 16;
   } else if (!Algoritms.isEmpty(building)) {
     String cityName = !Algoritms.isEmpty(postcode) ? postcode : city;
     objectName = street + " " + building;
     historyName =
         MessageFormat.format(
             getString(R.string.search_history_building), building, street, cityName);
     zoom = 16;
   } else if (!Algoritms.isEmpty(street)) {
     String cityName = postcode != null ? postcode : city;
     objectName = street;
     historyName =
         MessageFormat.format(getString(R.string.search_history_street), street, cityName);
     zoom = 15;
   } else if (!Algoritms.isEmpty(city)) {
     historyName = MessageFormat.format(getString(R.string.search_history_city), city);
     objectName = city;
     zoom = 13;
   }
   if (selectAddressMode) {
     Intent intent = getIntent();
     intent.putExtra(SELECT_ADDRESS_POINT_INTENT_KEY, objectName);
     intent.putExtra(SELECT_ADDRESS_POINT_LAT, searchPoint.getLatitude());
     intent.putExtra(SELECT_ADDRESS_POINT_LON, searchPoint.getLongitude());
     setResult(SELECT_ADDRESS_POINT_RESULT_OK, intent);
     finish();
   } else {
     if (navigateTo) {
       OsmandApplication app = (OsmandApplication) getApplication();
       app.getTargetPointsHelper()
           .navigatePointDialogAndLaunchMap(
               SearchAddressActivity.this,
               searchPoint.getLatitude(),
               searchPoint.getLongitude(),
               historyName);
     } else {
       osmandSettings.setMapLocationToShow(
           searchPoint.getLatitude(), searchPoint.getLongitude(), zoom, historyName);
       MapActivity.launchMapActivityMoveToTop(SearchAddressActivity.this);
     }
   }
 }
Ejemplo n.º 5
0
  @Override
  protected void onPause() {
    super.onPause();
    app.getLocationProvider().pauseAllUpdates();
    app.getDaynightHelper().stopSensorIfNeeded();
    settings.APPLICATION_MODE.removeListener(applicationModeListener);

    settings.setLastKnownMapLocation((float) mapView.getLatitude(), (float) mapView.getLongitude());
    AnimateDraggingMapThread animatedThread = mapView.getAnimatedDraggingThread();
    if (animatedThread.isAnimating() && animatedThread.getTargetZoom() != 0) {
      settings.setMapLocationToShow(
          animatedThread.getTargetLatitude(),
          animatedThread.getTargetLongitude(),
          (int) animatedThread.getTargetZoom());
    }

    settings.setLastKnownMapZoom(mapView.getZoom());
    settings.MAP_ACTIVITY_ENABLED.set(false);
    app.getResourceManager().interruptRendering();
    app.getResourceManager().setBusyIndicator(null);
    OsmandPlugin.onMapActivityPause(this);
  }
Ejemplo n.º 6
0
 public void setMapLocationToShow(double latitude, double longitude, String historyDescription) {
   setMapLocationToShow(latitude, longitude, getLastKnownMapZoom(), historyDescription);
 }
Ejemplo n.º 7
0
 public void setMapLocationToShow(double latitude, double longitude, int zoom) {
   setMapLocationToShow(latitude, longitude, null);
 }
Ejemplo n.º 8
0
 public void setMapLocationToShow(double latitude, double longitude) {
   setMapLocationToShow(latitude, longitude, getLastKnownMapZoom(), null);
 }
 public void showOnMap(LatLon searchPoint, AddressInformation ai) {
   settings.setMapLocationToShow(
       searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, ai.getHistoryName());
   MapActivity.launchMapActivityMoveToTop(getActivity());
 }