tcx-builder
Version:
42 lines (41 loc) • 1.81 kB
JavaScript
;
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 TrackPointExtensionsAttributes_1 = require("./TrackPointExtensionsAttributes");
var TrackPointExtensions = /** @class */ (function (_super) {
__extends(TrackPointExtensions, _super);
function TrackPointExtensions(options) {
var _this = _super.call(this) || this;
_this.attributes = new TrackPointExtensionsAttributes_1.TrackPointExtensionsAttributes();
_this.Speed = options.Speed;
_this.Watts = options.Watts;
return _this;
}
TrackPointExtensions.prototype.toXml = function () {
var xmlElement = '';
if (!lodash_1.isNil(this.Speed)) {
var speedInMetersPerSec = this.Speed / 3.6;
xmlElement += _common_1.BaseObject.buildXmlNode('Speed', speedInMetersPerSec.toString());
}
if (!lodash_1.isNil(this.Watts)) {
xmlElement += _common_1.BaseObject.buildXmlNode('Watts', this.Watts.toString());
}
return xmlElement;
};
return TrackPointExtensions;
}(_common_1.BaseObject));
exports.TrackPointExtensions = TrackPointExtensions;