Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
adjust exceptions for MGLMultiPoint modernity
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Oct 4, 2016
1 parent 2d46f20 commit 8d92589
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions platform/darwin/src/MGLMultiPoint.mm
Original file line number Diff line number Diff line change
Expand Up @@ -54,39 +54,18 @@ - (void)dealloc

- (CLLocationCoordinate2D)coordinate
{
if ([self isMemberOfClass:[MGLMultiPoint class]])
{
[[NSException exceptionWithName:@"MGLAbstractClassException"
reason:@"MGLMultiPoint is an abstract class"
userInfo:nil] raise];
}

assert(_count > 0);

return CLLocationCoordinate2DMake(_coordinates[0].latitude, _coordinates[0].longitude);
}

- (NSUInteger)pointCount
{
if ([self isMemberOfClass:[MGLMultiPoint class]])
{
[[NSException exceptionWithName:@"MGLAbstractClassException"
reason:@"MGLMultiPoint is an abstract class"
userInfo:nil] raise];
}

return _count;
}

- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range
{
if ([self isMemberOfClass:[MGLMultiPoint class]])
{
[[NSException exceptionWithName:@"MGLAbstractClassException"
reason:@"MGLMultiPoint is an abstract class"
userInfo:nil] raise];
}

if (range.location + range.length > _count)
{
[[NSException exceptionWithName:NSRangeException
Expand All @@ -109,9 +88,7 @@ - (void)setCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range
{
if ([self isMemberOfClass:[MGLMultiPoint class]])
{
[[NSException exceptionWithName:@"MGLAbstractClassException"
reason:@"MGLMultiPoint is an abstract class"
userInfo:nil] raise];
[NSException raise:@"Unsupported method" format:@"The coordinates of a member of MGLMultiPoint are read-only."];
}

if (range.length == 0)
Expand Down

0 comments on commit 8d92589

Please sign in to comment.