Exemplo n.º 1
0
 public Viewport() {
   mPos.scale = mMinScale;
   mPos.x = 0.5;
   mPos.y = 0.5;
   mPos.bearing = 0;
   mPos.tilt = 0;
 }
Exemplo n.º 2
0
  public boolean limitPosition(MapPosition pos) {
    boolean changed = false;
    if (pos.scale > mMaxScale) {
      pos.scale = mMaxScale;
      changed = true;
    } else if (pos.scale < mMinScale) {
      pos.scale = mMinScale;
      changed = true;
    }

    if (pos.tilt > mMaxTilt) {
      pos.tilt = mMaxTilt;
      changed = true;
    } else if (pos.tilt < mMinTilt) {
      pos.tilt = mMinTilt;
      changed = true;
    }

    if (pos.bearing > mMaxBearing) {
      pos.bearing = mMaxBearing;
      changed = true;
    } else if (pos.bearing < mMinBearing) {
      pos.bearing = mMinBearing;
      changed = true;
    }

    if (pos.x > mMaxX) {
      pos.x = mMaxX;
      changed = true;
    } else if (pos.x < mMinX) {
      pos.x = mMinX;
      changed = true;
    }

    if (pos.y > mMaxY) {
      pos.y = mMaxY;
      changed = true;
    } else if (pos.y < mMinY) {
      pos.y = mMinY;
      changed = true;
    }

    return changed;
  }
Exemplo n.º 3
0
  /**
   * Get the current MapPosition.
   *
   * @param pos MapPosition to be updated.
   * @return true iff current position is different from passed position.
   */
  public boolean getMapPosition(MapPosition pos) {

    boolean changed =
        (pos.scale != mPos.scale
            || pos.x != mPos.x
            || pos.y != mPos.y
            || pos.bearing != mPos.bearing
            || pos.tilt != mPos.tilt);

    pos.bearing = mPos.bearing;
    pos.tilt = mPos.tilt;

    pos.x = mPos.x;
    pos.y = mPos.y;
    pos.scale = mPos.scale;
    pos.zoomLevel = FastMath.log2((int) mPos.scale);

    return changed;
  }