[core] Tighten LatLng and other geo.hpp classes

* Remove LatLng::null and enforce invariants
* Remove unnecessary operator bool()
This commit is contained in:
John Firebaugh
2016-03-16 17:45:00 -07:00
parent 56ea87357a
commit 0314a46ee4
5 changed files with 40 additions and 97 deletions

View File

@@ -616,7 +616,7 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, optional
if (width > 0 || height > 0) {
double scaleX = double(getSize().width) / width;
double scaleY = double(getSize().height) / height;
if (padding && *padding) {
if (padding) {
scaleX -= (padding->left + padding->right) / width;
scaleY -= (padding->top + padding->bottom) / height;
}
@@ -627,7 +627,7 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, optional
// Calculate the center point of a virtual bounds that is extended in all directions by padding.
ScreenCoordinate centerPixel = nePixel + swPixel;
if (padding && *padding) {
if (padding) {
ScreenCoordinate paddedNEPixel = {
padding->right / minScale,
padding->top / minScale,