mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-03 19:33:49 +00:00
[ios] replase ints/doubles with string for track stats in ios
to pass already formatted by the core values instead of formatting them later using the same core formatters Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
f8996feb88
commit
2861d9db2a
@@ -4,14 +4,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TrackInfo : NSObject
|
||||
|
||||
@property (nonatomic, readonly) double distance;
|
||||
@property (nonatomic, readonly) double duration;
|
||||
@property (nonatomic, readonly) NSUInteger ascent;
|
||||
@property (nonatomic, readonly) NSUInteger descent;
|
||||
@property (nonatomic, readonly) NSUInteger maxElevation;
|
||||
@property (nonatomic, readonly) NSUInteger minElevation;
|
||||
@property (nonatomic, readonly) NSString * distance;
|
||||
@property (nonatomic, readonly) NSString * duration;
|
||||
@property (nonatomic, readonly) NSString * ascent;
|
||||
@property (nonatomic, readonly) NSString * descent;
|
||||
@property (nonatomic, readonly) NSString * maxElevation;
|
||||
@property (nonatomic, readonly) NSString * minElevation;
|
||||
|
||||
- (BOOL)hasElevationInfo;
|
||||
@property (nonatomic, readonly) BOOL hasElevationInfo;
|
||||
|
||||
+ (TrackInfo *)emptyInfo;
|
||||
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
#import "TrackInfo+Core.h"
|
||||
#import "AltitudeFormatter.h"
|
||||
#import "DistanceFormatter.h"
|
||||
#import "DurationFormatter.h"
|
||||
#import "StringUtils.h"
|
||||
|
||||
@implementation TrackInfo
|
||||
|
||||
- (BOOL)hasElevationInfo {
|
||||
return _ascent != 0 || _descent != 0 || _maxElevation != 0 || _minElevation != 0;
|
||||
}
|
||||
|
||||
+ (TrackInfo *)emptyInfo {
|
||||
return [[TrackInfo alloc] init];
|
||||
}
|
||||
@@ -19,12 +13,16 @@
|
||||
|
||||
- (instancetype)initWithTrackStatistics:(TrackStatistics const &)statistics {
|
||||
if (self = [super init]) {
|
||||
_distance = statistics.m_length;
|
||||
_duration = statistics.m_duration;
|
||||
_ascent = statistics.m_ascent;
|
||||
_descent = statistics.m_descent;
|
||||
_maxElevation = statistics.m_maxElevation;
|
||||
_minElevation = statistics.m_minElevation;
|
||||
_distance = ToNSString(statistics.GetFormattedLength());
|
||||
_duration = ToNSString(statistics.GetFormattedDuration());
|
||||
_ascent = ToNSString(statistics.GetFormattedAscent());
|
||||
_descent = ToNSString(statistics.GetFormattedDescent());
|
||||
_maxElevation = ToNSString(statistics.GetFormattedMaxElevation());
|
||||
_minElevation = ToNSString(statistics.GetFormattedMinElevation());
|
||||
_hasElevationInfo = statistics.m_ascent != 0 ||
|
||||
statistics.m_descent != 0 ||
|
||||
statistics.m_maxElevation != 0 ||
|
||||
statistics.m_minElevation != 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user