Commit Graph

15 Commits

Author SHA1 Message Date
Bruno de Oliveira Abinader
b5bb48edaa [core] Simplify LatLng::unwrapForShortestPath usage
Simplify LatLng::{wrap,unwrapForShortestPath} code, avoiding duplicated
code between Transform::{latLngToScreenCoordinate,easeTo,flyTo}.

Added unit tests for camera usage in Transform to detect cases like e.g.
crossing the antimeridian as a shortest path between two coordinates.

Transform::flyTo precision loss to be handled in #4298.
2016-03-14 11:45:31 +02:00
Bruno de Oliveira Abinader
fe7e208b42 [core] Implement LatLng::null() 2016-03-13 21:38:20 +02:00
Bruno de Oliveira Abinader
8e30a4a080 [core] Harden Transform anchor & padding usage
Use optional values for anchor & padding in Map and Transform functions
instead of NaNs. Added unit tests to stress some edge cases.
2016-03-13 21:38:20 +02:00
Bruno de Oliveira Abinader
694a064cdd [core] Fix non-anchored Transform::setAngle
This reverts a line change from b33b2f15, because we explicitely want
the anchor to be invalid.
2016-03-11 16:53:36 +02:00
Bruno de Oliveira Abinader
f73beb5913 [core] Fix screen coordinates when crossing the antimeridian (#2)
Added missing case. Really fixes #4155 this time.
2016-03-11 12:34:21 +02:00
Bruno de Oliveira Abinader
1a4b8f3e2f [core] Fix screen coordinates when crossing the antimeridian
If the center and point coordinates are not in the same side of the
antimeridian, we need to unwrap the point longitude to make sure
it can still be seen from the visible side of the antimeridian that is
opposite to the center side.

Fixes #4155.
2016-03-10 14:00:42 +02:00
Bruno de Oliveira Abinader
b33b2f1515 [core] Check for NaNs in EdgeInsets 2016-03-10 03:36:46 +02:00
Bruno de Oliveira Abinader
026b6d4c01 [core] Coordinate wrapping fixes
- Make returning LatLngs unwrapped by default.
- PointAnnotation and ShapeAnnotation are always wrapped so they can be
  selected via intersection from the visible tile boundaries.
- Fixes LatLng::wrap() calculation.
- Fixes LatLng::unwrapForShortestPath() calculation.

The new unwrapForShortestPath algorithm unwraps the start coordinate
either forwards or backwards depending on the end coordinate value, so
we can always cross the antimeridian when needed and still obtain a
wrapped end coordinate in the end.

Fixes #4214.
2016-03-10 03:36:45 +02:00
Bruno de Oliveira Abinader
fde0ab98ee [core] Moved TileCoordinate to tile cover scope 2016-03-01 20:58:54 +00:00
Bruno de Oliveira Abinader
abe3f9ce7a [core] Moved wrapping to LatLng scope
Fixes a precision loss when converting unwrapped LatLngs.
2016-03-01 20:58:54 +00:00
Bruno de Oliveira Abinader
4994b3dc57 [core] PrecisionPoint is now ScreenCoordinate 2016-03-01 20:58:54 +00:00
Bruno de Oliveira Abinader
411a562061 [core] Enforce constants usage
Use 'LATITUDE_MAX', 'LONGITUDE_MAX', 'DEG2RAD' and 'RAD2DEG' whenever
possible.
2016-03-01 20:58:54 +00:00
John Firebaugh
235210c648 [core] Make bool conversions explicit
Implicit bool conversions are bad; they'll be used e.g. for a == b and a != b if those operators are not defined. This was happening at 032c8fba3c/src/mbgl/map/transform.cpp (L132-L132), for example.
2016-02-03 10:02:25 -08:00
John Firebaugh
37c27f3a8f [core] Improve LatLngBounds API
* Use "named constructors": empty, world, hull
* Make the two-argument constructor lenient (i.e., it is a hull operation)
* Add various accessors
* Enforce a single empty representation
2016-02-02 23:04:18 -08:00
John Firebaugh
b97dcbc125 [tests] Reorganize tests to match src structure 2016-02-02 11:31:13 -08:00