diff --git a/externs/olx.js b/externs/olx.js index 7b95c97a5b..364786b711 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -1538,7 +1538,7 @@ olx.format.TopoJSONOptions.prototype.layers; /** - * @typedef {{altitudeMode: (ol.format.IGCZ|undefined)}} + * @typedef {{altitudeMode: (ol.format.IGCZ|string|undefined)}} */ olx.format.IGCOptions; @@ -1546,7 +1546,7 @@ olx.format.IGCOptions; /** * Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default * is `none`. - * @type {ol.format.IGCZ|undefined} + * @type {ol.format.IGCZ|string|undefined} * @api */ olx.format.IGCOptions.prototype.altitudeMode; diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index 98f341b117..f67dee6d06 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -4,12 +4,21 @@ import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; -import _ol_format_IGCZ_ from '../format/IGCZ.js'; import TextFeature from '../format/TextFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import {get as getProjection} from '../proj.js'; +/** + * IGC altitude/z. One of 'barometric', 'gps', 'none'. + * @enum {string} + */ +var IGCZ = { + BAROMETRIC: 'barometric', + GPS: 'gps', + NONE: 'none' +}; + /** * @classdesc * Feature format for `*.igc` flight recording files. @@ -34,9 +43,7 @@ var IGC = function(opt_options) { * @private * @type {ol.format.IGCZ} */ - this.altitudeMode_ = options.altitudeMode ? - options.altitudeMode : _ol_format_IGCZ_.NONE; - + this.altitudeMode_ = options.altitudeMode ? options.altitudeMode : IGCZ.NONE; }; inherits(IGC, TextFeature); @@ -121,11 +128,11 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) { x = -x; } flatCoordinates.push(x, y); - if (altitudeMode != _ol_format_IGCZ_.NONE) { + if (altitudeMode != IGCZ.NONE) { var z; - if (altitudeMode == _ol_format_IGCZ_.GPS) { + if (altitudeMode == IGCZ.GPS) { z = parseInt(m[11], 10); - } else if (altitudeMode == _ol_format_IGCZ_.BAROMETRIC) { + } else if (altitudeMode == IGCZ.BAROMETRIC) { z = parseInt(m[12], 10); } else { z = 0; @@ -158,8 +165,7 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) { return null; } var lineString = new LineString(null); - var layout = altitudeMode == _ol_format_IGCZ_.NONE ? - GeometryLayout.XYM : GeometryLayout.XYZM; + var layout = altitudeMode == IGCZ.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM; lineString.setFlatCoordinates(layout, flatCoordinates); var feature = new _ol_Feature_(transformWithOptions(lineString, false, opt_options)); feature.setProperties(properties); diff --git a/src/ol/format/IGCZ.js b/src/ol/format/IGCZ.js deleted file mode 100644 index 4cc557be82..0000000000 --- a/src/ol/format/IGCZ.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module ol/format/IGCZ - */ - -/** - * IGC altitude/z. One of 'barometric', 'gps', 'none'. - * @enum {string} - */ -export default { - BAROMETRIC: 'barometric', - GPS: 'gps', - NONE: 'none' -};