Ejemplo n.º 1
0
  private void showOnMap(LatLon latLon, boolean updateCoords, boolean ignoreCoef) {
    AnimateDraggingMapThread thread = map.getAnimatedDraggingThread();
    int fZoom = map.getZoom();
    double flat = latLon.getLatitude();
    double flon = latLon.getLongitude();

    RotatedTileBox cp = map.getCurrentRotatedTileBox().copy();
    if (ignoreCoef) {
      cp.setCenterLocation(0.5f, 0.5f);
    } else {
      cp.setCenterLocation(
          0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f : 0.5f);
    }
    cp.setLatLonCenter(flat, flon);
    flat = cp.getLatFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);
    flon = cp.getLonFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);

    if (updateCoords) {
      mapCenter = new LatLon(flat, flon);
      menu.setMapCenter(mapCenter);
      origMarkerX = cp.getCenterPixelX();
      origMarkerY = cp.getCenterPixelY();
    }

    thread.startMoving(flat, flon, fZoom, true);
  }
Ejemplo n.º 2
0
 @Override
 public boolean onDoubleTap(MotionEvent e) {
   final RotatedTileBox tb = getCurrentRotatedTileBox();
   final double lat = tb.getLatFromPixel(e.getX(), e.getY());
   final double lon = tb.getLonFromPixel(e.getX(), e.getY());
   getAnimatedDraggingThread().startMoving(lat, lon, getZoom() + 1, true);
   return true;
 }
Ejemplo n.º 3
0
  private void showOnMap(
      LatLon latLon, boolean updateCoords, boolean needMove, boolean alreadyAdjusted) {
    // AnimateDraggingMapThread thread = map.getAnimatedDraggingThread(); todo amimation
    int fZoom = getZoom();
    double flat = latLon.getLatitude();
    double flon = latLon.getLongitude();

    RotatedTileBox cp = getBox();
    // cp.setCenterLocation(0.5f, map.getMapPosition() == OsmandSettings.BOTTOM_CONSTANT ? 0.15f :
    // 0.5f);
    cp.setLatLonCenter(flat, flon);
    cp.setZoom(fZoom);
    flat = cp.getLatFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);
    flon = cp.getLonFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);

    if (updateCoords) {
      mapCenter = new LatLon(flat, flon);
      menu.setMapCenter(mapCenter);
      origMarkerX = cp.getCenterPixelX();
      origMarkerY = cp.getCenterPixelY();
    }

    if (!alreadyAdjusted) {
      LatLon adjustedLatLon =
          getAdjustedMarkerLocation(getPosY(), new LatLon(flat, flon), true, fZoom);
      flat = adjustedLatLon.getLatitude();
      flon = adjustedLatLon.getLongitude();
    }

    if (needMove) {
      // thread.startMoving(flat, flon, fZoom, true); todo animation
      PointI targetI = Utilities.convertLatLonTo31(new net.osmand.core.jni.LatLon(flat, flon));
      getMainActivity().setTarget(targetI);
      getMainActivity().setZoom(fZoom);
    }
  }