[android] #4475 - Only wrapping when needed in LatLng.wrap(). Making Javadoc more clear. Making tests consistent.
This commit is contained in:
@@ -126,7 +126,10 @@ public class LatLng implements ILatLng, Parcelable {
|
||||
*/
|
||||
public LatLng wrap(){
|
||||
LatLng wrappedVersion = new LatLng(this);
|
||||
wrappedVersion.setLongitude(MathUtils.wrap(wrappedVersion.getLongitude(), GeoConstants.MIN_LONGITUDE, GeoConstants.MAX_LONGITUDE));
|
||||
double lon = wrappedVersion.getLongitude();
|
||||
if (lon < GeoConstants.MIN_LONGITUDE || lon > GeoConstants.MAX_LONGITUDE) {
|
||||
wrappedVersion.setLongitude(MathUtils.wrap(wrappedVersion.getLongitude(), GeoConstants.MIN_LONGITUDE, GeoConstants.MAX_LONGITUDE));
|
||||
}
|
||||
return wrappedVersion;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constrains n to the given range (including min, excluding max) via modular arithmetic.
|
||||
* Constrains value to the given range (including min, excluding max) via modular arithmetic.
|
||||
*
|
||||
* Same formula as used in Core GL (math.hpp)
|
||||
* std::fmod((std::fmod((value - min), d) + d), d) + min;
|
||||
|
||||
Reference in New Issue
Block a user