Remove goog.isNull in format classes
This commit is contained in:
@@ -54,7 +54,7 @@ goog.inherits(ol.format.EsriJSON, ol.format.JSONFeature);
|
|||||||
* @return {ol.geom.Geometry} Geometry.
|
* @return {ol.geom.Geometry} Geometry.
|
||||||
*/
|
*/
|
||||||
ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
|
ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
|
||||||
if (goog.isNull(object)) {
|
if (!object) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var type;
|
var type;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ ol.format.Feature.transformWithOptions = function(
|
|||||||
ol.proj.get(opt_options.featureProjection) : null;
|
ol.proj.get(opt_options.featureProjection) : null;
|
||||||
var dataProjection = opt_options ?
|
var dataProjection = opt_options ?
|
||||||
ol.proj.get(opt_options.dataProjection) : null;
|
ol.proj.get(opt_options.dataProjection) : null;
|
||||||
if (!goog.isNull(featureProjection) && !goog.isNull(dataProjection) &&
|
if (featureProjection && dataProjection &&
|
||||||
!ol.proj.equivalent(featureProjection, dataProjection)) {
|
!ol.proj.equivalent(featureProjection, dataProjection)) {
|
||||||
if (geometry instanceof ol.geom.Geometry) {
|
if (geometry instanceof ol.geom.Geometry) {
|
||||||
return (write ? geometry.clone() : geometry).transform(
|
return (write ? geometry.clone() : geometry).transform(
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ ol.format.GeoJSON.EXTENSIONS_ = ['.geojson'];
|
|||||||
* @return {ol.geom.Geometry} Geometry.
|
* @return {ol.geom.Geometry} Geometry.
|
||||||
*/
|
*/
|
||||||
ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
|
ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
|
||||||
if (goog.isNull(object)) {
|
if (!object) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
|
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
|
||||||
|
|||||||
@@ -62,20 +62,20 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
|
|||||||
var containerSrs = context['srsName'];
|
var containerSrs = context['srsName'];
|
||||||
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (!goog.isNull(containerSrs)) {
|
if (containerSrs) {
|
||||||
var proj = ol.proj.get(containerSrs);
|
var proj = ol.proj.get(containerSrs);
|
||||||
axisOrientation = proj.getAxisOrientation();
|
axisOrientation = proj.getAxisOrientation();
|
||||||
}
|
}
|
||||||
var coords = s.split(/[\s,]+/);
|
var coords = s.split(/[\s,]+/);
|
||||||
// The "dimension" attribute is from the GML 3.0.1 spec.
|
// The "dimension" attribute is from the GML 3.0.1 spec.
|
||||||
var dim = 2;
|
var dim = 2;
|
||||||
if (!goog.isNull(node.getAttribute('srsDimension'))) {
|
if (node.getAttribute('srsDimension')) {
|
||||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||||
node.getAttribute('srsDimension'));
|
node.getAttribute('srsDimension'));
|
||||||
} else if (!goog.isNull(node.getAttribute('dimension'))) {
|
} else if (node.getAttribute('dimension')) {
|
||||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||||
node.getAttribute('dimension'));
|
node.getAttribute('dimension'));
|
||||||
} else if (!goog.isNull(containerDimension)) {
|
} else if (containerDimension) {
|
||||||
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
||||||
}
|
}
|
||||||
var x, y, z;
|
var x, y, z;
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) {
|
|||||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && !goog.isNull(flatLinearRings[0])) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new ol.geom.Polygon(null);
|
var polygon = new ol.geom.Polygon(null);
|
||||||
var flatCoordinates = flatLinearRings[0];
|
var flatCoordinates = flatLinearRings[0];
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
@@ -385,7 +385,7 @@ ol.format.GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var containerSrs = context['srsName'];
|
var containerSrs = context['srsName'];
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (!goog.isNull(containerSrs)) {
|
if (containerSrs) {
|
||||||
var proj = ol.proj.get(containerSrs);
|
var proj = ol.proj.get(containerSrs);
|
||||||
axisOrientation = proj.getAxisOrientation();
|
axisOrientation = proj.getAxisOrientation();
|
||||||
}
|
}
|
||||||
@@ -422,20 +422,20 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
|||||||
var containerSrs = context['srsName'];
|
var containerSrs = context['srsName'];
|
||||||
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (!goog.isNull(containerSrs)) {
|
if (containerSrs) {
|
||||||
var proj = ol.proj.get(containerSrs);
|
var proj = ol.proj.get(containerSrs);
|
||||||
axisOrientation = proj.getAxisOrientation();
|
axisOrientation = proj.getAxisOrientation();
|
||||||
}
|
}
|
||||||
var coords = s.split(/\s+/);
|
var coords = s.split(/\s+/);
|
||||||
// The "dimension" attribute is from the GML 3.0.1 spec.
|
// The "dimension" attribute is from the GML 3.0.1 spec.
|
||||||
var dim = 2;
|
var dim = 2;
|
||||||
if (!goog.isNull(node.getAttribute('srsDimension'))) {
|
if (node.getAttribute('srsDimension')) {
|
||||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||||
node.getAttribute('srsDimension'));
|
node.getAttribute('srsDimension'));
|
||||||
} else if (!goog.isNull(node.getAttribute('dimension'))) {
|
} else if (node.getAttribute('dimension')) {
|
||||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||||
node.getAttribute('dimension'));
|
node.getAttribute('dimension'));
|
||||||
} else if (!goog.isNull(containerDimension)) {
|
} else if (containerDimension) {
|
||||||
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
||||||
}
|
}
|
||||||
var x, y, z;
|
var x, y, z;
|
||||||
@@ -1067,7 +1067,7 @@ ol.format.GML3.prototype.writeFeatureElement =
|
|||||||
var keys = [], values = [];
|
var keys = [], values = [];
|
||||||
for (var key in properties) {
|
for (var key in properties) {
|
||||||
var value = properties[key];
|
var value = properties[key];
|
||||||
if (!goog.isNull(value)) {
|
if (value !== null) {
|
||||||
keys.push(key);
|
keys.push(key);
|
||||||
values.push(value);
|
values.push(value);
|
||||||
if (key == geometryName) {
|
if (key == geometryName) {
|
||||||
|
|||||||
@@ -199,8 +199,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
|||||||
var fid = node.getAttribute('fid') ||
|
var fid = node.getAttribute('fid') ||
|
||||||
ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
|
ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
|
||||||
var values = {}, geometryName;
|
var values = {}, geometryName;
|
||||||
for (n = node.firstElementChild; !goog.isNull(n);
|
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
n = n.nextElementSibling) {
|
|
||||||
var localName = ol.xml.getLocalName(n);
|
var localName = ol.xml.getLocalName(n);
|
||||||
// Assume attribute elements have one child node and that the child
|
// Assume attribute elements have one child node and that the child
|
||||||
// is a text or CDATA node (to be treated as text).
|
// is a text or CDATA node (to be treated as text).
|
||||||
@@ -449,8 +448,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
|||||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings &&
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
!goog.isNull(flatLinearRings[0])) {
|
|
||||||
var polygon = new ol.geom.Polygon(null);
|
var polygon = new ol.geom.Polygon(null);
|
||||||
var flatCoordinates = flatLinearRings[0];
|
var flatCoordinates = flatLinearRings[0];
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.localName == 'link', 'localName should be link');
|
goog.asserts.assert(node.localName == 'link', 'localName should be link');
|
||||||
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||||
var href = node.getAttribute('href');
|
var href = node.getAttribute('href');
|
||||||
if (!goog.isNull(href)) {
|
if (href !== null) {
|
||||||
values['link'] = href;
|
values['link'] = href;
|
||||||
}
|
}
|
||||||
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
|
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
|
||||||
@@ -417,7 +417,7 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
|
ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
|
||||||
if (goog.isNull(features)) {
|
if (!features) {
|
||||||
features = [];
|
features = [];
|
||||||
}
|
}
|
||||||
for (var i = 0, ii = features.length; i < ii; ++i) {
|
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ ol.format.IGC.prototype.readFeatures;
|
|||||||
*/
|
*/
|
||||||
ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
|
ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
|
||||||
var feature = this.readFeatureFromText(text, opt_options);
|
var feature = this.readFeatureFromText(text, opt_options);
|
||||||
if (!goog.isNull(feature)) {
|
if (feature) {
|
||||||
return [feature];
|
return [feature];
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -979,7 +979,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
|
|||||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||||
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
||||||
if (flatLinearRings && !goog.isNull(flatLinearRings[0])) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new ol.geom.Polygon(null);
|
var polygon = new ol.geom.Polygon(null);
|
||||||
var flatCoordinates = flatLinearRings[0];
|
var flatCoordinates = flatLinearRings[0];
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
@@ -1085,7 +1085,7 @@ ol.format.KML.DataParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Data', 'localName should be Data');
|
goog.asserts.assert(node.localName == 'Data', 'localName should be Data');
|
||||||
var name = node.getAttribute('name');
|
var name = node.getAttribute('name');
|
||||||
if (!goog.isNull(name)) {
|
if (name !== null) {
|
||||||
var data = ol.xml.pushParseAndPop(
|
var data = ol.xml.pushParseAndPop(
|
||||||
undefined, ol.format.KML.DATA_PARSERS_, node, objectStack);
|
undefined, ol.format.KML.DATA_PARSERS_, node, objectStack);
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -1196,7 +1196,7 @@ ol.format.KML.SimpleDataParser_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.localName == 'SimpleData',
|
goog.asserts.assert(node.localName == 'SimpleData',
|
||||||
'localName should be SimpleData');
|
'localName should be SimpleData');
|
||||||
var name = node.getAttribute('name');
|
var name = node.getAttribute('name');
|
||||||
if (!goog.isNull(name)) {
|
if (name !== null) {
|
||||||
var data = ol.format.XSD.readString(node);
|
var data = ol.format.XSD.readString(node);
|
||||||
var featureObject =
|
var featureObject =
|
||||||
/** @type {Object} */ (objectStack[objectStack.length - 1]);
|
/** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||||
@@ -1679,7 +1679,7 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) {
|
|||||||
}
|
}
|
||||||
var feature = new ol.Feature();
|
var feature = new ol.Feature();
|
||||||
var id = node.getAttribute('id');
|
var id = node.getAttribute('id');
|
||||||
if (!goog.isNull(id)) {
|
if (id !== null) {
|
||||||
feature.setId(id);
|
feature.setId(id);
|
||||||
}
|
}
|
||||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||||
@@ -1718,7 +1718,7 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Style', 'localName should be Style');
|
goog.asserts.assert(node.localName == 'Style', 'localName should be Style');
|
||||||
var id = node.getAttribute('id');
|
var id = node.getAttribute('id');
|
||||||
if (!goog.isNull(id)) {
|
if (id !== null) {
|
||||||
var style = ol.format.KML.readStyle_(node, objectStack);
|
var style = ol.format.KML.readStyle_(node, objectStack);
|
||||||
if (style) {
|
if (style) {
|
||||||
var styleUri;
|
var styleUri;
|
||||||
@@ -1744,7 +1744,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.localName == 'StyleMap',
|
goog.asserts.assert(node.localName == 'StyleMap',
|
||||||
'localName should be StyleMap');
|
'localName should be StyleMap');
|
||||||
var id = node.getAttribute('id');
|
var id = node.getAttribute('id');
|
||||||
if (goog.isNull(id)) {
|
if (id === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack);
|
var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack);
|
||||||
@@ -1836,8 +1836,7 @@ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
|||||||
} else if (localName == 'kml') {
|
} else if (localName == 'kml') {
|
||||||
features = [];
|
features = [];
|
||||||
var n;
|
var n;
|
||||||
for (n = node.firstElementChild; !goog.isNull(n);
|
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
n = n.nextElementSibling) {
|
|
||||||
var fs = this.readFeaturesFromNode(n, opt_options);
|
var fs = this.readFeaturesFromNode(n, opt_options);
|
||||||
if (fs) {
|
if (fs) {
|
||||||
goog.array.extend(features, fs);
|
goog.array.extend(features, fs);
|
||||||
@@ -1878,7 +1877,7 @@ ol.format.KML.prototype.readName = function(source) {
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.prototype.readNameFromDocument = function(doc) {
|
ol.format.KML.prototype.readNameFromDocument = function(doc) {
|
||||||
var n;
|
var n;
|
||||||
for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
var name = this.readNameFromNode(n);
|
var name = this.readNameFromNode(n);
|
||||||
if (name) {
|
if (name) {
|
||||||
@@ -1896,13 +1895,13 @@ ol.format.KML.prototype.readNameFromDocument = function(doc) {
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.prototype.readNameFromNode = function(node) {
|
ol.format.KML.prototype.readNameFromNode = function(node) {
|
||||||
var n;
|
var n;
|
||||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||||
n.localName == 'name') {
|
n.localName == 'name') {
|
||||||
return ol.format.XSD.readString(n);
|
return ol.format.XSD.readString(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
var localName = ol.xml.getLocalName(n);
|
var localName = ol.xml.getLocalName(n);
|
||||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||||
(localName == 'Document' ||
|
(localName == 'Document' ||
|
||||||
@@ -1950,7 +1949,7 @@ ol.format.KML.prototype.readNetworkLinks = function(source) {
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) {
|
ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) {
|
||||||
var n, networkLinks = [];
|
var n, networkLinks = [];
|
||||||
for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
||||||
}
|
}
|
||||||
@@ -1965,7 +1964,7 @@ ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) {
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
|
ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
|
||||||
var n, networkLinks = [];
|
var n, networkLinks = [];
|
||||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||||
n.localName == 'NetworkLink') {
|
n.localName == 'NetworkLink') {
|
||||||
var obj = ol.xml.pushParseAndPop({}, ol.format.KML.NETWORK_LINK_PARSERS_,
|
var obj = ol.xml.pushParseAndPop({}, ol.format.KML.NETWORK_LINK_PARSERS_,
|
||||||
@@ -1973,7 +1972,7 @@ ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
|
|||||||
networkLinks.push(obj);
|
networkLinks.push(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
var localName = ol.xml.getLocalName(n);
|
var localName = ol.xml.getLocalName(n);
|
||||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||||
(localName == 'Document' ||
|
(localName == 'Document' ||
|
||||||
@@ -2110,20 +2109,18 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
|
|||||||
'href': src
|
'href': src
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!goog.isNull(size)) {
|
if (size) {
|
||||||
iconProperties['w'] = size[0];
|
iconProperties['w'] = size[0];
|
||||||
iconProperties['h'] = size[1];
|
iconProperties['h'] = size[1];
|
||||||
var anchor = style.getAnchor(); // top-left
|
var anchor = style.getAnchor(); // top-left
|
||||||
var origin = style.getOrigin(); // top-left
|
var origin = style.getOrigin(); // top-left
|
||||||
|
|
||||||
if (!goog.isNull(origin) && !goog.isNull(iconImageSize) &&
|
if (origin && iconImageSize && origin[0] !== 0 && origin[1] !== size[1]) {
|
||||||
origin[0] !== 0 && origin[1] !== size[1]) {
|
|
||||||
iconProperties['x'] = origin[0];
|
iconProperties['x'] = origin[0];
|
||||||
iconProperties['y'] = iconImageSize[1] - (origin[1] + size[1]);
|
iconProperties['y'] = iconImageSize[1] - (origin[1] + size[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!goog.isNull(anchor) &&
|
if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) {
|
||||||
anchor[0] !== 0 && anchor[1] !== size[1]) {
|
|
||||||
var /** @type {ol.format.KMLVec2_} */ hotSpot = {
|
var /** @type {ol.format.KMLVec2_} */ hotSpot = {
|
||||||
x: anchor[0],
|
x: anchor[0],
|
||||||
xunits: ol.style.IconAnchorUnits.PIXELS,
|
xunits: ol.style.IconAnchorUnits.PIXELS,
|
||||||
@@ -2164,7 +2161,7 @@ ol.format.KML.writeLabelStyle_ = function(node, style, objectStack) {
|
|||||||
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
|
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
|
||||||
var properties = {};
|
var properties = {};
|
||||||
var fill = style.getFill();
|
var fill = style.getFill();
|
||||||
if (!goog.isNull(fill)) {
|
if (fill) {
|
||||||
properties['color'] = fill.getColor();
|
properties['color'] = fill.getColor();
|
||||||
}
|
}
|
||||||
var scale = style.getScale();
|
var scale = style.getScale();
|
||||||
@@ -2279,10 +2276,10 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
|||||||
// FIXME the styles returned by the style function are supposed to be
|
// FIXME the styles returned by the style function are supposed to be
|
||||||
// resolution-independent here
|
// resolution-independent here
|
||||||
var styles = styleFunction.call(feature, 0);
|
var styles = styleFunction.call(feature, 0);
|
||||||
if (!goog.isNull(styles) && styles.length > 0) {
|
if (styles && styles.length > 0) {
|
||||||
properties['Style'] = styles[0];
|
properties['Style'] = styles[0];
|
||||||
var textStyle = styles[0].getText();
|
var textStyle = styles[0].getText();
|
||||||
if (!goog.isNull(textStyle)) {
|
if (textStyle) {
|
||||||
properties['name'] = textStyle.getText();
|
properties['name'] = textStyle.getText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2392,16 +2389,16 @@ ol.format.KML.writeStyle_ = function(node, style, objectStack) {
|
|||||||
var strokeStyle = style.getStroke();
|
var strokeStyle = style.getStroke();
|
||||||
var imageStyle = style.getImage();
|
var imageStyle = style.getImage();
|
||||||
var textStyle = style.getText();
|
var textStyle = style.getText();
|
||||||
if (!goog.isNull(imageStyle)) {
|
if (imageStyle) {
|
||||||
properties['IconStyle'] = imageStyle;
|
properties['IconStyle'] = imageStyle;
|
||||||
}
|
}
|
||||||
if (!goog.isNull(textStyle)) {
|
if (textStyle) {
|
||||||
properties['LabelStyle'] = textStyle;
|
properties['LabelStyle'] = textStyle;
|
||||||
}
|
}
|
||||||
if (!goog.isNull(strokeStyle)) {
|
if (strokeStyle) {
|
||||||
properties['LineStyle'] = strokeStyle;
|
properties['LineStyle'] = strokeStyle;
|
||||||
}
|
}
|
||||||
if (!goog.isNull(fillStyle)) {
|
if (fillStyle) {
|
||||||
properties['PolyStyle'] = fillStyle;
|
properties['PolyStyle'] = fillStyle;
|
||||||
}
|
}
|
||||||
var parentNode = objectStack[objectStack.length - 1].node;
|
var parentNode = objectStack[objectStack.length - 1].node;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ goog.inherits(ol.format.OWS, ol.format.XML);
|
|||||||
ol.format.OWS.prototype.readFromDocument = function(doc) {
|
ol.format.OWS.prototype.readFromDocument = function(doc) {
|
||||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||||
'doc.nodeType should be DOCUMENT');
|
'doc.nodeType should be DOCUMENT');
|
||||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
return this.readFromNode(n);
|
return this.readFromNode(n);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) {
|
|||||||
*/
|
*/
|
||||||
ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
|
ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
|
||||||
var coordinates = object.coordinates;
|
var coordinates = object.coordinates;
|
||||||
if (!goog.isNull(scale) && !goog.isNull(translate)) {
|
if (scale && translate) {
|
||||||
ol.format.TopoJSON.transformVertex_(coordinates, scale, translate);
|
ol.format.TopoJSON.transformVertex_(coordinates, scale, translate);
|
||||||
}
|
}
|
||||||
return new ol.geom.Point(coordinates);
|
return new ol.geom.Point(coordinates);
|
||||||
@@ -117,7 +117,7 @@ ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale,
|
|||||||
translate) {
|
translate) {
|
||||||
var coordinates = object.coordinates;
|
var coordinates = object.coordinates;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
if (!goog.isNull(scale) && !goog.isNull(translate)) {
|
if (scale && translate) {
|
||||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||||
ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate);
|
ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument =
|
|||||||
function(doc) {
|
function(doc) {
|
||||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||||
'doc.nodeType should be DOCUMENT');
|
'doc.nodeType should be DOCUMENT');
|
||||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
return this.readFeatureCollectionMetadataFromNode(n);
|
return this.readFeatureCollectionMetadataFromNode(n);
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_ = {
|
|||||||
ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) {
|
ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) {
|
||||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||||
'doc.nodeType should be DOCUMENT');
|
'doc.nodeType should be DOCUMENT');
|
||||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
return this.readTransactionResponseFromNode(n);
|
return this.readTransactionResponseFromNode(n);
|
||||||
}
|
}
|
||||||
@@ -750,7 +750,7 @@ ol.format.WFS.prototype.readProjection;
|
|||||||
ol.format.WFS.prototype.readProjectionFromDocument = function(doc) {
|
ol.format.WFS.prototype.readProjectionFromDocument = function(doc) {
|
||||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||||
'doc.nodeType should be a DOCUMENT');
|
'doc.nodeType should be a DOCUMENT');
|
||||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
return this.readProjectionFromNode(n);
|
return this.readProjectionFromNode(n);
|
||||||
}
|
}
|
||||||
@@ -771,8 +771,7 @@ ol.format.WFS.prototype.readProjectionFromNode = function(node) {
|
|||||||
if (node.firstElementChild &&
|
if (node.firstElementChild &&
|
||||||
node.firstElementChild.firstElementChild) {
|
node.firstElementChild.firstElementChild) {
|
||||||
node = node.firstElementChild.firstElementChild;
|
node = node.firstElementChild.firstElementChild;
|
||||||
for (var n = node.firstElementChild; !goog.isNull(n);
|
for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
n = n.nextElementSibling) {
|
|
||||||
if (!(n.childNodes.length === 0 ||
|
if (!(n.childNodes.length === 0 ||
|
||||||
(n.childNodes.length === 1 &&
|
(n.childNodes.length === 1 &&
|
||||||
n.firstChild.nodeType === 3))) {
|
n.firstChild.nodeType === 3))) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ ol.format.WMSCapabilities.prototype.read;
|
|||||||
ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
|
ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
|
||||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||||
'doc.nodeType should be DOCUMENT');
|
'doc.nodeType should be DOCUMENT');
|
||||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
return this.readFromNode(n);
|
return this.readFromNode(n);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ ol.format.WMTSCapabilities.prototype.read;
|
|||||||
ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) {
|
ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) {
|
||||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||||
'doc.nodeType should be DOCUMENT');
|
'doc.nodeType should be DOCUMENT');
|
||||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
return this.readFromNode(n);
|
return this.readFromNode(n);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ ol.format.XMLFeature.prototype.readFeaturesFromDocument = function(
|
|||||||
/** @type {Array.<ol.Feature>} */
|
/** @type {Array.<ol.Feature>} */
|
||||||
var features = [];
|
var features = [];
|
||||||
var n;
|
var n;
|
||||||
for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||||
goog.array.extend(features, this.readFeaturesFromNode(n, opt_options));
|
goog.array.extend(features, this.readFeaturesFromNode(n, opt_options));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user