Rename ol.format.IGCZ to ol.format.IGC.Z

This commit is contained in:
Frederic Junod
2016-08-29 09:14:39 +02:00
committed by Tim Schaub
parent d0801036d2
commit 11c8b99602
3 changed files with 20 additions and 20 deletions
+1
View File
@@ -10,6 +10,7 @@ A number of internal types have been renamed. This will not affect those who us
* rename `ol.style.IconAnchorUnits` to `ol.style.Icon.AnchorUnits` * rename `ol.style.IconAnchorUnits` to `ol.style.Icon.AnchorUnits`
* rename `ol.style.IconOrigin` to `ol.style.Icon.Origin` * rename `ol.style.IconOrigin` to `ol.style.Icon.Origin`
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
### v3.18.0 ### v3.18.0
+2 -2
View File
@@ -1791,7 +1791,7 @@ olx.format.TopoJSONOptions.prototype.defaultDataProjection;
/** /**
* @typedef {{altitudeMode: (ol.format.IGCZ|undefined)}} * @typedef {{altitudeMode: (ol.format.IGC.Z|undefined)}}
*/ */
olx.format.IGCOptions; olx.format.IGCOptions;
@@ -1799,7 +1799,7 @@ olx.format.IGCOptions;
/** /**
* Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default * Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default
* is `none`. * is `none`.
* @type {ol.format.IGCZ|undefined} * @type {ol.format.IGC.Z|undefined}
* @api * @api
*/ */
olx.format.IGCOptions.prototype.altitudeMode; olx.format.IGCOptions.prototype.altitudeMode;
+17 -18
View File
@@ -1,5 +1,4 @@
goog.provide('ol.format.IGC'); goog.provide('ol.format.IGC');
goog.provide('ol.format.IGCZ');
goog.require('ol'); goog.require('ol');
goog.require('ol.Feature'); goog.require('ol.Feature');
@@ -10,17 +9,6 @@ goog.require('ol.geom.LineString');
goog.require('ol.proj'); goog.require('ol.proj');
/**
* IGC altitude/z. One of 'barometric', 'gps', 'none'.
* @enum {string}
*/
ol.format.IGCZ = {
BAROMETRIC: 'barometric',
GPS: 'gps',
NONE: 'none'
};
/** /**
* @classdesc * @classdesc
* Feature format for `*.igc` flight recording files. * Feature format for `*.igc` flight recording files.
@@ -43,10 +31,10 @@ ol.format.IGC = function(opt_options) {
/** /**
* @private * @private
* @type {ol.format.IGCZ} * @type {ol.format.IGC.Z}
*/ */
this.altitudeMode_ = options.altitudeMode ? this.altitudeMode_ = options.altitudeMode ?
options.altitudeMode : ol.format.IGCZ.NONE; options.altitudeMode : ol.format.IGC.Z.NONE;
}; };
ol.inherits(ol.format.IGC, ol.format.TextFeature); ol.inherits(ol.format.IGC, ol.format.TextFeature);
@@ -147,11 +135,11 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
x = -x; x = -x;
} }
flatCoordinates.push(x, y); flatCoordinates.push(x, y);
if (altitudeMode != ol.format.IGCZ.NONE) { if (altitudeMode != ol.format.IGC.Z.NONE) {
var z; var z;
if (altitudeMode == ol.format.IGCZ.GPS) { if (altitudeMode == ol.format.IGC.Z.GPS) {
z = parseInt(m[11], 10); z = parseInt(m[11], 10);
} else if (altitudeMode == ol.format.IGCZ.BAROMETRIC) { } else if (altitudeMode == ol.format.IGC.Z.BAROMETRIC) {
z = parseInt(m[12], 10); z = parseInt(m[12], 10);
} else { } else {
ol.DEBUG && console.assert(false, 'Unknown altitude mode.'); ol.DEBUG && console.assert(false, 'Unknown altitude mode.');
@@ -185,7 +173,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
return null; return null;
} }
var lineString = new ol.geom.LineString(null); var lineString = new ol.geom.LineString(null);
var layout = altitudeMode == ol.format.IGCZ.NONE ? var layout = altitudeMode == ol.format.IGC.Z.NONE ?
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM; ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates); lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new ol.Feature(ol.format.Feature.transformWithOptions( var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
@@ -230,3 +218,14 @@ ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
* @api * @api
*/ */
ol.format.IGC.prototype.readProjection; ol.format.IGC.prototype.readProjection;
/**
* IGC altitude/z. One of 'barometric', 'gps', 'none'.
* @enum {string}
*/
ol.format.IGC.Z = {
BAROMETRIC: 'barometric',
GPS: 'gps',
NONE: 'none'
};