Files
MapLibreParticleLab/platform/darwin/src/NSValue+MGLAdditions.m
Fabian Guerra Soto 20712b7c84 Per-attribute transition properties on MGLStyleLayer (#8225)
* [ios, macos] new struct MGLTransition

* [ios] MGLTransition struct moved to MGLTypes.h

* [ios] MGLTransition implemented for style layer properties

* [ios, macos] added support for getting property transitions

* [ios, macos] updated to MGLDurationFromTimeInterval and MGLTimeIntervalFromDuration

* [ios, macos] added transition properties test

* [ios, macos] modified key strings imp

* [ios, macos] The impl for transition properties were changed to public methods

* [ios, macos] Changelog update

* [ios] Fixed layer space formatting

* [core] The name space was fixed for getters that returned TransitionOptions

* [ios, macos] Added rawLayer transition property tests

* [ios] Added a factory method for MGLTransition and transition-related methods to NSValue(MGLAdditions)

* [ios, macos] Copyedited changelog blurbs about transition properties
2017-03-10 11:33:31 -08:00

62 lines
1.6 KiB
Objective-C

#import "NSValue+MGLAdditions.h"
@implementation NSValue (MGLAdditions)
#pragma mark Geometry
+ (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate {
return [self valueWithBytes:&coordinate objCType:@encode(CLLocationCoordinate2D)];
}
- (CLLocationCoordinate2D)MGLCoordinateValue {
CLLocationCoordinate2D coordinate;
[self getValue:&coordinate];
return coordinate;
}
+ (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span {
return [self valueWithBytes:&span objCType:@encode(MGLCoordinateSpan)];
}
- (MGLCoordinateSpan)MGLCoordinateSpanValue {
MGLCoordinateSpan span;
[self getValue:&span];
return span;
}
+ (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds {
return [self valueWithBytes:&bounds objCType:@encode(MGLCoordinateBounds)];
}
- (MGLCoordinateBounds)MGLCoordinateBoundsValue {
MGLCoordinateBounds bounds;
[self getValue:&bounds];
return bounds;
}
#pragma mark Offline maps
+ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress {
return [NSValue value:&progress withObjCType:@encode(MGLOfflinePackProgress)];
}
- (MGLOfflinePackProgress)MGLOfflinePackProgressValue {
MGLOfflinePackProgress progress;
[self getValue:&progress];
return progress;
}
#pragma mark Working with Transition Values
+ (NSValue *)valueWithMGLTransition:(MGLTransition)transition; {
return [NSValue value:&transition withObjCType:@encode(MGLTransition)];
}
- (MGLTransition)MGLTransitionValue {
MGLTransition transition;
[self getValue:&transition];
return transition;
}
@end