rename _ol_math_ imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/closest
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
import {lerp, squaredDistance as squaredDx} from '../../math.js';
|
||||
var _ol_geom_flat_closest_ = {};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ _ol_geom_flat_closest_.point = function(flatCoordinates, offset1, offset2, strid
|
||||
offset = offset2;
|
||||
} else if (t > 0) {
|
||||
for (i = 0; i < stride; ++i) {
|
||||
closestPoint[i] = _ol_math_.lerp(flatCoordinates[offset1 + i],
|
||||
closestPoint[i] = lerp(flatCoordinates[offset1 + i],
|
||||
flatCoordinates[offset2 + i], t);
|
||||
}
|
||||
closestPoint.length = stride;
|
||||
@@ -63,7 +63,7 @@ _ol_geom_flat_closest_.getMaxSquaredDelta = function(flatCoordinates, offset, en
|
||||
for (offset += stride; offset < end; offset += stride) {
|
||||
var x2 = flatCoordinates[offset];
|
||||
var y2 = flatCoordinates[offset + 1];
|
||||
var squaredDelta = _ol_math_.squaredDistance(x1, y1, x2, y2);
|
||||
var squaredDelta = squaredDx(x1, y1, x2, y2);
|
||||
if (squaredDelta > maxSquaredDelta) {
|
||||
maxSquaredDelta = squaredDelta;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ _ol_geom_flat_closest_.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
var i, squaredDistance;
|
||||
if (maxDelta === 0) {
|
||||
// All points are identical, so just test the first point.
|
||||
squaredDistance = _ol_math_.squaredDistance(
|
||||
squaredDistance = squaredDx(
|
||||
x, y, flatCoordinates[offset], flatCoordinates[offset + 1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -154,7 +154,7 @@ _ol_geom_flat_closest_.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
while (index < end) {
|
||||
_ol_geom_flat_closest_.point(
|
||||
flatCoordinates, index - stride, index, stride, x, y, tmpPoint);
|
||||
squaredDistance = _ol_math_.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -182,7 +182,7 @@ _ol_geom_flat_closest_.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
// Check the closing segment.
|
||||
_ol_geom_flat_closest_.point(
|
||||
flatCoordinates, end - stride, offset, stride, x, y, tmpPoint);
|
||||
squaredDistance = _ol_math_.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/geodesic
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
import {squaredSegmentDistance, toRadians, toDegrees} from '../../math.js';
|
||||
import {get as getProjection, getTransform} from '../../proj.js';
|
||||
var _ol_geom_flat_geodesic_ = {};
|
||||
|
||||
@@ -59,7 +59,7 @@ _ol_geom_flat_geodesic_.line_ = function(interpolate, transform, squaredToleranc
|
||||
fracM = (fracA + fracB) / 2;
|
||||
geoM = interpolate(fracM);
|
||||
m = transform(geoM);
|
||||
if (_ol_math_.squaredSegmentDistance(m[0], m[1], a[0], a[1],
|
||||
if (squaredSegmentDistance(m[0], m[1], a[0], a[1],
|
||||
b[0], b[1]) < squaredTolerance) {
|
||||
// If the m point is sufficiently close to the straight line, then we
|
||||
// discard it. Just use the b coordinate and move on to the next line
|
||||
@@ -95,12 +95,12 @@ _ol_geom_flat_geodesic_.greatCircleArc = function(
|
||||
|
||||
var geoProjection = getProjection('EPSG:4326');
|
||||
|
||||
var cosLat1 = Math.cos(_ol_math_.toRadians(lat1));
|
||||
var sinLat1 = Math.sin(_ol_math_.toRadians(lat1));
|
||||
var cosLat2 = Math.cos(_ol_math_.toRadians(lat2));
|
||||
var sinLat2 = Math.sin(_ol_math_.toRadians(lat2));
|
||||
var cosDeltaLon = Math.cos(_ol_math_.toRadians(lon2 - lon1));
|
||||
var sinDeltaLon = Math.sin(_ol_math_.toRadians(lon2 - lon1));
|
||||
var cosLat1 = Math.cos(toRadians(lat1));
|
||||
var sinLat1 = Math.sin(toRadians(lat1));
|
||||
var cosLat2 = Math.cos(toRadians(lat2));
|
||||
var sinLat2 = Math.sin(toRadians(lat2));
|
||||
var cosDeltaLon = Math.cos(toRadians(lon2 - lon1));
|
||||
var sinDeltaLon = Math.sin(toRadians(lon2 - lon1));
|
||||
var d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon;
|
||||
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
@@ -119,10 +119,10 @@ _ol_geom_flat_geodesic_.greatCircleArc = function(
|
||||
var x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon;
|
||||
var theta = Math.atan2(y, x);
|
||||
var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
|
||||
var lon = _ol_math_.toRadians(lon1) +
|
||||
var lon = toRadians(lon1) +
|
||||
Math.atan2(Math.sin(theta) * sinD * cosLat1,
|
||||
cosD - sinLat1 * Math.sin(lat));
|
||||
return [_ol_math_.toDegrees(lon), _ol_math_.toDegrees(lat)];
|
||||
return [toDegrees(lon), toDegrees(lat)];
|
||||
}, getTransform(geoProjection, projection), squaredTolerance);
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/geom/flat/interpolate
|
||||
*/
|
||||
import {binarySearch} from '../../array.js';
|
||||
import _ol_math_ from '../../math.js';
|
||||
import {lerp} from '../../math.js';
|
||||
var _ol_geom_flat_interpolate_ = {};
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ _ol_geom_flat_interpolate_.lineString = function(flatCoordinates, offset, end, s
|
||||
var t = (target - cumulativeLengths[-index - 2]) /
|
||||
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
|
||||
var o = offset + (-index - 2) * stride;
|
||||
pointX = _ol_math_.lerp(
|
||||
pointX = lerp(
|
||||
flatCoordinates[o], flatCoordinates[o + stride], t);
|
||||
pointY = _ol_math_.lerp(
|
||||
pointY = lerp(
|
||||
flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t);
|
||||
} else {
|
||||
pointX = flatCoordinates[offset + index * stride];
|
||||
@@ -120,7 +120,7 @@ _ol_geom_flat_interpolate_.lineStringCoordinateAtM = function(flatCoordinates, o
|
||||
coordinate = [];
|
||||
var i;
|
||||
for (i = 0; i < stride - 1; ++i) {
|
||||
coordinate.push(_ol_math_.lerp(flatCoordinates[(lo - 1) * stride + i],
|
||||
coordinate.push(lerp(flatCoordinates[(lo - 1) * stride + i],
|
||||
flatCoordinates[lo * stride + i], t));
|
||||
}
|
||||
coordinate.push(m);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import _ol_math_ from '../../math.js';
|
||||
import {squaredSegmentDistance, squaredDistance} from '../../math.js';
|
||||
var _ol_geom_flat_simplify_ = {};
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ _ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
for (i = first + stride; i < last; i += stride) {
|
||||
var x = flatCoordinates[i];
|
||||
var y = flatCoordinates[i + 1];
|
||||
var squaredDistance = _ol_math_.squaredSegmentDistance(
|
||||
var squaredDistance = squaredSegmentDistance(
|
||||
x, y, x1, y1, x2, y2);
|
||||
if (squaredDistance > maxSquaredDistance) {
|
||||
index = i;
|
||||
@@ -221,7 +221,7 @@ _ol_geom_flat_simplify_.radialDistance = function(flatCoordinates, offset, end,
|
||||
for (offset += stride; offset < end; offset += stride) {
|
||||
x2 = flatCoordinates[offset];
|
||||
y2 = flatCoordinates[offset + 1];
|
||||
if (_ol_math_.squaredDistance(x1, y1, x2, y2) > squaredTolerance) {
|
||||
if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {
|
||||
// copy point at offset
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = x2;
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = y2;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/geom/flat/textpath
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
import {lerp} from '../../math.js';
|
||||
var _ol_geom_flat_textpath_ = {};
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ _ol_geom_flat_textpath_.lineString = function(
|
||||
}
|
||||
}
|
||||
var interpolate = segmentPos / segmentLength;
|
||||
var x = _ol_math_.lerp(x1, x2, interpolate);
|
||||
var y = _ol_math_.lerp(y1, y2, interpolate);
|
||||
var x = lerp(x1, x2, interpolate);
|
||||
var y = lerp(y1, y2, interpolate);
|
||||
if (previousAngle == angle) {
|
||||
if (reverse) {
|
||||
data[0] = x;
|
||||
|
||||
Reference in New Issue
Block a user