Named exports from ol/array module

This commit is contained in:
Marc Jansen
2017-12-19 12:22:46 +01:00
committed by Frederic Junod
parent 767f61ba78
commit 02002082bf
47 changed files with 296 additions and 298 deletions

View File

@@ -2,7 +2,7 @@
* @module ol/format/GML3
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {createOrUpdate} from '../extent.js';
import FeatureFormat from '../format/Feature.js';
import GMLBase from '../format/GMLBase.js';
@@ -249,7 +249,7 @@ GML3.prototype.readSurface_ = function(node, objectStack) {
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
_ol_array_.extend(flatCoordinates, flatLinearRings[i]);
extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(

View File

@@ -5,7 +5,7 @@
// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect
// envelopes/extents, only geometries!
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import _ol_Feature_ from '../Feature.js';
import FeatureFormat from '../format/Feature.js';
import XMLFeature from '../format/XMLFeature.js';
@@ -428,7 +428,7 @@ GMLBase.prototype.readPolygon = function(node, objectStack) {
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
_ol_array_.extend(flatCoordinates, flatLinearRings[i]);
extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_array_ from '../array.js';
import {includes} from '../array.js';
import FeatureFormat from '../format/Feature.js';
import XMLFeature from '../format/XMLFeature.js';
import XSD from '../format/XSD.js';
@@ -489,7 +489,7 @@ GPX.prototype.readFeature;
* @inheritDoc
*/
GPX.prototype.readFeatureFromNode = function(node, opt_options) {
if (!_ol_array_.includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) {
if (!includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) {
return null;
}
var featureReader = GPX.FEATURE_READER_[node.localName];
@@ -523,7 +523,7 @@ GPX.prototype.readFeatures;
* @inheritDoc
*/
GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!_ol_array_.includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) {
if (!includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) {
return [];
}
if (node.localName == 'gpx') {

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_array_ from '../array.js';
import {extend, includes} from '../array.js';
import {assert} from '../asserts.js';
import {asArray} from '../color.js';
import FeatureFormat from '../format/Feature.js';
@@ -927,7 +927,7 @@ KML.readMultiGeometry_ = function(node, objectStack) {
flatCoordinates = point.getFlatCoordinates();
for (i = 1, ii = geometries.length; i < ii; ++i) {
geometry = geometries[i];
_ol_array_.extend(flatCoordinates, geometry.getFlatCoordinates());
extend(flatCoordinates, geometry.getFlatCoordinates());
}
multiGeometry = new MultiPoint(null);
multiGeometry.setFlatCoordinates(layout, flatCoordinates);
@@ -993,7 +993,7 @@ KML.readPolygon_ = function(node, objectStack) {
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
_ol_array_.extend(flatCoordinates, flatLinearRings[i]);
extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(
@@ -1806,7 +1806,7 @@ KML.prototype.readFeature;
* @inheritDoc
*/
KML.prototype.readFeatureFromNode = function(node, opt_options) {
if (!_ol_array_.includes(KML.NAMESPACE_URIS_, node.namespaceURI)) {
if (!includes(KML.NAMESPACE_URIS_, node.namespaceURI)) {
return null;
}
var feature = this.readPlacemark_(
@@ -1837,7 +1837,7 @@ KML.prototype.readFeatures;
* @inheritDoc
*/
KML.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!_ol_array_.includes(KML.NAMESPACE_URIS_, node.namespaceURI)) {
if (!includes(KML.NAMESPACE_URIS_, node.namespaceURI)) {
return [];
}
var features;
@@ -1864,7 +1864,7 @@ KML.prototype.readFeaturesFromNode = function(node, opt_options) {
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var fs = this.readFeaturesFromNode(n, opt_options);
if (fs) {
_ol_array_.extend(features, fs);
extend(features, fs);
}
}
return features;
@@ -1920,14 +1920,14 @@ KML.prototype.readNameFromDocument = function(doc) {
KML.prototype.readNameFromNode = function(node) {
var n;
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
if (includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
n.localName == 'name') {
return XSD.readString(n);
}
}
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName;
if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
if (includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
(localName == 'Document' ||
localName == 'Folder' ||
localName == 'Placemark' ||
@@ -1952,14 +1952,14 @@ KML.prototype.readNameFromNode = function(node) {
KML.prototype.readNetworkLinks = function(source) {
var networkLinks = [];
if (_ol_xml_.isDocument(source)) {
_ol_array_.extend(networkLinks, this.readNetworkLinksFromDocument(
extend(networkLinks, this.readNetworkLinksFromDocument(
/** @type {Document} */ (source)));
} else if (_ol_xml_.isNode(source)) {
_ol_array_.extend(networkLinks, this.readNetworkLinksFromNode(
extend(networkLinks, this.readNetworkLinksFromNode(
/** @type {Node} */ (source)));
} else if (typeof source === 'string') {
var doc = _ol_xml_.parse(source);
_ol_array_.extend(networkLinks, this.readNetworkLinksFromDocument(doc));
extend(networkLinks, this.readNetworkLinksFromDocument(doc));
}
return networkLinks;
};
@@ -1973,7 +1973,7 @@ KML.prototype.readNetworkLinksFromDocument = function(doc) {
var n, networkLinks = [];
for (n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
_ol_array_.extend(networkLinks, this.readNetworkLinksFromNode(n));
extend(networkLinks, this.readNetworkLinksFromNode(n));
}
}
return networkLinks;
@@ -1987,7 +1987,7 @@ KML.prototype.readNetworkLinksFromDocument = function(doc) {
KML.prototype.readNetworkLinksFromNode = function(node) {
var n, networkLinks = [];
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
if (includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
n.localName == 'NetworkLink') {
var obj = _ol_xml_.pushParseAndPop({}, KML.NETWORK_LINK_PARSERS_,
n, []);
@@ -1996,11 +1996,11 @@ KML.prototype.readNetworkLinksFromNode = function(node) {
}
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName;
if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
if (includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
(localName == 'Document' ||
localName == 'Folder' ||
localName == 'kml')) {
_ol_array_.extend(networkLinks, this.readNetworkLinksFromNode(n));
extend(networkLinks, this.readNetworkLinksFromNode(n));
}
}
return networkLinks;
@@ -2017,14 +2017,14 @@ KML.prototype.readNetworkLinksFromNode = function(node) {
KML.prototype.readRegion = function(source) {
var regions = [];
if (_ol_xml_.isDocument(source)) {
_ol_array_.extend(regions, this.readRegionFromDocument(
extend(regions, this.readRegionFromDocument(
/** @type {Document} */ (source)));
} else if (_ol_xml_.isNode(source)) {
_ol_array_.extend(regions, this.readRegionFromNode(
extend(regions, this.readRegionFromNode(
/** @type {Node} */ (source)));
} else if (typeof source === 'string') {
var doc = _ol_xml_.parse(source);
_ol_array_.extend(regions, this.readRegionFromDocument(doc));
extend(regions, this.readRegionFromDocument(doc));
}
return regions;
};
@@ -2038,7 +2038,7 @@ KML.prototype.readRegionFromDocument = function(doc) {
var n, regions = [];
for (n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
_ol_array_.extend(regions, this.readRegionFromNode(n));
extend(regions, this.readRegionFromNode(n));
}
}
return regions;
@@ -2053,7 +2053,7 @@ KML.prototype.readRegionFromDocument = function(doc) {
KML.prototype.readRegionFromNode = function(node) {
var n, regions = [];
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
if (includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
n.localName == 'Region') {
var obj = _ol_xml_.pushParseAndPop({}, KML.REGION_PARSERS_,
n, []);
@@ -2062,11 +2062,11 @@ KML.prototype.readRegionFromNode = function(node) {
}
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName;
if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
if (includes(KML.NAMESPACE_URIS_, n.namespaceURI) &&
(localName == 'Document' ||
localName == 'Folder' ||
localName == 'kml')) {
_ol_array_.extend(regions, this.readRegionFromNode(n));
extend(regions, this.readRegionFromNode(n));
}
}
return regions;

View File

@@ -3,7 +3,7 @@
*/
// FIXME add typedef for stack state objects
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import _ol_Feature_ from '../Feature.js';
import FeatureFormat from '../format/Feature.js';
import XMLFeature from '../format/XMLFeature.js';
@@ -180,7 +180,7 @@ OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
var flatCoordinates = [];
for (var i = 0, ii = values.ndrefs.length; i < ii; i++) {
var point = state.nodes[values.ndrefs[i]];
_ol_array_.extend(flatCoordinates, point);
extend(flatCoordinates, point);
}
var geometry;
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {

View File

@@ -2,7 +2,7 @@
* @module ol/format/WMSGetFeatureInfo
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend, includes} from '../array.js';
import GML2 from '../format/GML2.js';
import XMLFeature from '../format/XMLFeature.js';
import _ol_obj_ from '../obj.js';
@@ -105,7 +105,7 @@ WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
var toRemove = WMSGetFeatureInfo.layerIdentifier_;
var layerName = layer.localName.replace(toRemove, '');
if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) {
if (this.layers_ && !includes(this.layers_, layerName)) {
continue;
}
@@ -124,7 +124,7 @@ WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
var layerFeatures = _ol_xml_.pushParseAndPop(
[], parsersNS, layer, objectStack, this.gmlFormat_);
if (layerFeatures) {
_ol_array_.extend(features, layerFeatures);
extend(features, layerFeatures);
}
}
}

View File

@@ -2,7 +2,7 @@
* @module ol/format/XMLFeature
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import FeatureFormat from '../format/Feature.js';
import FormatType from '../format/FormatType.js';
import _ol_xml_ from '../xml.js';
@@ -114,7 +114,7 @@ XMLFeature.prototype.readFeaturesFromDocument = function(
var n;
for (n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
_ol_array_.extend(features, this.readFeaturesFromNode(n, opt_options));
extend(features, this.readFeaturesFromNode(n, opt_options));
}
}
return features;