Exemplo n.º 1
0
 protected void rotateToAnimate(float rotate) {
   if (isMapRotateEnabled()) {
     this.rotate = MapUtils.unifyRotationTo360(rotate);
     currentViewport.setRotate(this.rotate);
     refreshMap();
   }
 }
Exemplo n.º 2
0
 public void setComplexZoom(int zoom, float scale) {
   if (mainLayer != null
       && zoom <= mainLayer.getMaximumShownMapZoom()
       && zoom >= mainLayer.getMinimumShownMapZoom()) {
     animatedDraggingThread.stopAnimating();
     currentViewport.setZoom(zoom, scale, 0);
     currentViewport.setRotate(zoom > LOWEST_ZOOM_TO_ROTATE ? rotate : 0);
     refreshMap();
   }
 }
Exemplo n.º 3
0
    private void changeZoomPosition(float dz, float angle) {
      final QuadPoint cp = initialViewport.getCenterPixelPoint();
      float dx = cp.x - initialMultiTouchCenterPoint.x;
      float dy = cp.y - initialMultiTouchCenterPoint.y;
      final RotatedTileBox calc = initialViewport.copy();
      calc.setLatLonCenter(initialCenterLatLon.getLatitude(), initialCenterLatLon.getLongitude());

      float calcZoom = initialViewport.getZoom() + dz + initialViewport.getZoomScale();
      float calcRotate = calc.getRotate() + angle;
      calc.setRotate(calcRotate);
      calc.setZoomAnimation(dz);
      final LatLon r = calc.getLatLonFromPixel(cp.x + dx, cp.y + dy);
      setLatLon(r.getLatitude(), r.getLongitude());
      zoomToAnimate(calcZoom, true);
      rotateToAnimate(calcRotate);
    }
Exemplo n.º 4
0
  private void drawBasemap(Canvas canvas) {
    if (bufferImgLoc != null) {
      float rot = -bufferImgLoc.getRotate();
      canvas.rotate(rot, currentViewport.getCenterPixelX(), currentViewport.getCenterPixelY());
      final RotatedTileBox calc = currentViewport.copy();
      calc.setRotate(bufferImgLoc.getRotate());

      int cz = getZoom();
      QuadPoint lt = bufferImgLoc.getLeftTopTile(cz);
      QuadPoint rb = bufferImgLoc.getRightBottomTile(cz);
      final float x1 = calc.getPixXFromTile(lt.x, lt.y, cz);
      final float x2 = calc.getPixXFromTile(rb.x, rb.y, cz);
      final float y1 = calc.getPixYFromTile(lt.x, lt.y, cz);
      final float y2 = calc.getPixYFromTile(rb.x, rb.y, cz);
      if (!bufferBitmap.isRecycled()) {
        canvas.drawBitmap(bufferBitmap, null, new RectF(x1, y1, x2, y2), paintImg);
      }
      canvas.rotate(-rot, currentViewport.getCenterPixelX(), currentViewport.getCenterPixelY());
    }
  }
Exemplo n.º 5
0
 // for internal usage
 protected void zoomToAnimate(float tzoom, boolean notify) {
   int zoom = getZoom();
   float zoomToAnimate = tzoom - zoom - getZoomScale();
   if (zoomToAnimate >= 1) {
     zoom += (int) zoomToAnimate;
     zoomToAnimate -= (int) zoomToAnimate;
   }
   while (zoomToAnimate < 0) {
     zoom--;
     zoomToAnimate += 1;
   }
   if (mainLayer != null
       && mainLayer.getMaximumShownMapZoom() >= zoom
       && mainLayer.getMinimumShownMapZoom() <= zoom) {
     currentViewport.setZoomAndAnimation(zoom, zoomToAnimate);
     currentViewport.setRotate(zoom > LOWEST_ZOOM_TO_ROTATE ? rotate : 0);
     refreshMap();
     if (notify && locationListener != null) {
       locationListener.locationChanged(getLatitude(), getLongitude(), this);
     }
   }
 }