From 6bb8bb021f5d618e1c640f030b225ff36acad077 Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Sat, 28 Jan 2017 17:26:27 +0200 Subject: [PATCH 1/8] Fixed bounds max lat, long setters issue --- GPX/GPXBounds.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPX/GPXBounds.m b/GPX/GPXBounds.m index 21c7ad9..9625cc4 100644 --- a/GPX/GPXBounds.m +++ b/GPX/GPXBounds.m @@ -74,7 +74,7 @@ - (CGFloat)maxLatitude return [GPXType latitude:_maxLatitudeValue]; } -- (void)setMaxlat:(CGFloat)maxLatitude +- (void)setMaxLatitude:(CGFloat)maxLatitude { _maxLatitudeValue = [GPXType valueForLatitude:maxLatitude]; } @@ -84,7 +84,7 @@ - (CGFloat)maxLongitude return [GPXType longitude:_maxLongitudeValue]; } -- (void)setMaxlon:(CGFloat)maxLongitude +- (void)setMaxLongitude:(CGFloat)maxLongitude { _maxLongitudeValue = [GPXType valueForLongitude:maxLongitude]; } From 33b1fb5ce3404f972ce42dbfcdd0719e085bfedc Mon Sep 17 00:00:00 2001 From: Alex Fiannaca Date: Tue, 13 Jun 2017 12:03:25 -0700 Subject: [PATCH 2/8] Use module syntax for importing TBXML --- GPX/GPXElementSubclass.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPX/GPXElementSubclass.h b/GPX/GPXElementSubclass.h index 8337e5e..6ebc1d6 100644 --- a/GPX/GPXElementSubclass.h +++ b/GPX/GPXElementSubclass.h @@ -7,7 +7,7 @@ // #import "GPXElement.h" -#import "TBXML.h" +#import @interface GPXElement () From 1e49a13efffdebd185ad1632d3819ac879796dae Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Sun, 18 Jun 2017 23:36:46 +0300 Subject: [PATCH 3/8] Converted `CGFloat` to `double` to conform to Apple usage --- GPX/GPXBounds.h | 10 ++++----- GPX/GPXBounds.m | 18 ++++++++-------- GPX/GPXPoint.h | 6 +++--- GPX/GPXPoint.m | 14 ++++++------ GPX/GPXPointSegment.h | 2 +- GPX/GPXPointSegment.m | 2 +- GPX/GPXRoute.h | 2 +- GPX/GPXRoute.m | 2 +- GPX/GPXRoutePoint.h | 2 +- GPX/GPXRoutePoint.m | 2 +- GPX/GPXTrack.h | 2 +- GPX/GPXTrack.m | 2 +- GPX/GPXTrackPoint.h | 2 +- GPX/GPXTrackPoint.m | 2 +- GPX/GPXTrackSegment.h | 2 +- GPX/GPXTrackSegment.m | 2 +- GPX/GPXType.h | 50 +++++++++++++++++++++---------------------- GPX/GPXType.m | 38 ++++++++++++++++---------------- GPX/GPXWaypoint.h | 20 ++++++++--------- GPX/GPXWaypoint.m | 36 +++++++++++++++---------------- 20 files changed, 108 insertions(+), 108 deletions(-) diff --git a/GPX/GPXBounds.h b/GPX/GPXBounds.h index e3fd09f..da91dbb 100644 --- a/GPX/GPXBounds.h +++ b/GPX/GPXBounds.h @@ -19,16 +19,16 @@ /// --------------------------------- /** The minimum latitude. */ -@property (nonatomic, assign) CGFloat minLatitude; +@property (nonatomic, assign) double minLatitude; /** The minimum longitude. */ -@property (nonatomic, assign) CGFloat minLongitude; +@property (nonatomic, assign) double minLongitude; /** The maximum latitude. */ -@property (nonatomic, assign) CGFloat maxLatitude; +@property (nonatomic, assign) double maxLatitude; /** The maximum longitude. */ -@property (nonatomic, assign) CGFloat maxLongitude; +@property (nonatomic, assign) double maxLongitude; /// --------------------------------- @@ -42,6 +42,6 @@ @param maxLongitude The maximum longitude. @return A newly created bounds element. */ -+ (GPXBounds *)boundsWithMinLatitude:(CGFloat)minLatitude minLongitude:(CGFloat)minLongitude maxLatitude:(CGFloat)maxLatitude maxLongitude:(CGFloat)maxLongitude; ++ (GPXBounds *)boundsWithMinLatitude:(double)minLatitude minLongitude:(double)minLongitude maxLatitude:(double)maxLatitude maxLongitude:(double)maxLongitude; @end diff --git a/GPX/GPXBounds.m b/GPX/GPXBounds.m index 21c7ad9..34ebec3 100644 --- a/GPX/GPXBounds.m +++ b/GPX/GPXBounds.m @@ -36,7 +36,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent return self; } -+ (GPXBounds *)boundsWithMinLatitude:(CGFloat)minLatitude minLongitude:(CGFloat)minLongitude maxLatitude:(CGFloat)maxLatitude maxLongitude:(CGFloat)maxLongitude ++ (GPXBounds *)boundsWithMinLatitude:(double)minLatitude minLongitude:(double)minLongitude maxLatitude:(double)maxLatitude maxLongitude:(double)maxLongitude { GPXBounds *bounds = [GPXBounds new]; bounds.minLatitude = minLatitude; @@ -49,42 +49,42 @@ + (GPXBounds *)boundsWithMinLatitude:(CGFloat)minLatitude minLongitude:(CGFloat) #pragma mark - Public methods -- (CGFloat)minLatitude +- (double)minLatitude { return [GPXType latitude:_minLatitudeValue]; } -- (void)setMinLatitude:(CGFloat)minLatitude +- (void)setMinLatitude:(double)minLatitude { _minLatitudeValue = [GPXType valueForLatitude:minLatitude]; } -- (CGFloat)minLongitude +- (double)minLongitude { return [GPXType longitude:_minLongitudeValue]; } -- (void)setMinLongitude:(CGFloat)minLongitude +- (void)setMinLongitude:(double)minLongitude { _minLongitudeValue = [GPXType valueForLongitude:minLongitude]; } -- (CGFloat)maxLatitude +- (double)maxLatitude { return [GPXType latitude:_maxLatitudeValue]; } -- (void)setMaxlat:(CGFloat)maxLatitude +- (void)setMaxlat:(double)maxLatitude { _maxLatitudeValue = [GPXType valueForLatitude:maxLatitude]; } -- (CGFloat)maxLongitude +- (double)maxLongitude { return [GPXType longitude:_maxLongitudeValue]; } -- (void)setMaxlon:(CGFloat)maxLongitude +- (void)setMaxlon:(double)maxLongitude { _maxLongitudeValue = [GPXType valueForLongitude:maxLongitude]; } diff --git a/GPX/GPXPoint.h b/GPX/GPXPoint.h index 6783495..ccc56e8 100644 --- a/GPX/GPXPoint.h +++ b/GPX/GPXPoint.h @@ -25,10 +25,10 @@ @property (strong, nonatomic) NSDate *time; /** The latitude of the point. Decimal degrees, WGS84 datum */ -@property (nonatomic, assign) CGFloat latitude; +@property (nonatomic, assign) double latitude; /** The longitude of the point. Decimal degrees, WGS84 datum. */ -@property (nonatomic, assign) CGFloat longitude; +@property (nonatomic, assign) double longitude; /// --------------------------------- @@ -40,6 +40,6 @@ @param longitude The longitude of the point. @return A newly created point element. */ -+ (GPXPoint *)pointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; ++ (GPXPoint *)pointWithLatitude:(double)latitude longitude:(double)longitude; @end diff --git a/GPX/GPXPoint.m b/GPX/GPXPoint.m index 3e8eb6b..d746705 100644 --- a/GPX/GPXPoint.m +++ b/GPX/GPXPoint.m @@ -36,7 +36,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent return self; } -+ (GPXPoint *)pointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude ++ (GPXPoint *)pointWithLatitude:(double)latitude longitude:(double)longitude { GPXPoint *point = [GPXPoint new]; point.latitude = latitude; @@ -47,12 +47,12 @@ + (GPXPoint *)pointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude #pragma mark - Public methods -- (CGFloat)elevation +- (double)elevation { return [GPXType decimal:_elevationValue]; } -- (void)setElevation:(CGFloat)elevation +- (void)setElevation:(double)elevation { _elevationValue = [GPXType valueForDecimal:elevation]; } @@ -67,22 +67,22 @@ - (void)setTime:(NSDate *)time _timeValue = [GPXType valueForDateTime:time]; } -- (CGFloat)latitude +- (double)latitude { return [GPXType latitude:_latitudeValue]; } -- (void)setLatitude:(CGFloat)latitude +- (void)setLatitude:(double)latitude { _latitudeValue = [GPXType valueForLatitude:latitude]; } -- (CGFloat)longitude +- (double)longitude { return [GPXType longitude:_longitudeValue]; } -- (void)setLongitude:(CGFloat)longitude +- (void)setLongitude:(double)longitude { _longitudeValue = [GPXType valueForLongitude:longitude]; } diff --git a/GPX/GPXPointSegment.h b/GPX/GPXPointSegment.h index 69376ef..d25e2ea 100644 --- a/GPX/GPXPointSegment.h +++ b/GPX/GPXPointSegment.h @@ -33,7 +33,7 @@ @param longitude The longitude of the point. @return A newly created point element. */ -- (GPXPoint *)newPointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; +- (GPXPoint *)newPointWithLatitude:(double)latitude longitude:(double)longitude; /// --------------------------------- diff --git a/GPX/GPXPointSegment.m b/GPX/GPXPointSegment.m index 1645f8d..b8683b9 100644 --- a/GPX/GPXPointSegment.m +++ b/GPX/GPXPointSegment.m @@ -46,7 +46,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent #pragma mark - Public methods -- (GPXPoint *)newPointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude +- (GPXPoint *)newPointWithLatitude:(double)latitude longitude:(double)longitude { GPXPoint *point = [GPXPoint pointWithLatitude:latitude longitude:longitude]; [self addPoint:point]; diff --git a/GPX/GPXRoute.h b/GPX/GPXRoute.h index 513719d..7e7ee06 100644 --- a/GPX/GPXRoute.h +++ b/GPX/GPXRoute.h @@ -95,7 +95,7 @@ @param longitude The longitude of the point. @return A newly created routepoint element. */ -- (GPXRoutePoint *)newRoutepointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; +- (GPXRoutePoint *)newRoutepointWithLatitude:(double)latitude longitude:(double)longitude; /// --------------------------------- diff --git a/GPX/GPXRoute.m b/GPX/GPXRoute.m index deeaa57..f13ebfe 100644 --- a/GPX/GPXRoute.m +++ b/GPX/GPXRoute.m @@ -121,7 +121,7 @@ - (void)removeLink:(GPXLink *)link } } -- (GPXRoutePoint *)newRoutepointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude +- (GPXRoutePoint *)newRoutepointWithLatitude:(double)latitude longitude:(double)longitude { GPXRoutePoint *routepoint = [GPXRoutePoint routepointWithLatitude:latitude longitude:longitude]; [self addRoutepoint:routepoint]; diff --git a/GPX/GPXRoutePoint.h b/GPX/GPXRoutePoint.h index 0b594bc..7af79a9 100644 --- a/GPX/GPXRoutePoint.h +++ b/GPX/GPXRoutePoint.h @@ -19,6 +19,6 @@ @param longitude The longitude of the point. @return A newly created routepoint element. */ -+ (GPXRoutePoint *)routepointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; ++ (GPXRoutePoint *)routepointWithLatitude:(double)latitude longitude:(double)longitude; @end diff --git a/GPX/GPXRoutePoint.m b/GPX/GPXRoutePoint.m index 562f254..847777c 100644 --- a/GPX/GPXRoutePoint.m +++ b/GPX/GPXRoutePoint.m @@ -13,7 +13,7 @@ @implementation GPXRoutePoint #pragma mark - Instance -+ (GPXRoutePoint *)routepointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude ++ (GPXRoutePoint *)routepointWithLatitude:(double)latitude longitude:(double)longitude { GPXRoutePoint *routepoint = [GPXRoutePoint new]; routepoint.latitude = latitude; diff --git a/GPX/GPXTrack.h b/GPX/GPXTrack.h index 172a308..0f88b3a 100644 --- a/GPX/GPXTrack.h +++ b/GPX/GPXTrack.h @@ -133,6 +133,6 @@ @param longitude The longitude of the point. @return A newly created trackpoint element. */ -- (GPXTrackPoint *)newTrackpointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; +- (GPXTrackPoint *)newTrackpointWithLatitude:(double)latitude longitude:(double)longitude; @end diff --git a/GPX/GPXTrack.m b/GPX/GPXTrack.m index 91fe742..cf7397c 100644 --- a/GPX/GPXTrack.m +++ b/GPX/GPXTrack.m @@ -155,7 +155,7 @@ - (void)removeTracksegment:(GPXTrackSegment *)tracksegment } } -- (GPXTrackPoint *)newTrackpointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude +- (GPXTrackPoint *)newTrackpointWithLatitude:(double)latitude longitude:(double)longitude { GPXTrackSegment *tracksegment; diff --git a/GPX/GPXTrackPoint.h b/GPX/GPXTrackPoint.h index 06ddc75..7e90f8d 100644 --- a/GPX/GPXTrackPoint.h +++ b/GPX/GPXTrackPoint.h @@ -19,6 +19,6 @@ @param longitude The longitude of the point. @return A newly created trackpoint element. */ -+ (GPXTrackPoint *)trackpointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; ++ (GPXTrackPoint *)trackpointWithLatitude:(double)latitude longitude:(double)longitude; @end diff --git a/GPX/GPXTrackPoint.m b/GPX/GPXTrackPoint.m index 110522c..6e1c59f 100644 --- a/GPX/GPXTrackPoint.m +++ b/GPX/GPXTrackPoint.m @@ -13,7 +13,7 @@ @implementation GPXTrackPoint #pragma mark - Instance -+ (GPXTrackPoint *)trackpointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude ++ (GPXTrackPoint *)trackpointWithLatitude:(double)latitude longitude:(double)longitude { GPXTrackPoint *trackpoint = [GPXTrackPoint new]; trackpoint.latitude = latitude; diff --git a/GPX/GPXTrackSegment.h b/GPX/GPXTrackSegment.h index 5c9c916..6216bf3 100644 --- a/GPX/GPXTrackSegment.h +++ b/GPX/GPXTrackSegment.h @@ -38,7 +38,7 @@ @param longitude The longitude of the point. @return A newly created trackpoint element. */ -- (GPXTrackPoint *)newTrackpointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; +- (GPXTrackPoint *)newTrackpointWithLatitude:(double)latitude longitude:(double)longitude; /// --------------------------------- diff --git a/GPX/GPXTrackSegment.m b/GPX/GPXTrackSegment.m index dbb2fe3..64cb111 100644 --- a/GPX/GPXTrackSegment.m +++ b/GPX/GPXTrackSegment.m @@ -51,7 +51,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent #pragma mark - Public methods -- (GPXTrackPoint *)newTrackpointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude +- (GPXTrackPoint *)newTrackpointWithLatitude:(double)latitude longitude:(double)longitude { GPXTrackPoint *trackpoint = [GPXTrackPoint trackpointWithLatitude:latitude longitude:longitude]; [self addTrackpoint:trackpoint]; diff --git a/GPX/GPXType.h b/GPX/GPXType.h index 6d0c0df..0f87314 100644 --- a/GPX/GPXType.h +++ b/GPX/GPXType.h @@ -19,41 +19,41 @@ typedef NS_ENUM(NSInteger, GPXFix) { */ @interface GPXType : NSObject -/** Return the CGFloat object from a given string. - @param value The string which to convert CGFloat. A value ≥−90 and ≤90. +/** Return the double object from a given string. + @param value The string which to convert double. A value ≥−90 and ≤90. @return A CGFloat from a value. */ -+ (CGFloat)latitude:(NSString *)value; ++ (double)latitude:(NSString *)value; -/** Return the NSString object from a given CGFloat. - @param latitude The CGFloat which to convert NSString. A value ≥−90 and ≤90. +/** Return the NSString object from a given double. + @param latitude The double which to convert NSString. A value ≥−90 and ≤90. @return A NSString from a latitude. */ -+ (NSString *)valueForLatitude:(CGFloat)latitude; ++ (NSString *)valueForLatitude:(double)latitude; -/** Return the CGFloat object from a given string. - @param value The string which to convert CGFloat. A value ≥−180 and ≤180. +/** Return the double object from a given string. + @param value The string which to convert double. A value ≥−180 and ≤180. @return A CGFloat from a value. */ -+ (CGFloat)longitude:(NSString *)value; ++ (double)longitude:(NSString *)value; -/** Return the NSString object from a given CGFloat. - @param longitude The CGFloat which to convert NSString. A value ≥−180 and ≤180. +/** Return the NSString object from a given double. + @param longitude The double which to convert NSString. A value ≥−180 and ≤180. @return A NSString from a longitude. */ -+ (NSString *)valueForLongitude:(CGFloat)longitude; ++ (NSString *)valueForLongitude:(double)longitude; -/** Return the CGFloat object from a given string. - @param value The string which to convert CGFloat. A value ≥0 and ≤360. +/** Return the double object from a given string. + @param value The string which to convert double. A value ≥0 and ≤360. @return A CGFloat from a value. */ -+ (CGFloat)degress:(NSString *)value; ++ (double)degress:(NSString *)value; -/** Return the NSString object from a given CGFloat. - @param degress The CGFloat which to convert NSString. A value ≥0 and ≤360. +/** Return the NSString object from a given double. + @param degress The double which to convert NSString. A value ≥0 and ≤360. @return A NSString from a degress. */ -+ (NSString *)valueForDegress:(CGFloat)degress; ++ (NSString *)valueForDegress:(double)degress; /** Return the GPXFix from a given string. @param value The string which to convert GPXFix. @@ -79,17 +79,17 @@ typedef NS_ENUM(NSInteger, GPXFix) { */ + (NSString *)valueForDgpsStation:(NSInteger)dgpsStation; -/** Return the CGFloat object from a given string. - @param value The string which to convert CGFloat. - @return A CGFloat from a value. +/** Return the double object from a given string. + @param value The string which to convert double. + @return A double from a value. */ -+ (CGFloat)decimal:(NSString *)value; ++ (double)decimal:(NSString *)value; -/** Return the NSString object from a given CGFloat. - @param decimal The CGFloat which to convert NSString. +/** Return the NSString object from a given double. + @param decimal The double which to convert NSString. @return A NSString from a decimal. */ -+ (NSString *)valueForDecimal:(CGFloat)decimal; ++ (NSString *)valueForDecimal:(double)decimal; /** Return the NSDate object from a given string. diff --git a/GPX/GPXType.m b/GPX/GPXType.m index b956fcf..89d8284 100644 --- a/GPX/GPXType.m +++ b/GPX/GPXType.m @@ -10,12 +10,12 @@ @implementation GPXType -+ (CGFloat)latitude:(NSString *)value ++ (double)latitude:(NSString *)value { @try { - CGFloat f = [value floatValue]; - if (-90.f <= f && f <= 90.f) { - return f; + double d = [value doubleValue]; + if (-90.f <= d && d <= 90.f) { + return d; } } @catch (NSException *exception) { @@ -24,7 +24,7 @@ + (CGFloat)latitude:(NSString *)value return 0.f; } -+ (NSString *)valueForLatitude:(CGFloat)latitude ++ (NSString *)valueForLatitude:(double)latitude { if (-90.f <= latitude && latitude <= 90.f) { return [NSString stringWithFormat:@"%f", latitude]; @@ -33,12 +33,12 @@ + (NSString *)valueForLatitude:(CGFloat)latitude return @"0"; } -+ (CGFloat)longitude:(NSString *)value ++ (double)longitude:(NSString *)value { @try { - CGFloat f = [value floatValue]; - if (-180.f <= f && f <= 180.f) { - return f; + double d = [value doubleValue]; + if (-180.f <= d && d <= 180.f) { + return d; } } @catch (NSException *exception) { @@ -47,7 +47,7 @@ + (CGFloat)longitude:(NSString *)value return 0.f; } -+ (NSString *)valueForLongitude:(CGFloat)longitude ++ (NSString *)valueForLongitude:(double)longitude { if (-180.f <= longitude && longitude <= 180.f) { return [NSString stringWithFormat:@"%f", longitude]; @@ -56,12 +56,12 @@ + (NSString *)valueForLongitude:(CGFloat)longitude return @"0"; } -+ (CGFloat)degress:(NSString *)value ++ (double)degress:(NSString *)value { @try { - CGFloat f = [value floatValue]; - if (0.f <= f && f <= 360.f) { - return f; + double d = [value doubleValue]; + if (0.f <= d && d <= 360.f) { + return d; } } @catch (NSException *exception) { @@ -70,7 +70,7 @@ + (CGFloat)degress:(NSString *)value return 0.f; } -+ (NSString *)valueForDegress:(CGFloat)degress ++ (NSString *)valueForDegress:(double)degress { if (0.0f <= degress && degress <= 360.f) { return [NSString stringWithFormat:@"%f", degress]; @@ -138,11 +138,11 @@ + (NSString *)valueForDgpsStation:(NSInteger)dgpsStation return @"0"; } -+ (CGFloat)decimal:(NSString *)value ++ (double)decimal:(NSString *)value { @try { - CGFloat f = [value floatValue]; - return f; + double d = [value doubleValue]; + return d; } @catch (NSException *exception) { } @@ -150,7 +150,7 @@ + (CGFloat)decimal:(NSString *)value return 0; } -+ (NSString *)valueForDecimal:(CGFloat)decimal ++ (NSString *)valueForDecimal:(double)decimal { return [NSString stringWithFormat:@"%f", decimal]; diff --git a/GPX/GPXWaypoint.h b/GPX/GPXWaypoint.h index 22fc8f0..91081f6 100644 --- a/GPX/GPXWaypoint.h +++ b/GPX/GPXWaypoint.h @@ -22,7 +22,7 @@ /// --------------------------------- /** Elevation (in meters) of the point. */ -@property (nonatomic, assign) CGFloat elevation; +@property (nonatomic, assign) double elevation; /** Creation/modification timestamp for element. Date and time in are in Univeral Coordinated Time (UTC), not local time! @@ -31,10 +31,10 @@ @property (strong, nonatomic) NSDate *time; /** Magnetic variation (in degrees) at the point */ -@property (nonatomic, assign) CGFloat magneticVariation; +@property (nonatomic, assign) double magneticVariation; /** Height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message. */ -@property (nonatomic, assign) CGFloat geoidHeight; +@property (nonatomic, assign) double geoidHeight; /** The GPS name of the waypoint. This field will be transferred to and from the GPS. GPX does not place restrictions on the length of this field or the characters contained in it. @@ -68,16 +68,16 @@ @property (nonatomic, assign) NSInteger satellites; /** Horizontal dilution of precision. */ -@property (nonatomic, assign) CGFloat horizontalDilution; +@property (nonatomic, assign) double horizontalDilution; /** Vertical dilution of precision. */ -@property (nonatomic, assign) CGFloat verticalDilution; +@property (nonatomic, assign) double verticalDilution; /** Position dilution of precision. */ -@property (nonatomic, assign) CGFloat positionDilution; +@property (nonatomic, assign) double positionDilution; /** Number of seconds since last DGPS update. */ -@property (nonatomic, assign) CGFloat ageOfDGPSData; +@property (nonatomic, assign) double ageOfDGPSData; /** ID of DGPS station used in differential correction. */ @property (nonatomic, assign) NSInteger DGPSid; @@ -86,10 +86,10 @@ @property (strong, nonatomic) GPXExtensions *extensions; /** The latitude of the point. Decimal degrees, WGS84 datum. */ -@property (nonatomic, assign) CGFloat latitude; +@property (nonatomic, assign) double latitude; /** The longitude of the point. Decimal degrees, WGS84 datum. */ -@property (nonatomic, assign) CGFloat longitude; +@property (nonatomic, assign) double longitude; /// --------------------------------- @@ -101,7 +101,7 @@ @param longitude The longitude of the point. @return A newly created waypoint element. */ -+ (GPXWaypoint *)waypointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude; ++ (GPXWaypoint *)waypointWithLatitude:(double)latitude longitude:(double)longitude; /// --------------------------------- diff --git a/GPX/GPXWaypoint.m b/GPX/GPXWaypoint.m index 6f06aef..6ad3128 100644 --- a/GPX/GPXWaypoint.m +++ b/GPX/GPXWaypoint.m @@ -92,7 +92,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent return self; } -+ (GPXWaypoint *)waypointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude ++ (GPXWaypoint *)waypointWithLatitude:(double)latitude longitude:(double)longitude { GPXWaypoint *waypoint = [GPXWaypoint new]; waypoint.latitude = latitude; @@ -103,12 +103,12 @@ + (GPXWaypoint *)waypointWithLatitude:(CGFloat)latitude longitude:(CGFloat)longi #pragma mark - Public methods -- (CGFloat)elevation +- (double)elevation { return [GPXType decimal:_elevationValue]; } -- (void)setElevation:(CGFloat)elevation +- (void)setElevation:(double)elevation { _elevationValue = [GPXType valueForDecimal:elevation]; } @@ -123,22 +123,22 @@ - (void)setTime:(NSDate *)time _timeValue = [GPXType valueForDateTime:time]; } -- (CGFloat)magneticVariation +- (double)magneticVariation { return [GPXType degress:_magneticVariationValue]; } -- (void)setMagneticVariation:(CGFloat)magneticVariation +- (void)setMagneticVariation:(double)magneticVariation { _magneticVariationValue = [GPXType valueForDegress:magneticVariation]; } -- (CGFloat)geoidHeight +- (double)geoidHeight { return [GPXType decimal:_geoidHeightValue]; } -- (void)setGeoidHeight:(CGFloat)geoidHeight +- (void)setGeoidHeight:(double)geoidHeight { _geoidHeightValue = [GPXType valueForDecimal:geoidHeight]; } @@ -197,42 +197,42 @@ - (void)setSatellites:(NSInteger)satellites _satellitesValue = [GPXType valueForNonNegativeInteger:satellites]; } -- (CGFloat)horizontalDilution +- (double)horizontalDilution { return [GPXType decimal:_horizontalDilutionValue]; } -- (void)setHorizontalDilution:(CGFloat)horizontalDilution +- (void)setHorizontalDilution:(double)horizontalDilution { _horizontalDilutionValue = [GPXType valueForDecimal:horizontalDilution]; } -- (CGFloat)verticalDilution +- (double)verticalDilution { return [GPXType decimal:_verticalDilutionValue]; } -- (void)setVerticalDilution:(CGFloat)verticalDilution +- (void)setVerticalDilution:(double)verticalDilution { _verticalDilutionValue = [GPXType valueForDecimal:verticalDilution]; } -- (CGFloat)positionDilution +- (double)positionDilution { return [GPXType decimal:_positionDilutionValue]; } -- (void)setPositionDilution:(CGFloat)positionDilution +- (void)setPositionDilution:(double)positionDilution { _positionDilutionValue = [GPXType valueForDecimal:positionDilution]; } -- (CGFloat)ageOfDGPSData +- (double)ageOfDGPSData { return [GPXType decimal:_ageOfDGPSDataValue]; } -- (void)setAgeOfDGPSData:(CGFloat)ageOfDGPSData +- (void)setAgeOfDGPSData:(double)ageOfDGPSData { _ageOfDGPSDataValue = [GPXType valueForDecimal:ageOfDGPSData]; } @@ -252,17 +252,17 @@ - (CGFloat)latitude return [GPXType latitude:_latitudeValue]; } -- (void)setLatitude:(CGFloat)latitude +- (void)setLatitude:(double)latitude { _latitudeValue = [GPXType valueForLatitude:latitude]; } -- (CGFloat)longitude +- (double)longitude { return [GPXType longitude:_longitudeValue]; } -- (void)setLongitude:(CGFloat)longitude +- (void)setLongitude:(double)longitude { _longitudeValue = [GPXType valueForLongitude:longitude]; } From e4fa74ccf4cdc067176f1d6553a54ffe1c9b6254 Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Sun, 18 Jun 2017 23:56:35 +0300 Subject: [PATCH 4/8] Add speed and course to extensions --- GPX/GPXExtensions.h | 6 ++++++ GPX/GPXExtensions.m | 30 +++++++++++++++++++++++++++++- GPX/GPXWaypoint.m | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/GPX/GPXExtensions.h b/GPX/GPXExtensions.h index 0ebc342..9839e9d 100644 --- a/GPX/GPXExtensions.h +++ b/GPX/GPXExtensions.h @@ -13,4 +13,10 @@ */ @interface GPXExtensions : GPXElement +/** Waypoint speed in meters per second. */ +@property (nonatomic, assign) double speed; + +/** Waypoint travel direction. */ +@property (nonatomic, assign) double course; + @end diff --git a/GPX/GPXExtensions.m b/GPX/GPXExtensions.m index 7fed5e0..f46b202 100644 --- a/GPX/GPXExtensions.m +++ b/GPX/GPXExtensions.m @@ -9,7 +9,13 @@ #import "GPXExtensions.h" #import "GPXElementSubclass.h" -@implementation GPXExtensions +@implementation GPXExtensions { + NSString *_speedValue; + NSString *_courseValue; +} + +@synthesize speed = _speed; +@synthesize course = _course; #pragma mark - Instance @@ -17,6 +23,8 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent { self = [super initWithXMLElement:element parent:parent]; if (self) { + _speedValue = [self textForSingleChildElementNamed:@"speed" xmlElement:element]; + _courseValue = [self textForSingleChildElementNamed:@"course" xmlElement:element]; } return self; } @@ -24,7 +32,25 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent #pragma mark - Public methods +- (double)speed +{ + return [GPXType valueForDecimal:_speedValue]; +} + +- (void)setSpeed:(double)speed +{ + _speedValue = [GPXType valueForDecimal:speed]; +} + +- (double)course +{ + return [GPXType valueForDecimal:_courseValue]; +} +- (void)setCourse:(double)course +{ + _courseValue = [GPXType valueForDecimal:course]; +} #pragma mark - tag @@ -40,6 +66,8 @@ - (void)addChildTagToGpx:(NSMutableString *)gpx indentationLevel:(NSInteger)inde { [super addChildTagToGpx:gpx indentationLevel:indentationLevel]; + [self gpx:gpx addPropertyForValue:_speedValue tagName:@"speed" indentationLevel:indentationLevel]; + [self gpx:gpx addPropertyForValue:_courseValue tagName:@"course" indentationLevel:indentationLevel]; } @end diff --git a/GPX/GPXWaypoint.m b/GPX/GPXWaypoint.m index 6ad3128..a924973 100644 --- a/GPX/GPXWaypoint.m +++ b/GPX/GPXWaypoint.m @@ -247,7 +247,7 @@ - (void)setDGPSid:(NSInteger)DGPSid _DGPSidValue = [GPXType valueForDgpsStation:DGPSid]; } -- (CGFloat)latitude +- (double)latitude { return [GPXType latitude:_latitudeValue]; } From db422f9e4bf04e811fcd3351daaab86c161a4351 Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Mon, 19 Jun 2017 00:00:46 +0300 Subject: [PATCH 5/8] Fixes --- GPX/GPXExtensions.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPX/GPXExtensions.m b/GPX/GPXExtensions.m index f46b202..cc2cd68 100644 --- a/GPX/GPXExtensions.m +++ b/GPX/GPXExtensions.m @@ -34,7 +34,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent - (double)speed { - return [GPXType valueForDecimal:_speedValue]; + return [GPXType decimal:_speedValue]; } - (void)setSpeed:(double)speed @@ -44,7 +44,7 @@ - (void)setSpeed:(double)speed - (double)course { - return [GPXType valueForDecimal:_courseValue]; + return [GPXType decimal:_courseValue]; } - (void)setCourse:(double)course From 8944a6c17ea9d33c39800dffd801078da249362a Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Mon, 19 Jun 2017 00:08:49 +0300 Subject: [PATCH 6/8] Additions --- GPX/GPXExtensions.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GPX/GPXExtensions.m b/GPX/GPXExtensions.m index cc2cd68..c131697 100644 --- a/GPX/GPXExtensions.m +++ b/GPX/GPXExtensions.m @@ -34,6 +34,9 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent - (double)speed { + if (!_speedValue) { + return -1; + } return [GPXType decimal:_speedValue]; } @@ -44,6 +47,9 @@ - (void)setSpeed:(double)speed - (double)course { + if (!_courseValue) { + return -1; + } return [GPXType decimal:_courseValue]; } From e19735afbf19a586f983b2324794a793b0acd8a4 Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Thu, 21 Jun 2018 13:15:26 -0700 Subject: [PATCH 7/8] Adding the `activity` extension --- GPX/GPXExtensions.h | 3 +++ GPX/GPXExtensions.m | 3 +++ 2 files changed, 6 insertions(+) diff --git a/GPX/GPXExtensions.h b/GPX/GPXExtensions.h index 9839e9d..fe3caad 100644 --- a/GPX/GPXExtensions.h +++ b/GPX/GPXExtensions.h @@ -19,4 +19,7 @@ /** Waypoint travel direction. */ @property (nonatomic, assign) double course; +/** Waypoint activity. */ +@property (strong, nonatomic) NSString *activity; + @end diff --git a/GPX/GPXExtensions.m b/GPX/GPXExtensions.m index c131697..9c5a7c6 100644 --- a/GPX/GPXExtensions.m +++ b/GPX/GPXExtensions.m @@ -16,6 +16,7 @@ @implementation GPXExtensions { @synthesize speed = _speed; @synthesize course = _course; +@synthesize activity = _activity; #pragma mark - Instance @@ -25,6 +26,7 @@ - (id)initWithXMLElement:(TBXMLElement *)element parent:(GPXElement *)parent if (self) { _speedValue = [self textForSingleChildElementNamed:@"speed" xmlElement:element]; _courseValue = [self textForSingleChildElementNamed:@"course" xmlElement:element]; + _activity = [self textForSingleChildElementNamed:@"activity" xmlElement:element]; } return self; } @@ -74,6 +76,7 @@ - (void)addChildTagToGpx:(NSMutableString *)gpx indentationLevel:(NSInteger)inde [self gpx:gpx addPropertyForValue:_speedValue tagName:@"speed" indentationLevel:indentationLevel]; [self gpx:gpx addPropertyForValue:_courseValue tagName:@"course" indentationLevel:indentationLevel]; + [self gpx:gpx addPropertyForValue:_activity tagName:@"activity" indentationLevel:indentationLevel]; } @end From 0a61cc1b8c41dd67e8e0b41870260ea392f281b7 Mon Sep 17 00:00:00 2001 From: Daniel Tsirulnikov Date: Thu, 21 Jun 2018 13:17:31 -0700 Subject: [PATCH 8/8] Updated pod version --- iOS-GPX-Framework.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS-GPX-Framework.podspec b/iOS-GPX-Framework.podspec index fa018ed..a919f1b 100644 --- a/iOS-GPX-Framework.podspec +++ b/iOS-GPX-Framework.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "iOS-GPX-Framework" - s.version = "0.0.4" + s.version = "0.0.5" s.summary = "The iOS framework for parsing/generating GPX files. (@merlos fork)" s.description = <<-DESC This is a iOS framework for parsing/generating GPX files.