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/geom/LineString
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {closestSquaredDistanceXY} from '../extent.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js';
@@ -70,7 +70,7 @@ LineString.prototype.appendCoordinate = function(coordinate) {
if (!this.flatCoordinates) {
this.flatCoordinates = coordinate.slice();
} else {
_ol_array_.extend(this.flatCoordinates, coordinate);
extend(this.flatCoordinates, coordinate);
}
this.changed();
};

View File

@@ -2,7 +2,7 @@
* @module ol/geom/MultiLineString
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {closestSquaredDistanceXY} from '../extent.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js';
@@ -63,8 +63,7 @@ MultiLineString.prototype.appendLineString = function(lineString) {
if (!this.flatCoordinates) {
this.flatCoordinates = lineString.getFlatCoordinates().slice();
} else {
_ol_array_.extend(
this.flatCoordinates, lineString.getFlatCoordinates().slice());
extend(this.flatCoordinates, lineString.getFlatCoordinates().slice());
}
this.ends_.push(this.flatCoordinates.length);
this.changed();
@@ -213,7 +212,7 @@ MultiLineString.prototype.getFlatMidpoints = function() {
var end = ends[i];
var midpoint = _ol_geom_flat_interpolate_.lineString(
flatCoordinates, offset, end, stride, 0.5);
_ol_array_.extend(midpoints, midpoint);
extend(midpoints, midpoint);
offset = end;
}
return midpoints;
@@ -303,7 +302,7 @@ MultiLineString.prototype.setLineStrings = function(lineStrings) {
if (i === 0) {
layout = lineString.getLayout();
}
_ol_array_.extend(flatCoordinates, lineString.getFlatCoordinates());
extend(flatCoordinates, lineString.getFlatCoordinates());
ends.push(flatCoordinates.length);
}
this.setFlatCoordinates(layout, flatCoordinates, ends);

View File

@@ -2,7 +2,7 @@
* @module ol/geom/MultiPoint
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {closestSquaredDistanceXY, containsXY} from '../extent.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js';
@@ -39,7 +39,7 @@ MultiPoint.prototype.appendPoint = function(point) {
if (!this.flatCoordinates) {
this.flatCoordinates = point.getFlatCoordinates().slice();
} else {
_ol_array_.extend(this.flatCoordinates, point.getFlatCoordinates());
extend(this.flatCoordinates, point.getFlatCoordinates());
}
this.changed();
};

View File

@@ -2,7 +2,7 @@
* @module ol/geom/MultiPolygon
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {closestSquaredDistanceXY} from '../extent.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js';
@@ -97,7 +97,7 @@ MultiPolygon.prototype.appendPolygon = function(polygon) {
this.endss_.push();
} else {
var offset = this.flatCoordinates.length;
_ol_array_.extend(this.flatCoordinates, polygon.getFlatCoordinates());
extend(this.flatCoordinates, polygon.getFlatCoordinates());
ends = polygon.getEnds().slice();
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
@@ -414,7 +414,7 @@ MultiPolygon.prototype.setPolygons = function(polygons) {
for (j = 0, jj = ends.length; j < jj; ++j) {
ends[j] += offset;
}
_ol_array_.extend(flatCoordinates, polygon.getFlatCoordinates());
extend(flatCoordinates, polygon.getFlatCoordinates());
endss.push(ends);
}
this.setFlatCoordinates(layout, flatCoordinates, endss);

View File

@@ -2,7 +2,7 @@
* @module ol/geom/Polygon
*/
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {closestSquaredDistanceXY, getCenter} from '../extent.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js';
@@ -97,7 +97,7 @@ Polygon.prototype.appendLinearRing = function(linearRing) {
if (!this.flatCoordinates) {
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
} else {
_ol_array_.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
extend(this.flatCoordinates, linearRing.getFlatCoordinates());
}
this.ends_.push(this.flatCoordinates.length);
this.changed();
@@ -384,8 +384,7 @@ Polygon.circular = function(sphere, center, radius, opt_n) {
var flatCoordinates = [];
var i;
for (i = 0; i < n; ++i) {
_ol_array_.extend(
flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n));
extend(flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n));
}
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
var polygon = new Polygon(null);

View File

@@ -1,7 +1,7 @@
/**
* @module ol/geom/flat/interiorpoint
*/
import _ol_array_ from '../../array.js';
import {numberSafeCompareFunction} from '../../array.js';
import _ol_geom_flat_contains_ from '../flat/contains.js';
var _ol_geom_flat_interiorpoint_ = {};
@@ -45,7 +45,7 @@ _ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
// inside the linear ring.
var pointX = NaN;
var maxSegmentLength = -Infinity;
intersections.sort(_ol_array_.numberSafeCompareFunction);
intersections.sort(numberSafeCompareFunction);
x1 = intersections[0];
for (i = 1, ii = intersections.length; i < ii; ++i) {
x2 = intersections[i];

View File

@@ -1,7 +1,7 @@
/**
* @module ol/geom/flat/interpolate
*/
import _ol_array_ from '../../array.js';
import {binarySearch} from '../../array.js';
import _ol_math_ from '../../math.js';
var _ol_geom_flat_interpolate_ = {};
@@ -42,7 +42,7 @@ _ol_geom_flat_interpolate_.lineString = function(flatCoordinates, offset, end, s
y1 = y2;
}
var target = fraction * length;
var index = _ol_array_.binarySearch(cumulativeLengths, target);
var index = binarySearch(cumulativeLengths, target);
if (index < 0) {
var t = (target - cumulativeLengths[-index - 2]) /
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);