UNPKG

tcx-builder

Version:
62 lines (61 loc) 3.12 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var _common_1 = require("../_common"); var lodash_1 = require("lodash"); var CourseLap = /** @class */ (function (_super) { __extends(CourseLap, _super); function CourseLap(options) { var _this = _super.call(this) || this; _this.TotalTimeSeconds = options.totalTimeSeconds; _this.DistanceMeters = options.distanceMeters; _this.BeginPosition = options.beginPosition; _this.BeginAltitudeMeters = options.beginAltitudeMeters; _this.EndPosition = options.endPosition; _this.EndAltitudeMeters = options.endAltitudeMeters; _this.AverageHeartRateBpm = options.averageHeartRateBpm; _this.MaximumHeartRateBpm = options.maximumHeartRateBpm; _this.Intensity = options.intensity; _this.Cadence = options.cadence; return _this; } CourseLap.prototype.toXml = function () { var xmlElement = ''; xmlElement += _common_1.BaseObject.buildXmlNode('TotalTimeSeconds', this.TotalTimeSeconds.toString()); xmlElement += _common_1.BaseObject.buildXmlNode('DistanceMeters', this.DistanceMeters.toString()); if (!lodash_1.isNil(this.BeginPosition)) { xmlElement += _common_1.BaseObject.buildXmlNode('BeginPosition', this.BeginPosition.toXml()); } if (!lodash_1.isNil(this.BeginAltitudeMeters)) { xmlElement += _common_1.BaseObject.buildXmlNode('BeginAltitudeMeters', this.BeginAltitudeMeters.toString()); } if (!lodash_1.isNil(this.EndPosition)) { xmlElement += _common_1.BaseObject.buildXmlNode('EndPosition', this.EndPosition.toXml()); } if (!lodash_1.isNil(this.EndAltitudeMeters)) { xmlElement += _common_1.BaseObject.buildXmlNode('EndAltitudeMeters', this.EndAltitudeMeters.toString()); } if (!lodash_1.isNil(this.AverageHeartRateBpm)) { xmlElement += _common_1.BaseObject.buildXmlNode('AverageHeartRateBpm', this.AverageHeartRateBpm.toXml(), this.AverageHeartRateBpm.attributes); } if (!lodash_1.isNil(this.MaximumHeartRateBpm)) { xmlElement += _common_1.BaseObject.buildXmlNode('MaximumHeartRateBpm', this.MaximumHeartRateBpm.toXml(), this.MaximumHeartRateBpm.attributes); } xmlElement += _common_1.BaseObject.buildXmlNode('Intensity', this.Intensity); return xmlElement; }; return CourseLap; }(_common_1.BaseObject)); exports.CourseLap = CourseLap;