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/render/Feature
*/
import {nullFunction} from '../index.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js';
import GeometryType from '../geom/GeometryType.js';
import _ol_geom_flat_center_ from '../geom/flat/center.js';
@@ -171,7 +171,7 @@ _ol_render_Feature_.prototype.getFlatMidpoints = function() {
var end = ends[i];
var midpoint = _ol_geom_flat_interpolate_.lineString(
flatCoordinates, offset, end, 2, 0.5);
_ol_array_.extend(this.flatMidpoints_, midpoint);
extend(this.flatMidpoints_, midpoint);
offset = end;
}
}

View File

@@ -6,7 +6,7 @@
// FIXME add offset and end to ol.geom.flat.transform.transform2D?
import {inherits} from '../../index.js';
import _ol_array_ from '../../array.js';
import {equals} from '../../array.js';
import {asColorLike} from '../../colorlike.js';
import {intersects} from '../../extent.js';
import GeometryType from '../../geom/GeometryType.js';
@@ -755,8 +755,7 @@ _ol_render_canvas_Immediate_.prototype.setContextStrokeState_ = function(strokeS
contextStrokeState.lineCap = context.lineCap = strokeState.lineCap;
}
if (_ol_has_.CANVAS_LINE_DASH) {
if (!_ol_array_.equals(
contextStrokeState.lineDash, strokeState.lineDash)) {
if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {
context.setLineDash(contextStrokeState.lineDash = strokeState.lineDash);
}
if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {

View File

@@ -2,7 +2,7 @@
* @module ol/render/canvas/Replay
*/
import {getUid, inherits, nullFunction} from '../../index.js';
import _ol_array_ from '../../array.js';
import {equals, reverseSubArray} from '../../array.js';
import {asColorLike} from '../../colorlike.js';
import {buffer, clone, coordinateRelationship, createEmpty, createOrUpdate,
createOrUpdateEmpty, extend, extendCoordinate, intersects} from '../../extent.js';
@@ -542,7 +542,7 @@ _ol_render_canvas_Replay_.prototype.replay_ = function(
instructions, featureCallback, opt_hitExtent) {
/** @type {Array.<number>} */
var pixelCoordinates;
if (this.pixelCoordinates_ && _ol_array_.equals(transform, this.renderedTransform_)) {
if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {
pixelCoordinates = this.pixelCoordinates_;
} else {
if (!this.pixelCoordinates_) {
@@ -898,7 +898,7 @@ _ol_render_canvas_Replay_.prototype.reverseHitDetectionInstructions = function()
begin = i;
} else if (type == _ol_render_canvas_Instruction_.BEGIN_GEOMETRY) {
instruction[2] = i;
_ol_array_.reverseSubArray(this.hitDetectionInstructions, begin, i);
reverseSubArray(this.hitDetectionInstructions, begin, i);
begin = -1;
}
}
@@ -1013,7 +1013,7 @@ _ol_render_canvas_Replay_.prototype.updateStrokeStyle = function(state, applyStr
var miterLimit = state.miterLimit;
if (state.currentStrokeStyle != strokeStyle ||
state.currentLineCap != lineCap ||
(lineDash != state.currentLineDash && !_ol_array_.equals(state.currentLineDash, lineDash)) ||
(lineDash != state.currentLineDash && !equals(state.currentLineDash, lineDash)) ||
state.currentLineDashOffset != lineDashOffset ||
state.currentLineJoin != lineJoin ||
state.currentLineWidth != lineWidth ||

View File

@@ -2,7 +2,7 @@
* @module ol/render/canvas/ReplayGroup
*/
import {inherits} from '../../index.js';
import _ol_array_ from '../../array.js';
import {numberSafeCompareFunction} from '../../array.js';
import {createCanvasContext2D} from '../../dom.js';
import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
@@ -192,7 +192,7 @@ _ol_render_canvas_ReplayGroup_.getCircleArray_ = function(radius) {
* @param {number} rotation Rotation.
*/
_ol_render_canvas_ReplayGroup_.replayDeclutter = function(declutterReplays, context, rotation) {
var zs = Object.keys(declutterReplays).map(Number).sort(_ol_array_.numberSafeCompareFunction);
var zs = Object.keys(declutterReplays).map(Number).sort(numberSafeCompareFunction);
var skippedFeatureUids = {};
for (var z = 0, zz = zs.length; z < zz; ++z) {
var replayData = declutterReplays[zs[z].toString()];
@@ -423,7 +423,7 @@ _ol_render_canvas_ReplayGroup_.prototype.replay = function(context,
/** @type {Array.<number>} */
var zs = Object.keys(this.replaysByZIndex_).map(Number);
zs.sort(_ol_array_.numberSafeCompareFunction);
zs.sort(numberSafeCompareFunction);
// setup clipping so that the parts of over-simplified geometries are not
// visible outside the current extent when panning
@@ -479,7 +479,7 @@ _ol_render_canvas_ReplayGroup_.prototype.replayHitDetection_ = function(
featureCallback, opt_hitExtent, opt_declutterReplays) {
/** @type {Array.<number>} */
var zs = Object.keys(this.replaysByZIndex_).map(Number);
zs.sort(_ol_array_.numberSafeCompareFunction);
zs.sort(numberSafeCompareFunction);
var i, j, replays, replay, result;
for (i = zs.length - 1; i >= 0; --i) {

View File

@@ -2,7 +2,7 @@
* @module ol/render/webgl/CircleReplay
*/
import {getUid, inherits} from '../../index.js';
import _ol_array_ from '../../array.js';
import {equals} from '../../array.js';
import {asArray} from '../../color.js';
import {intersects} from '../../extent.js';
import _ol_obj_ from '../../obj.js';
@@ -409,8 +409,8 @@ _ol_render_webgl_CircleReplay_.prototype.setFillStrokeStyle = function(fillStyle
} else {
fillStyleColor = _ol_render_webgl_.defaultFillStyle;
}
if (!this.state_.strokeColor || !_ol_array_.equals(this.state_.strokeColor, strokeStyleColor) ||
!this.state_.fillColor || !_ol_array_.equals(this.state_.fillColor, fillStyleColor) ||
if (!this.state_.strokeColor || !equals(this.state_.strokeColor, strokeStyleColor) ||
!this.state_.fillColor || !equals(this.state_.fillColor, fillStyleColor) ||
this.state_.lineWidth !== strokeStyleWidth) {
this.state_.changed = true;
this.state_.fillColor = fillStyleColor;

View File

@@ -2,7 +2,7 @@
* @module ol/render/webgl/LineStringReplay
*/
import {getUid, inherits} from '../../index.js';
import _ol_array_ from '../../array.js';
import {equals} from '../../array.js';
import {asArray} from '../../color.js';
import {intersects} from '../../extent.js';
import _ol_geom_flat_orient_ from '../../geom/flat/orient.js';
@@ -107,7 +107,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
//First vertex.
if (i === offset) {
p2 = [flatCoordinates[i + stride], flatCoordinates[i + stride + 1]];
if (end - offset === stride * 2 && _ol_array_.equals(p1, p2)) {
if (end - offset === stride * 2 && equals(p1, p2)) {
break;
}
if (closed) {
@@ -291,7 +291,7 @@ _ol_render_webgl_LineStringReplay_.prototype.isValid_ = function(flatCoordinates
} else if (range === stride * 2) {
var firstP = [flatCoordinates[offset], flatCoordinates[offset + 1]];
var lastP = [flatCoordinates[offset + stride], flatCoordinates[offset + stride + 1]];
return !_ol_array_.equals(firstP, lastP);
return !equals(firstP, lastP);
}
return true;
@@ -659,7 +659,7 @@ _ol_render_webgl_LineStringReplay_.prototype.setFillStrokeStyle = function(fillS
var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
strokeStyleMiterLimit = strokeStyleMiterLimit !== undefined ?
strokeStyleMiterLimit : _ol_render_webgl_.defaultMiterLimit;
if (!this.state_.strokeColor || !_ol_array_.equals(this.state_.strokeColor, strokeStyleColor) ||
if (!this.state_.strokeColor || !equals(this.state_.strokeColor, strokeStyleColor) ||
this.state_.lineWidth !== strokeStyleWidth || this.state_.miterLimit !== strokeStyleMiterLimit) {
this.state_.changed = true;
this.state_.strokeColor = strokeStyleColor;

View File

@@ -2,7 +2,7 @@
* @module ol/render/webgl/PolygonReplay
*/
import {getUid, inherits} from '../../index.js';
import _ol_array_ from '../../array.js';
import {equals} from '../../array.js';
import {asArray} from '../../color.js';
import {intersects} from '../../extent.js';
import _ol_obj_ from '../../obj.js';
@@ -1054,7 +1054,7 @@ _ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle = function(fillStyl
} else {
fillStyleColor = _ol_render_webgl_.defaultFillStyle;
}
if (!this.state_.fillColor || !_ol_array_.equals(fillStyleColor, this.state_.fillColor)) {
if (!this.state_.fillColor || !equals(fillStyleColor, this.state_.fillColor)) {
this.state_.fillColor = fillStyleColor;
this.state_.changed = true;
this.styles_.push(fillStyleColor);

View File

@@ -2,7 +2,7 @@
* @module ol/render/webgl/ReplayGroup
*/
import {inherits} from '../../index.js';
import _ol_array_ from '../../array.js';
import {numberSafeCompareFunction} from '../../array.js';
import {buffer, createOrUpdateFromCoordinate} from '../../extent.js';
import _ol_obj_ from '../../obj.js';
import _ol_render_replay_ from '../replay.js';
@@ -149,7 +149,7 @@ _ol_render_webgl_ReplayGroup_.prototype.replay = function(context,
opacity, skippedFeaturesHash) {
/** @type {Array.<number>} */
var zs = Object.keys(this.replaysByZIndex_).map(Number);
zs.sort(_ol_array_.numberSafeCompareFunction);
zs.sort(numberSafeCompareFunction);
var i, ii, j, jj, replays, replay;
for (i = 0, ii = zs.length; i < ii; ++i) {