Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Remove CoordinateBounds #2896

Closed
Closed

Description

@ljbade

The CoordinateBounds class is the same as BoundingBox and should be merged.

Also BoundingBox should implement offset from #1948

Activity

  1. added
    Android
    on Nov 2, 2015
  2. added this to the android-v2.3.0 milestone on Nov 2, 2015
  3. ljbade commented on Nov 2, 2015

    @ljbade
    ContributorAuthor

    However I think I prefer the name CoordinateBounds as is it more clearly states it is in lat/lon units.

    BoundingBox sounds more like pixel units.

    @tobrun @bleege which name do you prefer?

  4. tobrun commented on Nov 2, 2015

    @tobrun
    Member

    Same preference here.

    Now we are on this subject:

    • should this class automatically detect which coordinate is SW and which is NE?
    • is this for the end developer to determine?

    If not correctly inserted the following method will not show the correct region:

    mapView.setVisibleCoordinateBounds(new CoordinateBounds(mMyLocation, mAddressLatLng), new RectF(100, 0, 100, 0), true);
  5. ljbade commented on Nov 2, 2015

    @ljbade
    ContributorAuthor

    @tobrun BoundingBox does have a isValid function. But I can't see a reason for a "negative" bounding box.

    We should at the least print a warning or throw an exception.

    @incanus on iOS what happens if you accidentally make a backwards CoordinateBounds?

  6. 1ec5 commented on Nov 3, 2015

    @1ec5
    Contributor

    MGLCoordinateBounds is a simple struct that contains no logic of its own. It’s up to routines that work with MGLCoordinateBoundses to do the right thing. An MGLCoordinateBounds with a southwest corner at (−1, 1) and a northeast corner at (1, −1) would cover almost the entire world by spanning the antemeridian. I’m not sure if either MapKit or the Mapbox iOS SDK handles that situation correctly, but those are the semantics I’d expect.

    MGLCoordinateBounds is named after UIView.bounds and related properties in UIKit. It’s actually a bit more awkward to name variables around “a bounds” and “multiple bounds” than around “a box” and “multiple boxes”, but I don’t have a strong opinion either way.

  7. ljbade commented on Nov 3, 2015

    @ljbade
    ContributorAuthor

    @1ec5 perhaps a CoordBoundingBox or LatLngBoundingBox?

  8. bleege commented on Nov 3, 2015

    @bleege
    Contributor

    Perhaps we should have used LatLngBounds as that's what's used in the Google Maps API. 😉

  9. 1ec5 commented on Nov 3, 2015

    @1ec5
    Contributor

    Perhaps we should have used LatLngBounds as that's what's used in the Google Maps API. 😉

    That’s the principle by which we chose the iOS SDK name: follow platform (vendor) conventions.

  10. ljbade commented on Nov 3, 2015

    @ljbade
    ContributorAuthor

    @1ec5 @bleege We have the opportunity to rename it to that class since removing CoordinateBounds is a breaking change to setVisibleBounds() anyhow.

  11. bleege commented on Nov 3, 2015

    @bleege
    Contributor

    We have the opportunity to rename it to that class since removing CoordinateBounds is a breaking change to setVisibleBounds() anyhow.

    So that means it's going to be renamed to LatLngBounds then? Also, we'll need to first add Deprecation to both CoordinateBounds and BoundingBox for a release so that we don't break apps.

  12. ljbade commented on Nov 3, 2015

    @ljbade
    ContributorAuthor

    @bleege What about setVisibleBounds that currently takes CoordinateBounds? To deprecate we will need to duplicate the JNI code to read from both the old and the new class.

  13. ljbade commented on Nov 6, 2015

    @ljbade
    ContributorAuthor

    I notice Google Maps LatLng is immutable. I wonder what the benefit is.

  14. ljbade commented on Nov 6, 2015

    @ljbade
    ContributorAuthor

    @1ec5 Recommends making LatLng immutable. I will do the same with LatLngZoom and ProjectedMeters.

    Going to take this as an opportunity to refactor JavaDoc the geometry package.

    @tobrun This might impact your test cases.

  15. ljbade commented on Nov 6, 2015

    @ljbade
    ContributorAuthor

    We also need to fully implement wrap around in LatLngBounds.

    From the Google docs:
    The bounds conceptually includes all points where:

    • the latitude is in the range [northeast.latitude, southwest.latitude];
    • the longitude is in the range [southwest.longtitude, northeast.longitude] if southwest.longtitude ≤ northeast.longitude; and
    • the longitude is in the range [southwest.longitude, 180) ∪ [-180, northeast.longitude] if southwest.longtitude > northeast.longitude.

    @tobrun We are going to have to remove isValid, and also fixup the various methods to take this into account.

    We also need to carefully follow Google's definition of getCenter() and including()

  16. 20 remaining items

  17. added 6 commits that reference this issue on Jan 22, 2016
  18. tobrun commented on Feb 8, 2016

    @tobrun
    Member

    This has landed in a1aca1b

  19. bleege commented on Feb 8, 2016

    @bleege
    Contributor

    @tobrun Can you link to the PR too? Makes tracking things easier. Thanks!

  20. tobrun commented on Feb 9, 2016

    @tobrun
    Member

    @bleege this was with the first iteration of MapboxMap in #3145, there I needed to migrate our public api from MapView to MapboxMap, since this feature was going to change to CameraUpdateFactory.newLatLngBounds , I just removed it from MapVIew and integrated the latter in #3754.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions