summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLGPSLocation.m
blob: 4a2fce5b15ae173fe5cb8f1f1d4bf6314359b27b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//  SDLGPSLocation.m
//

#import "SDLGPSLocation.h"
#import "SDLNames.h"
#import "NSMutableDictionary+Store.h"

NS_ASSUME_NONNULL_BEGIN

@implementation SDLGPSLocation

- (instancetype)initWithLatitudeDegrees:(double)latitudeDegrees longitudeDegrees:(double)longitudeDegrees {
    return [self initWithLatitudeDegrees:latitudeDegrees longitudeDegrees:longitudeDegrees altitudeMeters:nil];
}

-(instancetype)initWithLatitudeDegrees:(double)latitudeDegrees longitudeDegrees:(double)longitudeDegrees altitudeMeters:(nullable NSNumber<SDLFloat> *)altitudeMeters {
    self = [self init];
    if(!self) {
        return nil;
    }

    self.latitudeDegrees = @(latitudeDegrees);
    self.longitudeDegrees = @(longitudeDegrees);
    self.altitudeMeters = altitudeMeters;

    return self;
}

- (void)setLongitudeDegrees:(NSNumber<SDLFloat> *)longitudeDegrees {
    [store sdl_setObject:longitudeDegrees forName:SDLNameLongitudeDegrees];
}

- (NSNumber<SDLFloat> *)longitudeDegrees {
    return [store sdl_objectForName:SDLNameLongitudeDegrees];
}

- (void)setLatitudeDegrees:(NSNumber<SDLFloat> *)latitudeDegrees {
    [store sdl_setObject:latitudeDegrees forName:SDLNameLatitudeDegrees];
}

- (NSNumber<SDLFloat> *)latitudeDegrees {
    return [store sdl_objectForName:SDLNameLatitudeDegrees];
}
- (void)setAltitudeMeters:(nullable NSNumber<SDLFloat> *)altitudeMeters {
    [store sdl_setObject:altitudeMeters forName:SDLNameAltitudeMeters];
}

- (nullable NSNumber<SDLFloat> *)altitudeMeters {
    return [store sdl_objectForName:SDLNameAltitudeMeters];
}

@end

NS_ASSUME_NONNULL_END