-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More consistent interface for converting between screen and geographic coordinates #822
Conversation
@@ -88,12 +88,11 @@ float getTilt(); | |||
|
|||
// Transform coordinates in screen space (x right, y down) into their longitude | |||
// and latitude in the map view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the comments here to reflect (lng, lat
) pair has the appropriate value. Currently if one just reads the comments it seems x
and y
will be transformed/updated to have lng
/lat
respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
caeb93e
to
89a2991
Compare
Updated with improved comments and one more commit. |
Looks good to me. Merging. |
One question first! |
Ok, last issue resolved, should be good to go! |
@@ -379,12 +379,15 @@ public CameraType getCameraType() { | |||
/** | |||
* Find the geographic coordinates corresponding to the given position on screen | |||
* @param screenPosition Position in pixels from the top-left corner of the map area | |||
* @return LngLat corresponding to the given point | |||
* @return LngLat corresponding to the given point, or null if the screen position | |||
* does not intersect a geographic location. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can mention "or null if the screen position does not intersect a geographic location, which can happen at higher tilt angles".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
a70362b
to
c550df2
Compare
Uses consistent types and naming for the relevant function calls. It should be obvious that these functions are the inverse of one another.
lngLatToScreenPosition
returnstrue
if the point is visible (the opposite of the old behavior). This is a more subjective point but to me it seems much more intuitive to associate a "positive" result with something being visible, e.g. the following use case seems reasonable:screenPositionToLngLat
returnstrue
if the screen position corresponds to a geographic location (i.e. if the ray cast has a positive intersection). This is meaningful information for tilted views.