From 1f0c70fec38b04f0e81f431ac2946dc46bbd2ce1 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 19 Dec 2013 13:45:23 +0100 Subject: [PATCH] Parse HFDTE record before the others H records ol.format.IGC.H_RECORD_RE_ don't match HFDTE records (because of the ':'). --- src/ol/format/igcformat.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ol/format/igcformat.js b/src/ol/format/igcformat.js index 4ebefe6f43..257d981770 100644 --- a/src/ol/format/igcformat.js +++ b/src/ol/format/igcformat.js @@ -127,14 +127,16 @@ ol.format.IGC.prototype.readFeatureFromText = function(text) { flatCoordinates.push(date.getTime() / 1000); } } 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) { - properties[m[1]] = goog.string.trim(m[2]); - m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line); + day = parseInt(m[1], 10); + month = parseInt(m[2], 10); + year = 2000 + parseInt(m[3], 10); + } else { + m = ol.format.IGC.H_RECORD_RE_.exec(line); if (m) { - day = parseInt(m[1], 10); - month = parseInt(m[2], 10); - year = 2000 + parseInt(m[3], 10); + properties[m[1]] = goog.string.trim(m[2]); + m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line); } } }