diff options
Diffstat (limited to 'platform/darwin/src/MGLPolyline.mm')
-rw-r--r-- | platform/darwin/src/MGLPolyline.mm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm index 0baeb68e1a..e6b1cdebf6 100644 --- a/platform/darwin/src/MGLPolyline.mm +++ b/platform/darwin/src/MGLPolyline.mm @@ -80,6 +80,36 @@ return self; } +- (instancetype)initWithCoder:(NSCoder *)decoder { + if (self = [super initWithCoder:decoder]) { + _polylines = [decoder decodeObjectOfClass:[NSArray class] forKey:@"polylines"]; + } + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + [coder encodeObject:_polylines forKey:@"polylines"]; +} + +- (BOOL)isEqual:(id)other +{ + if (self == other) return YES; + if (![other isKindOfClass:[MGLMultiPolyline class]]) return NO; + + MGLMultiPolyline *otherMultipoline = other; + return ([super isEqual:otherMultipoline] + && [self.polylines isEqualToArray:otherMultipoline.polylines]); +} + +- (NSUInteger)hash { + NSUInteger hash = [super hash]; + for (MGLPolyline *polyline in self.polylines) { + hash += [polyline hash]; + } + return hash; +} + - (BOOL)intersectsOverlayBounds:(MGLCoordinateBounds)overlayBounds { return MGLCoordinateBoundsIntersectsCoordinateBounds(_overlayBounds, overlayBounds); } |