UNPKG

tcx-builder

Version:
62 lines (61 loc) 2.83 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 TrackPoint = /** @class */ (function (_super) { __extends(TrackPoint, _super); function TrackPoint(options) { var _this = _super.call(this) || this; _this.Time = options.time; _this.Position = options.position; _this.AltitudeMeters = options.altitudeMeters; _this.DistanceMeters = options.distanceMeters; _this.HeartRateBpm = options.heartRateBpm; _this.Cadence = options.cadence; _this.SensorState = options.sensorState; _this.Extensions = options.extensions; return _this; } TrackPoint.prototype.toXml = function () { var xmlElement = ''; xmlElement += _common_1.BaseObject.buildXmlNode('Time', this.Time.toISOString()); if (!lodash_1.isNil(this.Position)) { xmlElement += _common_1.BaseObject.buildXmlNode('Position', this.Position.toXml()); } if (!lodash_1.isNil(this.AltitudeMeters)) { xmlElement += _common_1.BaseObject.buildXmlNode('AltitudeMeters', this.AltitudeMeters.toString()); } if (!lodash_1.isNil(this.DistanceMeters)) { xmlElement += _common_1.BaseObject.buildXmlNode('DistanceMeters', this.DistanceMeters.toString()); } if (!lodash_1.isNil(this.HeartRateBpm)) { xmlElement += _common_1.BaseObject.buildXmlNode('HeartRateBpm', this.HeartRateBpm.toXml()); } if (!lodash_1.isNil(this.Cadence)) { xmlElement += _common_1.BaseObject.buildXmlNode('Cadence', this.Cadence.toString()); } if (!lodash_1.isNil(this.SensorState)) { xmlElement += _common_1.BaseObject.buildXmlNode('SensorState', this.SensorState); } if (!lodash_1.isNil(this.Extensions)) { var tpxExtension = _common_1.BaseObject.buildXmlNode('TPX', this.Extensions.toXml(), this.Extensions.attributes); xmlElement += _common_1.BaseObject.buildXmlNode('Extensions', tpxExtension); } return xmlElement; }; return TrackPoint; }(_common_1.BaseObject)); exports.TrackPoint = TrackPoint;