Skip to content

Commit

Permalink
Merge pull request stephent#9 from ckhsponge/master
Browse files Browse the repository at this point in the history
Warnings and helper
  • Loading branch information
stephent committed Mar 30, 2014
2 parents f40aaf8 + ef84d62 commit 081ab08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions ObjectiveWMM/CCMagneticModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

+ (CCMagneticModel *) instance;

+(CLLocationDirection) declinationForLocation:(CLLocation *) location;
- (CCMagneticDeclination *) declinationForCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date;
- (BOOL) dateIsWithinModelBounds:(NSDate *) date;
- (NSDate *) modelValidityStart;
Expand Down
6 changes: 6 additions & 0 deletions ObjectiveWMM/CCMagneticModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ - (void) dealloc {
MAG_FreeMagneticModelMemory(_magneticModels[0]);
}

+(CLLocationDirection) declinationForLocation:(CLLocation *) location {
CCMagneticModel *instance = [CCMagneticModel instance];
CCMagneticDeclination *declination = [instance declinationForCoordinate:location.coordinate elevation:location.altitude date:location.timestamp];
return declination.magneticDeclination;
}

- (CCMagneticDeclination *) declinationForCoordinate:(CLLocationCoordinate2D)coordinate elevation:(CLLocationDistance)elevation date:(NSDate *)date {

MAGtype_CoordSpherical coordSpherical;
Expand Down
4 changes: 2 additions & 2 deletions ObjectiveWMM/WMM/GeomagnetismLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ CALLS: MAG_DMSstringToDegree(buffer, &CoordGeodetic->lambda); (The program uses
sscanf(buffer, "%d/%d/%d", &MagneticDate->Month, &MagneticDate->Day, &MagneticDate->Year);
if(!MAG_DateToYear(MagneticDate, Error_Message))
{
printf(Error_Message);
printf("%s",Error_Message);
printf("\nPlease re-enter Date in MM/DD/YYYY or MM DD YYYY format, or as a decimal year\n");
fgets(buffer, 40, stdin);
i = 0;
Expand All @@ -1086,7 +1086,7 @@ CALLS: MAG_DMSstringToDegree(buffer, &CoordGeodetic->lambda); (The program uses
{
if(!MAG_DateToYear(MagneticDate, Error_Message))
{
printf(Error_Message);
printf("%s",Error_Message);
strcpy(buffer, "");
printf("\nError encountered, please re-enter Date in MM/DD/YYYY or MM DD YYYY format, or as a decimal year\n");
fgets(buffer, 40, stdin);
Expand Down

0 comments on commit 081ab08

Please sign in to comment.