Use ol.format.XSD.readDecimal in ol.format.KML
This commit is contained in:
@@ -364,22 +364,6 @@ ol.format.KML.readFlatCoordinates_ = function(node) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @private
|
||||
* @return {number|undefined}
|
||||
*/
|
||||
ol.format.KML.readNumber_ = function(node) {
|
||||
var s = ol.xml.getAllTextContent(node, false);
|
||||
var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(s);
|
||||
if (m) {
|
||||
return parseFloat(m[1]);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @private
|
||||
@@ -434,7 +418,7 @@ ol.format.KML.readVec2_ = function(node) {
|
||||
* @return {number|undefined} Scale.
|
||||
*/
|
||||
ol.format.KML.readScale_ = function(node) {
|
||||
var number = ol.format.KML.readNumber_(node);
|
||||
var number = ol.format.XSD.readDecimal(node);
|
||||
if (goog.isDef(number)) {
|
||||
return Math.sqrt(number);
|
||||
} else {
|
||||
@@ -1234,7 +1218,7 @@ ol.format.KML.ICON_PARSERS_ = ol.xml.makeParsersNS(
|
||||
ol.format.KML.ICON_STYLE_PARSERS_ = ol.xml.makeParsersNS(
|
||||
ol.format.KML.NAMESPACE_URIS_, {
|
||||
'Icon': ol.xml.makeObjectPropertySetter(ol.format.KML.readIcon_),
|
||||
'heading': ol.xml.makeObjectPropertySetter(ol.format.KML.readNumber_),
|
||||
'heading': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
|
||||
'hotSpot': ol.xml.makeObjectPropertySetter(ol.format.KML.readVec2_),
|
||||
'scale': ol.xml.makeObjectPropertySetter(ol.format.KML.readScale_)
|
||||
});
|
||||
@@ -1259,7 +1243,7 @@ ol.format.KML.INNER_BOUNDARY_IS_PARSERS_ = ol.xml.makeParsersNS(
|
||||
ol.format.KML.LINE_STYLE_PARSERS_ = ol.xml.makeParsersNS(
|
||||
ol.format.KML.NAMESPACE_URIS_, {
|
||||
'color': ol.xml.makeObjectPropertySetter(ol.format.KML.readColor_),
|
||||
'width': ol.xml.makeObjectPropertySetter(ol.format.KML.readNumber_)
|
||||
'width': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal)
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user