Use named imports from extent
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @module ol/geom/Circle
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {createOrUpdate, forEachCorner, intersects} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
@@ -98,7 +98,7 @@ _ol_geom_Circle_.prototype.getCenter = function() {
|
||||
_ol_geom_Circle_.prototype.computeExtent = function(extent) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var radius = flatCoordinates[this.stride] - flatCoordinates[0];
|
||||
return _ol_extent_.createOrUpdate(
|
||||
return createOrUpdate(
|
||||
flatCoordinates[0] - radius, flatCoordinates[1] - radius,
|
||||
flatCoordinates[0] + radius, flatCoordinates[1] + radius,
|
||||
extent);
|
||||
@@ -141,7 +141,7 @@ _ol_geom_Circle_.prototype.getType = function() {
|
||||
*/
|
||||
_ol_geom_Circle_.prototype.intersectsExtent = function(extent) {
|
||||
var circleExtent = this.getExtent();
|
||||
if (_ol_extent_.intersects(extent, circleExtent)) {
|
||||
if (intersects(extent, circleExtent)) {
|
||||
var center = this.getCenter();
|
||||
|
||||
if (extent[0] <= center[0] && extent[2] >= center[0]) {
|
||||
@@ -151,7 +151,7 @@ _ol_geom_Circle_.prototype.intersectsExtent = function(extent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return _ol_extent_.forEachCorner(extent, this.intersectsCoordinate, this);
|
||||
return forEachCorner(extent, this.intersectsCoordinate, this);
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {createEmpty, getHeight, returnOrUpdate} from '../extent.js';
|
||||
import _ol_functions_ from '../functions.js';
|
||||
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
@@ -32,7 +32,7 @@ var _ol_geom_Geometry_ = function() {
|
||||
* @private
|
||||
* @type {ol.Extent}
|
||||
*/
|
||||
this.extent_ = _ol_extent_.createEmpty();
|
||||
this.extent_ = createEmpty();
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -143,7 +143,7 @@ _ol_geom_Geometry_.prototype.getExtent = function(opt_extent) {
|
||||
this.extent_ = this.computeExtent(this.extent_);
|
||||
this.extentRevision_ = this.getRevision();
|
||||
}
|
||||
return _ol_extent_.returnOrUpdate(this.extent_, opt_extent);
|
||||
return returnOrUpdate(this.extent_, opt_extent);
|
||||
};
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ _ol_geom_Geometry_.prototype.transform = function(source, destination) {
|
||||
function(inCoordinates, outCoordinates, stride) {
|
||||
var pixelExtent = source.getExtent();
|
||||
var projectedExtent = source.getWorldExtent();
|
||||
var scale = _ol_extent_.getHeight(projectedExtent) / _ol_extent_.getHeight(pixelExtent);
|
||||
var scale = getHeight(projectedExtent) / getHeight(pixelExtent);
|
||||
_ol_transform_.compose(tmpTransform,
|
||||
projectedExtent[0], projectedExtent[3],
|
||||
scale, -scale, 0,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {createOrUpdateEmpty, closestSquaredDistanceXY, extend, getCenter} from '../extent.js';
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
@@ -98,8 +98,7 @@ _ol_geom_GeometryCollection_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_GeometryCollection_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
var geometries = this.geometries_;
|
||||
@@ -131,10 +130,10 @@ _ol_geom_GeometryCollection_.prototype.containsXY = function(x, y) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_GeometryCollection_.prototype.computeExtent = function(extent) {
|
||||
_ol_extent_.createOrUpdateEmpty(extent);
|
||||
createOrUpdateEmpty(extent);
|
||||
var geometries = this.geometries_;
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
_ol_extent_.extend(extent, geometries[i].getExtent());
|
||||
extend(extent, geometries[i].getExtent());
|
||||
}
|
||||
return extent;
|
||||
};
|
||||
@@ -254,7 +253,7 @@ _ol_geom_GeometryCollection_.prototype.rotate = function(angle, anchor) {
|
||||
_ol_geom_GeometryCollection_.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
var anchor = opt_anchor;
|
||||
if (!anchor) {
|
||||
anchor = _ol_extent_.getCenter(this.getExtent());
|
||||
anchor = getCenter(this.getExtent());
|
||||
}
|
||||
var geometries = this.geometries_;
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {closestSquaredDistanceXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
@@ -93,8 +93,7 @@ _ol_geom_LineString_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_LineString_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/geom/LinearRing
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {closestSquaredDistanceXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
@@ -63,8 +63,7 @@ _ol_geom_LinearRing_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {closestSquaredDistanceXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_LineString_ from '../geom/LineString.js';
|
||||
@@ -89,8 +89,7 @@ _ol_geom_MultiLineString_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_MultiLineString_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {closestSquaredDistanceXY, containsXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
@@ -62,8 +62,7 @@ _ol_geom_MultiPoint_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_MultiPoint_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
@@ -156,7 +155,7 @@ _ol_geom_MultiPoint_.prototype.intersectsExtent = function(extent) {
|
||||
for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
|
||||
x = flatCoordinates[i];
|
||||
y = flatCoordinates[i + 1];
|
||||
if (_ol_extent_.containsXY(extent, x, y)) {
|
||||
if (containsXY(extent, x, y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {closestSquaredDistanceXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
|
||||
@@ -134,8 +134,7 @@ _ol_geom_MultiPolygon_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_MultiPolygon_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/geom/Point
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {createOrUpdateFromCoordinate, containsXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
@@ -76,7 +76,7 @@ _ol_geom_Point_.prototype.getCoordinates = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_Point_.prototype.computeExtent = function(extent) {
|
||||
return _ol_extent_.createOrUpdateFromCoordinate(this.flatCoordinates, extent);
|
||||
return createOrUpdateFromCoordinate(this.flatCoordinates, extent);
|
||||
};
|
||||
|
||||
|
||||
@@ -94,8 +94,7 @@ _ol_geom_Point_.prototype.getType = function() {
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Point_.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_extent_.containsXY(extent,
|
||||
this.flatCoordinates[0], this.flatCoordinates[1]);
|
||||
return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {closestSquaredDistanceXY, getCenter} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
|
||||
@@ -122,8 +122,7 @@ _ol_geom_Polygon_.prototype.clone = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
@@ -199,7 +198,7 @@ _ol_geom_Polygon_.prototype.getEnds = function() {
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getFlatInteriorPoint = function() {
|
||||
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
||||
var flatCenter = _ol_extent_.getCenter(this.getExtent());
|
||||
var flatCenter = getCenter(this.getExtent());
|
||||
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride,
|
||||
flatCenter, 0);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_functions_ from '../functions.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
||||
@@ -91,9 +91,8 @@ _ol_geom_SimpleGeometry_.prototype.containsXY = _ol_functions_.FALSE;
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_SimpleGeometry_.prototype.computeExtent = function(extent) {
|
||||
return _ol_extent_.createOrUpdateFromFlatCoordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
extent);
|
||||
return createOrUpdateFromFlatCoordinates(this.flatCoordinates,
|
||||
0, this.flatCoordinates.length, this.stride, extent);
|
||||
};
|
||||
|
||||
|
||||
@@ -289,7 +288,7 @@ _ol_geom_SimpleGeometry_.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
}
|
||||
var anchor = opt_anchor;
|
||||
if (!anchor) {
|
||||
anchor = _ol_extent_.getCenter(this.getExtent());
|
||||
anchor = getCenter(this.getExtent());
|
||||
}
|
||||
var flatCoordinates = this.getFlatCoordinates();
|
||||
if (flatCoordinates) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/center
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
import {createEmpty, createOrUpdateFromFlatCoordinates} from '../../extent.js';
|
||||
var _ol_geom_flat_center_ = {};
|
||||
|
||||
|
||||
@@ -15,11 +15,10 @@ var _ol_geom_flat_center_ = {};
|
||||
_ol_geom_flat_center_.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
var flatCenters = [];
|
||||
var i, ii;
|
||||
var extent = _ol_extent_.createEmpty();
|
||||
var extent = createEmpty();
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
extent = _ol_extent_.createOrUpdateFromFlatCoordinates(
|
||||
flatCoordinates, offset, ends[0], stride);
|
||||
extent = createOrUpdateFromFlatCoordinates(flatCoordinates, offset, ends[0], stride);
|
||||
flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/contains
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
import {forEachCorner} from '../../extent.js';
|
||||
var _ol_geom_flat_contains_ = {};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ var _ol_geom_flat_contains_ = {};
|
||||
* @return {boolean} Contains extent.
|
||||
*/
|
||||
_ol_geom_flat_contains_.linearRingContainsExtent = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var outside = _ol_extent_.forEachCorner(extent,
|
||||
var outside = forEachCorner(extent,
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @return {boolean} Contains (x, y).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/intersectsextent
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
import {containsExtent, createEmpty, extendFlatCoordinates, intersects, intersectsSegment} from '../../extent.js';
|
||||
import _ol_geom_flat_contains_ from '../flat/contains.js';
|
||||
import _ol_geom_flat_segments_ from '../flat/segments.js';
|
||||
var _ol_geom_flat_intersectsextent_ = {};
|
||||
@@ -16,12 +16,12 @@ var _ol_geom_flat_intersectsextent_ = {};
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
_ol_geom_flat_intersectsextent_.lineString = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var coordinatesExtent = _ol_extent_.extendFlatCoordinates(
|
||||
_ol_extent_.createEmpty(), flatCoordinates, offset, end, stride);
|
||||
if (!_ol_extent_.intersects(extent, coordinatesExtent)) {
|
||||
var coordinatesExtent = extendFlatCoordinates(
|
||||
createEmpty(), flatCoordinates, offset, end, stride);
|
||||
if (!intersects(extent, coordinatesExtent)) {
|
||||
return false;
|
||||
}
|
||||
if (_ol_extent_.containsExtent(extent, coordinatesExtent)) {
|
||||
if (containsExtent(extent, coordinatesExtent)) {
|
||||
return true;
|
||||
}
|
||||
if (coordinatesExtent[0] >= extent[0] &&
|
||||
@@ -40,7 +40,7 @@ _ol_geom_flat_intersectsextent_.lineString = function(flatCoordinates, offset, e
|
||||
* `false` otherwise.
|
||||
*/
|
||||
function(point1, point2) {
|
||||
return _ol_extent_.intersectsSegment(extent, point1, point2);
|
||||
return intersectsSegment(extent, point1, point2);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user