[core] Added Map::latLngBoundsForCamera

This commit is contained in:
Bruno de Oliveira Abinader
2017-03-23 18:10:16 +02:00
parent e67abfbe67
commit 80915992ab
6 changed files with 57 additions and 0 deletions

View File

@@ -36,6 +36,19 @@ struct CameraOptions {
optional<double> pitch;
};
constexpr bool operator==(const CameraOptions& a, const CameraOptions& b) {
return a.center == b.center
&& a.padding == b.padding
&& a.anchor == b.anchor
&& a.zoom == b.zoom
&& a.angle == b.angle
&& a.pitch == b.pitch;
}
constexpr bool operator!=(const CameraOptions& a, const CameraOptions& b) {
return !(a == b);
}
/** Various options for describing a transition between viewpoints with
animation. All fields are optional; the default values depend on how this
struct is used. */

View File

@@ -107,6 +107,7 @@ public:
void setLatLngZoom(const LatLng&, double zoom, optional<EdgeInsets>, const AnimationOptions& = {});
CameraOptions cameraForLatLngBounds(const LatLngBounds&, optional<EdgeInsets>) const;
CameraOptions cameraForLatLngs(const std::vector<LatLng>&, optional<EdgeInsets>) const;
LatLngBounds latLngBoundsForCamera(const CameraOptions&) const;
void resetZoom();
void setMinZoom(const double minZoom);
double getMinZoom() const;

View File

@@ -218,4 +218,12 @@ public:
ScreenCoordinate getCenter(uint16_t width, uint16_t height) const;
};
constexpr bool operator==(const EdgeInsets& a, const EdgeInsets& b) {
return a.top == b.top && a.left == b.left && a.bottom == b.bottom && a.right == b.right;
}
constexpr bool operator!=(const EdgeInsets& a, const EdgeInsets& b) {
return !(a == b);
}
} // namespace mbgl