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.

Projection + VisibleRegion #3758

Closed
Closed

Description

@tobrun

We should introduce the Projection class for the 4.0.0 release.

LatLng fromScreenLocation(Point point)
VisibleRegion getVisibleRegion()
Point toScreenLocation(LatLng location)

The first and last method are currently implemented in MapboxMap,
VisibleRegion model + implementation should be added.

  • add model classes
  • write unit tests
  • migrate old methods to new
  • update test app
  • clear checklist below for VisibleRegion

Activity

  1. added
    Android
    on Jan 29, 2016
  2. added this to the android-v4.0.0 milestone on Jan 29, 2016
  3. tobrun commented on Jan 29, 2016

    @tobrun
    MemberAuthor

    Projection:

    A projection is used to translate between on screen location and geographic coordinates on the surface of the Earth (LatLng). Screen location is in screen pixels (not display pixels) with respect to the top left corner of the map (and not necessarily of the whole screen).

    VisibleRegion:

    Contains the four points defining the four-sided polygon that is visible in a map's camera. This polygon can be a trapezoid instead of a rectangle, because a camera can have tilt. If the camera is directly over the center of the camera, the shape is rectangular, but if the camera is tilted, the shape will appear to be a trapezoid whose smallest side is closest to the point of view.

  4. tobrun commented on Feb 3, 2016

    @tobrun
    MemberAuthor

    While implementing this, I'm not sure why there is a separate class for VisibleRegion instead of using LatLngBounds instead.. As long as I don't see a need for this I'm going to implement that method with following signature: LatLngBounds getVisibleRegion()

  5. tobrun commented on Feb 3, 2016

    @tobrun
    MemberAuthor

    There is actually no way of writing unit tests for these except for a sanity check, this is because all 3 methods from Projection are using the underlying native library.

  6. added a commit that references this issue on Feb 3, 2016
  7. jfirebaugh commented on Feb 3, 2016

    @jfirebaugh
    Contributor

    While implementing this, I'm not sure why there is a separate class for VisibleRegion instead of using LatLngBounds instead.

    Rotation and tilt? LatLngBounds is axis aligned and rectangular; the region visible in a viewport is not necessarily so.

  8. tobrun commented on Feb 3, 2016

    @tobrun
    MemberAuthor

    @jfirebaugh Yes, that makes a lot of sense! will add that

  9. tobrun commented on Feb 4, 2016

    @tobrun
    MemberAuthor

    Today I will add VisibleRegion but will do a cleanup of the old geometry classes as well.

    • add Visible Region model class
    • add javadoc
    • add parceable interface
    • write unit tests
    • integrate in Projection class
    • remove BoundingBox class + tests
    • rename CoordinateSpan to LatLngSpan to be more consistent in naming
  10. tobrun commented on Feb 4, 2016

    @tobrun
    MemberAuthor

    Damn it, shooting myself in the foot here with Remove BoundingBox class,
    I will have to update jni.cpp and update related methods to us LatLngBounds instead.

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

Metadata

Metadata

Assignees

Labels

Androidrefactor

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions