Fit to coordinates

Whoever determined the boundaries of the District of Columbia did not have fit-to-bounds implementations in mind. With this change, shapes that are not unrotated rectangles fit much, much better.
This commit is contained in:
Minh Nguyễn
2015-06-26 14:27:44 -07:00
parent 7b22caddd0
commit ac2ad993a5
5 changed files with 76 additions and 17 deletions

View File

@@ -134,6 +134,13 @@ IB_DESIGNABLE
* @param animated Specify `YES` to animate the change by smoothly scrolling and zooming or `NO` to immediately display the given bounds. */
- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
/** Changes the receiver’s viewport to fit all of the given coordinates and optionally some additional padding on each side.
* @param coordinates The coordinates that the viewport will show.
* @param count The number of coordinates. This number must not be greater than the number of elements in `coordinates`.
* @param insets The minimum padding (in screen points) that will be visible around the given coordinate bounds.
* @param animated Specify `YES` to animate the change by smoothly scrolling and zooming or `NO` to immediately display the given bounds. */
- (void)setVisibleCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
/** The heading of the map (measured in degrees) relative to true north.
*
* The value `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on. */

View File

@@ -100,6 +100,7 @@ public:
double getZoom() const;
void setLatLngZoom(LatLng latLng, double zoom, Duration = Duration::zero());
void fitBounds(LatLngBounds bounds, EdgeInsets padding, Duration duration = Duration::zero());
void fitBounds(AnnotationSegment segment, EdgeInsets padding, Duration duration = Duration::zero());
void resetZoom();
double getMinZoom() const;
double getMaxZoom() const;