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

Projection + VisibleRegion #3758

Closed
5 tasks done
tobrun opened this issue Jan 29, 2016 · 7 comments
Closed
5 tasks done

Projection + VisibleRegion #3758

tobrun opened this issue Jan 29, 2016 · 7 comments
Assignees
Labels
Android Mapbox Maps SDK for Android refactor

Comments

@tobrun
Copy link
Member

tobrun commented Jan 29, 2016

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
@tobrun tobrun added refactor Android Mapbox Maps SDK for Android feature request labels Jan 29, 2016
@tobrun tobrun added this to the android-v4.0.0 milestone Jan 29, 2016
@tobrun
Copy link
Member Author

tobrun commented Jan 29, 2016

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.

@tobrun
Copy link
Member Author

tobrun commented Feb 3, 2016

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()

@tobrun
Copy link
Member Author

tobrun commented Feb 3, 2016

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.

@jfirebaugh
Copy link
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.

@tobrun
Copy link
Member Author

tobrun commented Feb 3, 2016

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

@tobrun
Copy link
Member Author

tobrun commented Feb 4, 2016

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

@tobrun
Copy link
Member Author

tobrun commented Feb 4, 2016

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.

tobrun added a commit that referenced this issue Feb 4, 2016
[android] #3758 - add VisibleRegion + unit tests, removed boundingbox, cleanup jni, cleanup test app, renamed CoordinateSpan to LatLng.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android refactor
Projects
None yet
Development

No branches or pull requests

2 participants