Parse HFDTE record before the others H records

ol.format.IGC.H_RECORD_RE_ don't match HFDTE records (because of the ':').
This commit is contained in:
Frederic Junod
2013-12-19 13:45:23 +01:00
parent 979083bb21
commit 1f0c70fec3

View File

@@ -127,14 +127,16 @@ ol.format.IGC.prototype.readFeatureFromText = function(text) {
flatCoordinates.push(date.getTime() / 1000); flatCoordinates.push(date.getTime() / 1000);
} }
} else if (line.charAt(0) == 'H') { } else if (line.charAt(0) == 'H') {
m = ol.format.IGC.H_RECORD_RE_.exec(line); m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line);
if (m) { if (m) {
properties[m[1]] = goog.string.trim(m[2]); day = parseInt(m[1], 10);
m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line); month = parseInt(m[2], 10);
year = 2000 + parseInt(m[3], 10);
} else {
m = ol.format.IGC.H_RECORD_RE_.exec(line);
if (m) { if (m) {
day = parseInt(m[1], 10); properties[m[1]] = goog.string.trim(m[2]);
month = parseInt(m[2], 10); m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line);
year = 2000 + parseInt(m[3], 10);
} }
} }
} }