Skip to content

Commit 081ab08

Browse files
committed
Merge pull request #9 from ckhsponge/master
Warnings and helper
2 parents f40aaf8 + ef84d62 commit 081ab08

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

ObjectiveWMM/CCMagneticModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
+ (CCMagneticModel *) instance;
1717

18+
+(CLLocationDirection) declinationForLocation:(CLLocation *) location;
1819
- (CCMagneticDeclination *) declinationForCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date;
1920
- (BOOL) dateIsWithinModelBounds:(NSDate *) date;
2021
- (NSDate *) modelValidityStart;

ObjectiveWMM/CCMagneticModel.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ - (void) dealloc {
9898
MAG_FreeMagneticModelMemory(_magneticModels[0]);
9999
}
100100

101+
+(CLLocationDirection) declinationForLocation:(CLLocation *) location {
102+
CCMagneticModel *instance = [CCMagneticModel instance];
103+
CCMagneticDeclination *declination = [instance declinationForCoordinate:location.coordinate elevation:location.altitude date:location.timestamp];
104+
return declination.magneticDeclination;
105+
}
106+
101107
- (CCMagneticDeclination *) declinationForCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date {
102108

103109
MAGtype_CoordSpherical coordSpherical;

ObjectiveWMM/WMM/GeomagnetismLibrary.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ CALLS: MAG_DMSstringToDegree(buffer, &CoordGeodetic->lambda); (The program uses
10621062
sscanf(buffer, "%d/%d/%d", &MagneticDate->Month, &MagneticDate->Day, &MagneticDate->Year);
10631063
if(!MAG_DateToYear(MagneticDate, Error_Message))
10641064
{
1065-
printf(Error_Message);
1065+
printf("%s",Error_Message);
10661066
printf("\nPlease re-enter Date in MM/DD/YYYY or MM DD YYYY format, or as a decimal year\n");
10671067
fgets(buffer, 40, stdin);
10681068
i = 0;
@@ -1086,7 +1086,7 @@ CALLS: MAG_DMSstringToDegree(buffer, &CoordGeodetic->lambda); (The program uses
10861086
{
10871087
if(!MAG_DateToYear(MagneticDate, Error_Message))
10881088
{
1089-
printf(Error_Message);
1089+
printf("%s",Error_Message);
10901090
strcpy(buffer, "");
10911091
printf("\nError encountered, please re-enter Date in MM/DD/YYYY or MM DD YYYY format, or as a decimal year\n");
10921092
fgets(buffer, 40, stdin);

0 commit comments

Comments
 (0)