Parse coordinates in GML in a single pass
This commit is contained in:
@@ -680,8 +680,18 @@ ol.format.GML.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} Flat coordinates.
|
||||
*/
|
||||
ol.format.GML.readFlatPos_ = function(node, objectStack) {
|
||||
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
var flatCoordinates = goog.array.map(s.split(/\s+/), parseFloat);
|
||||
var s = ol.xml.getAllTextContent(node, false);
|
||||
var re = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*/;
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = [];
|
||||
var m;
|
||||
while ((m = re.exec(s))) {
|
||||
flatCoordinates.push(parseFloat(m[1]));
|
||||
s = s.substr(m[0].length);
|
||||
}
|
||||
if (s !== '') {
|
||||
return undefined;
|
||||
}
|
||||
var context = objectStack[0];
|
||||
goog.asserts.assert(goog.isObject(context));
|
||||
var containerSrs = goog.object.get(context, 'srsName');
|
||||
|
||||
Reference in New Issue
Block a user