예제 #1
0
  /**
   * Returns true or false, if these bounds intersect another.
   *
   * @param other Other bounds to test
   * @return true if two bounds intersects, false otherwise
   */
  public boolean intersects(LatLngBounds other) {
    int bottom1 = mSw.mLatE6, bottom2 = other.getSw().mLatE6;
    int left1 = mSw.mLngE6, left2 = other.getSw().mLngE6;
    int top1 = mNe.mLatE6, top2 = other.getNe().mLatE6;
    int right1 = mNe.mLngE6, right2 = other.getNe().mLngE6;

    return !((bottom1 > top2) || (left1 > right2) || (top1 < bottom2) || (right1 < left2));
  }
예제 #2
0
 /**
  * Creates new SW and NE to create union with another entire LatLngBounds.
  *
  * @param other Other bounds to make union
  */
 public void union(LatLngBounds other) {
   mSw =
       new LatLng(
           Math.min(mSw.getLat(), other.getSw().getLat()),
           Math.min(mSw.getLng(), other.getSw().getLng()));
   mNe =
       new LatLng(
           Math.max(mNe.getLat(), other.getNe().getLat()),
           Math.max(mNe.getLng(), other.getNe().getLng()));
   calculateCenter();
 }