Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Client iOS Map Center
if (supportsMaps_)
{
BOOL initialized = NO;
CLLocationDegrees minLat = -1000.0f;
CLLocationDegrees maxLat = 1000.0f;
CLLocationDegrees minLong = -1000.0f;
CLLocationDegrees maxLong = 1000.0f;
// We support maps, loop over houses to find the region to fit
for (Household *household in [self households])
{
if ([household hasCoordinate])
{
CLLocationCoordinate2D coord = [household coordinate];
if (!initialized)
{
minLat = coord.latitude;
maxLat = coord.latitude;
minLong = coord.longitude;
maxLong = coord.longitude;
initialized = YES;
}
else
{
if (coord.latitude < minLat) { minLat = coord.latitude; }
if (coord.latitude > maxLat) { maxLat = coord.latitude; }
if (coord.longitude < minLong) { minLong = coord.longitude; }
if (coord.longitude > maxLong) { maxLong = coord.longitude; }
}
}
}
MKCoordinateSpan span = MKCoordinateSpanMake( fabs(maxLat-minLat), fabs(maxLong-minLong));
CLLocationCoordinate2D center;
center.latitude = minLat + (span.latitudeDelta/2.0f);
center.longitude = minLong + (span.longitudeDelta/2.0f);
householdMapRegion_ = MKCoordinateRegionMake(center, span);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.