Transformed
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.area');
|
||||
/**
|
||||
* @module ol/geom/flat/area
|
||||
*/
|
||||
var _ol_geom_flat_area_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +11,7 @@ goog.provide('ol.geom.flat.area');
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Area.
|
||||
*/
|
||||
ol.geom.flat.area.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_area_.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
var twiceArea = 0;
|
||||
var x1 = flatCoordinates[end - stride];
|
||||
var y1 = flatCoordinates[end - stride + 1];
|
||||
@@ -30,12 +33,12 @@ ol.geom.flat.area.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Area.
|
||||
*/
|
||||
ol.geom.flat.area.linearRings = function(flatCoordinates, offset, ends, stride) {
|
||||
_ol_geom_flat_area_.linearRings = function(flatCoordinates, offset, ends, stride) {
|
||||
var area = 0;
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
area += ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride);
|
||||
area += _ol_geom_flat_area_.linearRing(flatCoordinates, offset, end, stride);
|
||||
offset = end;
|
||||
}
|
||||
return area;
|
||||
@@ -49,14 +52,15 @@ ol.geom.flat.area.linearRings = function(flatCoordinates, offset, ends, stride)
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Area.
|
||||
*/
|
||||
ol.geom.flat.area.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
_ol_geom_flat_area_.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
var area = 0;
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
area +=
|
||||
ol.geom.flat.area.linearRings(flatCoordinates, offset, ends, stride);
|
||||
_ol_geom_flat_area_.linearRings(flatCoordinates, offset, ends, stride);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return area;
|
||||
};
|
||||
export default _ol_geom_flat_area_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.center');
|
||||
|
||||
goog.require('ol.extent');
|
||||
/**
|
||||
* @module ol/geom/flat/center
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
var _ol_geom_flat_center_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,16 +12,17 @@ goog.require('ol.extent');
|
||||
* @param {number} stride Stride.
|
||||
* @return {Array.<number>} Flat centers.
|
||||
*/
|
||||
ol.geom.flat.center.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
_ol_geom_flat_center_.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
var flatCenters = [];
|
||||
var i, ii;
|
||||
var extent = ol.extent.createEmpty();
|
||||
var extent = _ol_extent_.createEmpty();
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
extent = ol.extent.createOrUpdateFromFlatCoordinates(
|
||||
extent = _ol_extent_.createOrUpdateFromFlatCoordinates(
|
||||
flatCoordinates, offset, ends[0], stride);
|
||||
flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return flatCenters;
|
||||
};
|
||||
export default _ol_geom_flat_center_;
|
||||
|
||||
+24
-21
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.closest');
|
||||
|
||||
goog.require('ol.math');
|
||||
/**
|
||||
* @module ol/geom/flat/closest
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_closest_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,7 +17,7 @@ goog.require('ol.math');
|
||||
* @param {number} y Y.
|
||||
* @param {Array.<number>} closestPoint Closest point.
|
||||
*/
|
||||
ol.geom.flat.closest.point = function(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {
|
||||
_ol_geom_flat_closest_.point = function(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {
|
||||
var x1 = flatCoordinates[offset1];
|
||||
var y1 = flatCoordinates[offset1 + 1];
|
||||
var dx = flatCoordinates[offset2] - x1;
|
||||
@@ -29,7 +31,7 @@ ol.geom.flat.closest.point = function(flatCoordinates, offset1, offset2, stride,
|
||||
offset = offset2;
|
||||
} else if (t > 0) {
|
||||
for (i = 0; i < stride; ++i) {
|
||||
closestPoint[i] = ol.math.lerp(flatCoordinates[offset1 + i],
|
||||
closestPoint[i] = _ol_math_.lerp(flatCoordinates[offset1 + i],
|
||||
flatCoordinates[offset2 + i], t);
|
||||
}
|
||||
closestPoint.length = stride;
|
||||
@@ -55,13 +57,13 @@ ol.geom.flat.closest.point = function(flatCoordinates, offset1, offset2, stride,
|
||||
* @param {number} maxSquaredDelta Max squared delta.
|
||||
* @return {number} Max squared delta.
|
||||
*/
|
||||
ol.geom.flat.closest.getMaxSquaredDelta = function(flatCoordinates, offset, end, stride, maxSquaredDelta) {
|
||||
_ol_geom_flat_closest_.getMaxSquaredDelta = function(flatCoordinates, offset, end, stride, maxSquaredDelta) {
|
||||
var x1 = flatCoordinates[offset];
|
||||
var y1 = flatCoordinates[offset + 1];
|
||||
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 = _ol_math_.squaredDistance(x1, y1, x2, y2);
|
||||
if (squaredDelta > maxSquaredDelta) {
|
||||
maxSquaredDelta = squaredDelta;
|
||||
}
|
||||
@@ -80,11 +82,11 @@ ol.geom.flat.closest.getMaxSquaredDelta = function(flatCoordinates, offset, end,
|
||||
* @param {number} maxSquaredDelta Max squared delta.
|
||||
* @return {number} Max squared delta.
|
||||
*/
|
||||
ol.geom.flat.closest.getsMaxSquaredDelta = function(flatCoordinates, offset, ends, stride, maxSquaredDelta) {
|
||||
_ol_geom_flat_closest_.getsMaxSquaredDelta = function(flatCoordinates, offset, ends, stride, maxSquaredDelta) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
maxSquaredDelta = ol.geom.flat.closest.getMaxSquaredDelta(
|
||||
maxSquaredDelta = _ol_geom_flat_closest_.getMaxSquaredDelta(
|
||||
flatCoordinates, offset, end, stride, maxSquaredDelta);
|
||||
offset = end;
|
||||
}
|
||||
@@ -100,11 +102,11 @@ ol.geom.flat.closest.getsMaxSquaredDelta = function(flatCoordinates, offset, end
|
||||
* @param {number} maxSquaredDelta Max squared delta.
|
||||
* @return {number} Max squared delta.
|
||||
*/
|
||||
ol.geom.flat.closest.getssMaxSquaredDelta = function(flatCoordinates, offset, endss, stride, maxSquaredDelta) {
|
||||
_ol_geom_flat_closest_.getssMaxSquaredDelta = function(flatCoordinates, offset, endss, stride, maxSquaredDelta) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
maxSquaredDelta = ol.geom.flat.closest.getsMaxSquaredDelta(
|
||||
maxSquaredDelta = _ol_geom_flat_closest_.getsMaxSquaredDelta(
|
||||
flatCoordinates, offset, ends, stride, maxSquaredDelta);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
@@ -126,7 +128,7 @@ ol.geom.flat.closest.getssMaxSquaredDelta = function(flatCoordinates, offset, en
|
||||
* @param {Array.<number>=} opt_tmpPoint Temporary point object.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_closest_.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||
opt_tmpPoint) {
|
||||
if (offset == end) {
|
||||
@@ -135,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 = _ol_math_.squaredDistance(
|
||||
x, y, flatCoordinates[offset], flatCoordinates[offset + 1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -150,9 +152,9 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||
var index = offset + stride;
|
||||
while (index < end) {
|
||||
ol.geom.flat.closest.point(
|
||||
_ol_geom_flat_closest_.point(
|
||||
flatCoordinates, index - stride, index, stride, x, y, tmpPoint);
|
||||
squaredDistance = ol.math.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
squaredDistance = _ol_math_.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -178,9 +180,9 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
}
|
||||
if (isRing) {
|
||||
// Check the closing segment.
|
||||
ol.geom.flat.closest.point(
|
||||
_ol_geom_flat_closest_.point(
|
||||
flatCoordinates, end - stride, offset, stride, x, y, tmpPoint);
|
||||
squaredDistance = ol.math.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
squaredDistance = _ol_math_.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -207,14 +209,14 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
* @param {Array.<number>=} opt_tmpPoint Temporary point object.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||
_ol_geom_flat_closest_.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||
opt_tmpPoint) {
|
||||
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
minSquaredDistance = ol.geom.flat.closest.getClosestPoint(
|
||||
minSquaredDistance = _ol_geom_flat_closest_.getClosestPoint(
|
||||
flatCoordinates, offset, end, stride,
|
||||
maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
|
||||
offset = end;
|
||||
@@ -237,17 +239,18 @@ ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||
* @param {Array.<number>=} opt_tmpPoint Temporary point object.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.flat.closest.getssClosestPoint = function(flatCoordinates, offset,
|
||||
_ol_geom_flat_closest_.getssClosestPoint = function(flatCoordinates, offset,
|
||||
endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||
opt_tmpPoint) {
|
||||
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
minSquaredDistance = ol.geom.flat.closest.getsClosestPoint(
|
||||
minSquaredDistance = _ol_geom_flat_closest_.getsClosestPoint(
|
||||
flatCoordinates, offset, ends, stride,
|
||||
maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return minSquaredDistance;
|
||||
};
|
||||
export default _ol_geom_flat_closest_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.contains');
|
||||
|
||||
goog.require('ol.extent');
|
||||
/**
|
||||
* @module ol/geom/flat/contains
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
var _ol_geom_flat_contains_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -11,14 +13,14 @@ goog.require('ol.extent');
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} Contains extent.
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingContainsExtent = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var outside = ol.extent.forEachCorner(extent,
|
||||
_ol_geom_flat_contains_.linearRingContainsExtent = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var outside = _ol_extent_.forEachCorner(extent,
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
function(coordinate) {
|
||||
return !ol.geom.flat.contains.linearRingContainsXY(flatCoordinates,
|
||||
return !_ol_geom_flat_contains_.linearRingContainsXY(flatCoordinates,
|
||||
offset, end, stride, coordinate[0], coordinate[1]);
|
||||
});
|
||||
return !outside;
|
||||
@@ -34,7 +36,7 @@ ol.geom.flat.contains.linearRingContainsExtent = function(flatCoordinates, offse
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingContainsXY = function(flatCoordinates, offset, end, stride, x, y) {
|
||||
_ol_geom_flat_contains_.linearRingContainsXY = function(flatCoordinates, offset, end, stride, x, y) {
|
||||
// http://geomalgorithms.com/a03-_inclusion.html
|
||||
// Copyright 2000 softSurfer, 2012 Dan Sunday
|
||||
// This code may be freely used and modified for any purpose
|
||||
@@ -71,17 +73,17 @@ ol.geom.flat.contains.linearRingContainsXY = function(flatCoordinates, offset, e
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingsContainsXY = function(flatCoordinates, offset, ends, stride, x, y) {
|
||||
_ol_geom_flat_contains_.linearRingsContainsXY = function(flatCoordinates, offset, ends, stride, x, y) {
|
||||
if (ends.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (!ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (!_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, ends[0], stride, x, y)) {
|
||||
return false;
|
||||
}
|
||||
var i, ii;
|
||||
for (i = 1, ii = ends.length; i < ii; ++i) {
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, ends[i - 1], ends[i], stride, x, y)) {
|
||||
return false;
|
||||
}
|
||||
@@ -99,14 +101,14 @@ ol.geom.flat.contains.linearRingsContainsXY = function(flatCoordinates, offset,
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingssContainsXY = function(flatCoordinates, offset, endss, stride, x, y) {
|
||||
_ol_geom_flat_contains_.linearRingssContainsXY = function(flatCoordinates, offset, endss, stride, x, y) {
|
||||
if (endss.length === 0) {
|
||||
return false;
|
||||
}
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
if (ol.geom.flat.contains.linearRingsContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingsContainsXY(
|
||||
flatCoordinates, offset, ends, stride, x, y)) {
|
||||
return true;
|
||||
}
|
||||
@@ -114,3 +116,4 @@ ol.geom.flat.contains.linearRingssContainsXY = function(flatCoordinates, offset,
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_contains_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.deflate');
|
||||
/**
|
||||
* @module ol/geom/flat/deflate
|
||||
*/
|
||||
var _ol_geom_flat_deflate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +11,7 @@ goog.provide('ol.geom.flat.deflate');
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} offset Offset.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinate = function(flatCoordinates, offset, coordinate, stride) {
|
||||
_ol_geom_flat_deflate_.coordinate = function(flatCoordinates, offset, coordinate, stride) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinate.length; i < ii; ++i) {
|
||||
flatCoordinates[offset++] = coordinate[i];
|
||||
@@ -24,7 +27,7 @@ ol.geom.flat.deflate.coordinate = function(flatCoordinates, offset, coordinate,
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} offset Offset.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinates = function(flatCoordinates, offset, coordinates, stride) {
|
||||
_ol_geom_flat_deflate_.coordinates = function(flatCoordinates, offset, coordinates, stride) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||
var coordinate = coordinates[i];
|
||||
@@ -45,12 +48,12 @@ ol.geom.flat.deflate.coordinates = function(flatCoordinates, offset, coordinates
|
||||
* @param {Array.<number>=} opt_ends Ends.
|
||||
* @return {Array.<number>} Ends.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinatess = function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
||||
_ol_geom_flat_deflate_.coordinatess = function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
||||
var ends = opt_ends ? opt_ends : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
|
||||
var end = ol.geom.flat.deflate.coordinates(
|
||||
var end = _ol_geom_flat_deflate_.coordinates(
|
||||
flatCoordinates, offset, coordinatess[j], stride);
|
||||
ends[i++] = end;
|
||||
offset = end;
|
||||
@@ -68,12 +71,12 @@ ol.geom.flat.deflate.coordinatess = function(flatCoordinates, offset, coordinate
|
||||
* @param {Array.<Array.<number>>=} opt_endss Endss.
|
||||
* @return {Array.<Array.<number>>} Endss.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinatesss = function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
||||
_ol_geom_flat_deflate_.coordinatesss = function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
||||
var endss = opt_endss ? opt_endss : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
|
||||
var ends = ol.geom.flat.deflate.coordinatess(
|
||||
var ends = _ol_geom_flat_deflate_.coordinatess(
|
||||
flatCoordinates, offset, coordinatesss[j], stride, endss[i]);
|
||||
endss[i++] = ends;
|
||||
offset = ends[ends.length - 1];
|
||||
@@ -81,3 +84,4 @@ ol.geom.flat.deflate.coordinatesss = function(flatCoordinates, offset, coordinat
|
||||
endss.length = i;
|
||||
return endss;
|
||||
};
|
||||
export default _ol_geom_flat_deflate_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.flip');
|
||||
/**
|
||||
* @module ol/geom/flat/flip
|
||||
*/
|
||||
var _ol_geom_flat_flip_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +13,7 @@ goog.provide('ol.geom.flat.flip');
|
||||
* @param {number=} opt_destOffset Destination offset.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.flip.flipXY = function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
|
||||
_ol_geom_flat_flip_.flipXY = function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
|
||||
var dest, destOffset;
|
||||
if (opt_dest !== undefined) {
|
||||
dest = opt_dest;
|
||||
@@ -31,3 +34,4 @@ ol.geom.flat.flip.flipXY = function(flatCoordinates, offset, end, stride, opt_de
|
||||
dest.length = destOffset;
|
||||
return dest;
|
||||
};
|
||||
export default _ol_geom_flat_flip_;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
goog.provide('ol.geom.flat.geodesic');
|
||||
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.proj');
|
||||
/**
|
||||
* @module ol/geom/flat/geodesic
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
import _ol_proj_ from '../../proj.js';
|
||||
var _ol_geom_flat_geodesic_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,7 +14,7 @@ goog.require('ol.proj');
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance) {
|
||||
_ol_geom_flat_geodesic_.line_ = function(interpolate, transform, squaredTolerance) {
|
||||
// FIXME reduce garbage generation
|
||||
// FIXME optimize stack operations
|
||||
|
||||
@@ -57,7 +59,7 @@ ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance)
|
||||
fracM = (fracA + fracB) / 2;
|
||||
geoM = interpolate(fracM);
|
||||
m = transform(geoM);
|
||||
if (ol.math.squaredSegmentDistance(m[0], m[1], a[0], a[1],
|
||||
if (_ol_math_.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
|
||||
@@ -88,20 +90,20 @@ ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance)
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.greatCircleArc = function(
|
||||
_ol_geom_flat_geodesic_.greatCircleArc = function(
|
||||
lon1, lat1, lon2, lat2, projection, squaredTolerance) {
|
||||
|
||||
var geoProjection = ol.proj.get('EPSG:4326');
|
||||
var geoProjection = _ol_proj_.get('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(_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 d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon;
|
||||
|
||||
return ol.geom.flat.geodesic.line_(
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
/**
|
||||
* @param {number} frac Fraction.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
@@ -117,11 +119,11 @@ 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 = _ol_math_.toRadians(lon1) +
|
||||
Math.atan2(Math.sin(theta) * sinD * cosLat1,
|
||||
cosD - sinLat1 * Math.sin(lat));
|
||||
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
|
||||
}, ol.proj.getTransform(geoProjection, projection), squaredTolerance);
|
||||
return [_ol_math_.toDegrees(lon), _ol_math_.toDegrees(lat)];
|
||||
}, _ol_proj_.getTransform(geoProjection, projection), squaredTolerance);
|
||||
};
|
||||
|
||||
|
||||
@@ -134,9 +136,9 @@ ol.geom.flat.geodesic.greatCircleArc = function(
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.meridian = function(lon, lat1, lat2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = ol.proj.get('EPSG:4326');
|
||||
return ol.geom.flat.geodesic.line_(
|
||||
_ol_geom_flat_geodesic_.meridian = function(lon, lat1, lat2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
/**
|
||||
* @param {number} frac Fraction.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
@@ -144,7 +146,7 @@ ol.geom.flat.geodesic.meridian = function(lon, lat1, lat2, projection, squaredTo
|
||||
function(frac) {
|
||||
return [lon, lat1 + ((lat2 - lat1) * frac)];
|
||||
},
|
||||
ol.proj.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
_ol_proj_.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
};
|
||||
|
||||
|
||||
@@ -157,9 +159,9 @@ ol.geom.flat.geodesic.meridian = function(lon, lat1, lat2, projection, squaredTo
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.parallel = function(lat, lon1, lon2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = ol.proj.get('EPSG:4326');
|
||||
return ol.geom.flat.geodesic.line_(
|
||||
_ol_geom_flat_geodesic_.parallel = function(lat, lon1, lon2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
/**
|
||||
* @param {number} frac Fraction.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
@@ -167,5 +169,6 @@ ol.geom.flat.geodesic.parallel = function(lat, lon1, lon2, projection, squaredTo
|
||||
function(frac) {
|
||||
return [lon1 + ((lon2 - lon1) * frac), lat];
|
||||
},
|
||||
ol.proj.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
_ol_proj_.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
};
|
||||
export default _ol_geom_flat_geodesic_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.inflate');
|
||||
/**
|
||||
* @module ol/geom/flat/inflate
|
||||
*/
|
||||
var _ol_geom_flat_inflate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -9,7 +12,7 @@ goog.provide('ol.geom.flat.inflate');
|
||||
* @param {Array.<ol.Coordinate>=} opt_coordinates Coordinates.
|
||||
* @return {Array.<ol.Coordinate>} Coordinates.
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinates = function(flatCoordinates, offset, end, stride, opt_coordinates) {
|
||||
_ol_geom_flat_inflate_.coordinates = function(flatCoordinates, offset, end, stride, opt_coordinates) {
|
||||
var coordinates = opt_coordinates !== undefined ? opt_coordinates : [];
|
||||
var i = 0;
|
||||
var j;
|
||||
@@ -29,13 +32,13 @@ ol.geom.flat.inflate.coordinates = function(flatCoordinates, offset, end, stride
|
||||
* @param {Array.<Array.<ol.Coordinate>>=} opt_coordinatess Coordinatess.
|
||||
* @return {Array.<Array.<ol.Coordinate>>} Coordinatess.
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinatess = function(flatCoordinates, offset, ends, stride, opt_coordinatess) {
|
||||
_ol_geom_flat_inflate_.coordinatess = function(flatCoordinates, offset, ends, stride, opt_coordinatess) {
|
||||
var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = ends.length; j < jj; ++j) {
|
||||
var end = ends[j];
|
||||
coordinatess[i++] = ol.geom.flat.inflate.coordinates(
|
||||
coordinatess[i++] = _ol_geom_flat_inflate_.coordinates(
|
||||
flatCoordinates, offset, end, stride, coordinatess[i]);
|
||||
offset = end;
|
||||
}
|
||||
@@ -53,16 +56,17 @@ ol.geom.flat.inflate.coordinatess = function(flatCoordinates, offset, ends, stri
|
||||
* Coordinatesss.
|
||||
* @return {Array.<Array.<Array.<ol.Coordinate>>>} Coordinatesss.
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinatesss = function(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
|
||||
_ol_geom_flat_inflate_.coordinatesss = function(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
|
||||
var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = endss.length; j < jj; ++j) {
|
||||
var ends = endss[j];
|
||||
coordinatesss[i++] = ol.geom.flat.inflate.coordinatess(
|
||||
coordinatesss[i++] = _ol_geom_flat_inflate_.coordinatess(
|
||||
flatCoordinates, offset, ends, stride, coordinatesss[i]);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
coordinatesss.length = i;
|
||||
return coordinatesss;
|
||||
};
|
||||
export default _ol_geom_flat_inflate_;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
goog.provide('ol.geom.flat.interiorpoint');
|
||||
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.geom.flat.contains');
|
||||
/**
|
||||
* @module ol/geom/flat/interiorpoint
|
||||
*/
|
||||
import _ol_array_ from '../../array.js';
|
||||
import _ol_geom_flat_contains_ from '../flat/contains.js';
|
||||
var _ol_geom_flat_interiorpoint_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,7 +19,7 @@ goog.require('ol.geom.flat.contains');
|
||||
* @return {Array.<number>} Destination point as XYM coordinate, where M is the
|
||||
* length of the horizontal intersection that the point belongs to.
|
||||
*/
|
||||
ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
||||
_ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
|
||||
ends, stride, flatCenters, flatCentersOffset, opt_dest) {
|
||||
var i, ii, x, x1, x2, y1, y2;
|
||||
var y = flatCenters[flatCentersOffset + 1];
|
||||
@@ -43,14 +45,14 @@ 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(_ol_array_.numberSafeCompareFunction);
|
||||
x1 = intersections[0];
|
||||
for (i = 1, ii = intersections.length; i < ii; ++i) {
|
||||
x2 = intersections[i];
|
||||
var segmentLength = Math.abs(x2 - x1);
|
||||
if (segmentLength > maxSegmentLength) {
|
||||
x = (x1 + x2) / 2;
|
||||
if (ol.geom.flat.contains.linearRingsContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingsContainsXY(
|
||||
flatCoordinates, offset, ends, stride, x, y)) {
|
||||
pointX = x;
|
||||
maxSegmentLength = segmentLength;
|
||||
@@ -81,14 +83,15 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
||||
* @return {Array.<number>} Interior points as XYM coordinates, where M is the
|
||||
* length of the horizontal intersection that the point belongs to.
|
||||
*/
|
||||
ol.geom.flat.interiorpoint.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) {
|
||||
_ol_geom_flat_interiorpoint_.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) {
|
||||
var interiorPoints = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
interiorPoints = ol.geom.flat.interiorpoint.linearRings(flatCoordinates,
|
||||
interiorPoints = _ol_geom_flat_interiorpoint_.linearRings(flatCoordinates,
|
||||
offset, ends, stride, flatCenters, 2 * i, interiorPoints);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return interiorPoints;
|
||||
};
|
||||
export default _ol_geom_flat_interiorpoint_;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
goog.provide('ol.geom.flat.interpolate');
|
||||
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.math');
|
||||
/**
|
||||
* @module ol/geom/flat/interpolate
|
||||
*/
|
||||
import _ol_array_ from '../../array.js';
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_interpolate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,7 +15,7 @@ goog.require('ol.math');
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Destination.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, stride, fraction, opt_dest) {
|
||||
_ol_geom_flat_interpolate_.lineString = function(flatCoordinates, offset, end, stride, fraction, opt_dest) {
|
||||
var pointX = NaN;
|
||||
var pointY = NaN;
|
||||
var n = (end - offset) / stride;
|
||||
@@ -40,14 +42,14 @@ ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, str
|
||||
y1 = y2;
|
||||
}
|
||||
var target = fraction * length;
|
||||
var index = ol.array.binarySearch(cumulativeLengths, target);
|
||||
var index = _ol_array_.binarySearch(cumulativeLengths, target);
|
||||
if (index < 0) {
|
||||
var t = (target - cumulativeLengths[-index - 2]) /
|
||||
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
|
||||
var o = offset + (-index - 2) * stride;
|
||||
pointX = ol.math.lerp(
|
||||
pointX = _ol_math_.lerp(
|
||||
flatCoordinates[o], flatCoordinates[o + stride], t);
|
||||
pointY = ol.math.lerp(
|
||||
pointY = _ol_math_.lerp(
|
||||
flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t);
|
||||
} else {
|
||||
pointX = flatCoordinates[offset + index * stride];
|
||||
@@ -73,7 +75,7 @@ ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, str
|
||||
* @param {boolean} extrapolate Extrapolate.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, offset, end, stride, m, extrapolate) {
|
||||
_ol_geom_flat_interpolate_.lineStringCoordinateAtM = function(flatCoordinates, offset, end, stride, m, extrapolate) {
|
||||
if (end == offset) {
|
||||
return null;
|
||||
}
|
||||
@@ -118,7 +120,7 @@ ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, off
|
||||
coordinate = [];
|
||||
var i;
|
||||
for (i = 0; i < stride - 1; ++i) {
|
||||
coordinate.push(ol.math.lerp(flatCoordinates[(lo - 1) * stride + i],
|
||||
coordinate.push(_ol_math_.lerp(flatCoordinates[(lo - 1) * stride + i],
|
||||
flatCoordinates[lo * stride + i], t));
|
||||
}
|
||||
coordinate.push(m);
|
||||
@@ -136,10 +138,10 @@ ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, off
|
||||
* @param {boolean} interpolate Interpolate.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineStringsCoordinateAtM = function(
|
||||
_ol_geom_flat_interpolate_.lineStringsCoordinateAtM = function(
|
||||
flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) {
|
||||
if (interpolate) {
|
||||
return ol.geom.flat.interpolate.lineStringCoordinateAtM(
|
||||
return _ol_geom_flat_interpolate_.lineStringCoordinateAtM(
|
||||
flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate);
|
||||
}
|
||||
var coordinate;
|
||||
@@ -170,10 +172,11 @@ ol.geom.flat.interpolate.lineStringsCoordinateAtM = function(
|
||||
if (m < flatCoordinates[offset + stride - 1]) {
|
||||
return null;
|
||||
} else if (m <= flatCoordinates[end - 1]) {
|
||||
return ol.geom.flat.interpolate.lineStringCoordinateAtM(
|
||||
return _ol_geom_flat_interpolate_.lineStringCoordinateAtM(
|
||||
flatCoordinates, offset, end, stride, m, false);
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
export default _ol_geom_flat_interpolate_;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
goog.provide('ol.geom.flat.intersectsextent');
|
||||
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.flat.contains');
|
||||
goog.require('ol.geom.flat.segments');
|
||||
/**
|
||||
* @module ol/geom/flat/intersectsextent
|
||||
*/
|
||||
import _ol_extent_ 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_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,13 +15,13 @@ goog.require('ol.geom.flat.segments');
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @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)) {
|
||||
_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)) {
|
||||
return false;
|
||||
}
|
||||
if (ol.extent.containsExtent(extent, coordinatesExtent)) {
|
||||
if (_ol_extent_.containsExtent(extent, coordinatesExtent)) {
|
||||
return true;
|
||||
}
|
||||
if (coordinatesExtent[0] >= extent[0] &&
|
||||
@@ -30,7 +32,7 @@ ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end
|
||||
coordinatesExtent[3] <= extent[3]) {
|
||||
return true;
|
||||
}
|
||||
return ol.geom.flat.segments.forEach(flatCoordinates, offset, end, stride,
|
||||
return _ol_geom_flat_segments_.forEach(flatCoordinates, offset, end, stride,
|
||||
/**
|
||||
* @param {ol.Coordinate} point1 Start point.
|
||||
* @param {ol.Coordinate} point2 End point.
|
||||
@@ -38,7 +40,7 @@ ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end
|
||||
* `false` otherwise.
|
||||
*/
|
||||
function(point1, point2) {
|
||||
return ol.extent.intersectsSegment(extent, point1, point2);
|
||||
return _ol_extent_.intersectsSegment(extent, point1, point2);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -51,10 +53,10 @@ ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.lineStrings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
_ol_geom_flat_intersectsextent_.lineStrings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
if (ol.geom.flat.intersectsextent.lineString(
|
||||
if (_ol_geom_flat_intersectsextent_.lineString(
|
||||
flatCoordinates, offset, ends[i], stride, extent)) {
|
||||
return true;
|
||||
}
|
||||
@@ -72,24 +74,24 @@ ol.geom.flat.intersectsextent.lineStrings = function(flatCoordinates, offset, en
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRing = function(flatCoordinates, offset, end, stride, extent) {
|
||||
if (ol.geom.flat.intersectsextent.lineString(
|
||||
_ol_geom_flat_intersectsextent_.linearRing = function(flatCoordinates, offset, end, stride, extent) {
|
||||
if (_ol_geom_flat_intersectsextent_.lineString(
|
||||
flatCoordinates, offset, end, stride, extent)) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[0], extent[1])) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[0], extent[3])) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[2], extent[1])) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[2], extent[3])) {
|
||||
return true;
|
||||
}
|
||||
@@ -105,8 +107,8 @@ ol.geom.flat.intersectsextent.linearRing = function(flatCoordinates, offset, end
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
if (!ol.geom.flat.intersectsextent.linearRing(
|
||||
_ol_geom_flat_intersectsextent_.linearRings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
if (!_ol_geom_flat_intersectsextent_.linearRing(
|
||||
flatCoordinates, offset, ends[0], stride, extent)) {
|
||||
return false;
|
||||
}
|
||||
@@ -115,7 +117,7 @@ ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, en
|
||||
}
|
||||
var i, ii;
|
||||
for (i = 1, ii = ends.length; i < ii; ++i) {
|
||||
if (ol.geom.flat.contains.linearRingContainsExtent(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsExtent(
|
||||
flatCoordinates, ends[i - 1], ends[i], stride, extent)) {
|
||||
return false;
|
||||
}
|
||||
@@ -132,11 +134,11 @@ ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, en
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRingss = function(flatCoordinates, offset, endss, stride, extent) {
|
||||
_ol_geom_flat_intersectsextent_.linearRingss = function(flatCoordinates, offset, endss, stride, extent) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
if (ol.geom.flat.intersectsextent.linearRings(
|
||||
if (_ol_geom_flat_intersectsextent_.linearRings(
|
||||
flatCoordinates, offset, ends, stride, extent)) {
|
||||
return true;
|
||||
}
|
||||
@@ -144,3 +146,4 @@ ol.geom.flat.intersectsextent.linearRingss = function(flatCoordinates, offset, e
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_intersectsextent_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.length');
|
||||
/**
|
||||
* @module ol/geom/flat/length
|
||||
*/
|
||||
var _ol_geom_flat_length_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +11,7 @@ goog.provide('ol.geom.flat.length');
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Length.
|
||||
*/
|
||||
ol.geom.flat.length.lineString = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_length_.lineString = function(flatCoordinates, offset, end, stride) {
|
||||
var x1 = flatCoordinates[offset];
|
||||
var y1 = flatCoordinates[offset + 1];
|
||||
var length = 0;
|
||||
@@ -31,11 +34,12 @@ ol.geom.flat.length.lineString = function(flatCoordinates, offset, end, stride)
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Perimeter.
|
||||
*/
|
||||
ol.geom.flat.length.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_length_.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
var perimeter =
|
||||
ol.geom.flat.length.lineString(flatCoordinates, offset, end, stride);
|
||||
_ol_geom_flat_length_.lineString(flatCoordinates, offset, end, stride);
|
||||
var dx = flatCoordinates[end - stride] - flatCoordinates[offset];
|
||||
var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];
|
||||
perimeter += Math.sqrt(dx * dx + dy * dy);
|
||||
return perimeter;
|
||||
};
|
||||
export default _ol_geom_flat_length_;
|
||||
|
||||
+16
-13
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.orient');
|
||||
|
||||
goog.require('ol.geom.flat.reverse');
|
||||
/**
|
||||
* @module ol/geom/flat/orient
|
||||
*/
|
||||
import _ol_geom_flat_reverse_ from '../flat/reverse.js';
|
||||
var _ol_geom_flat_orient_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +12,7 @@ goog.require('ol.geom.flat.reverse');
|
||||
* @param {number} stride Stride.
|
||||
* @return {boolean} Is clockwise.
|
||||
*/
|
||||
ol.geom.flat.orient.linearRingIsClockwise = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_orient_.linearRingIsClockwise = function(flatCoordinates, offset, end, stride) {
|
||||
// http://tinyurl.com/clockwise-method
|
||||
// https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp
|
||||
var edge = 0;
|
||||
@@ -40,12 +42,12 @@ ol.geom.flat.orient.linearRingIsClockwise = function(flatCoordinates, offset, en
|
||||
* (counter-clockwise exterior ring and clockwise interior rings).
|
||||
* @return {boolean} Rings are correctly oriented.
|
||||
*/
|
||||
ol.geom.flat.orient.linearRingsAreOriented = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.linearRingsAreOriented = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
var right = opt_right !== undefined ? opt_right : false;
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
|
||||
flatCoordinates, offset, end, stride);
|
||||
if (i === 0) {
|
||||
if ((right && isClockwise) || (!right && !isClockwise)) {
|
||||
@@ -75,10 +77,10 @@ ol.geom.flat.orient.linearRingsAreOriented = function(flatCoordinates, offset, e
|
||||
* (counter-clockwise exterior ring and clockwise interior rings).
|
||||
* @return {boolean} Rings are correctly oriented.
|
||||
*/
|
||||
ol.geom.flat.orient.linearRingssAreOriented = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.linearRingssAreOriented = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
if (!ol.geom.flat.orient.linearRingsAreOriented(
|
||||
if (!_ol_geom_flat_orient_.linearRingsAreOriented(
|
||||
flatCoordinates, offset, endss[i], stride, opt_right)) {
|
||||
return false;
|
||||
}
|
||||
@@ -100,18 +102,18 @@ ol.geom.flat.orient.linearRingssAreOriented = function(flatCoordinates, offset,
|
||||
* @param {boolean=} opt_right Follow the right-hand rule for orientation.
|
||||
* @return {number} End.
|
||||
*/
|
||||
ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.orientLinearRings = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
var right = opt_right !== undefined ? opt_right : false;
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
|
||||
flatCoordinates, offset, end, stride);
|
||||
var reverse = i === 0 ?
|
||||
(right && isClockwise) || (!right && !isClockwise) :
|
||||
(right && !isClockwise) || (!right && isClockwise);
|
||||
if (reverse) {
|
||||
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
|
||||
_ol_geom_flat_reverse_.coordinates(flatCoordinates, offset, end, stride);
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
@@ -132,11 +134,12 @@ ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends,
|
||||
* @param {boolean=} opt_right Follow the right-hand rule for orientation.
|
||||
* @return {number} End.
|
||||
*/
|
||||
ol.geom.flat.orient.orientLinearRingss = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.orientLinearRingss = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
offset = ol.geom.flat.orient.orientLinearRings(
|
||||
offset = _ol_geom_flat_orient_.orientLinearRings(
|
||||
flatCoordinates, offset, endss[i], stride, opt_right);
|
||||
}
|
||||
return offset;
|
||||
};
|
||||
export default _ol_geom_flat_orient_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.reverse');
|
||||
/**
|
||||
* @module ol/geom/flat/reverse
|
||||
*/
|
||||
var _ol_geom_flat_reverse_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -7,7 +10,7 @@ goog.provide('ol.geom.flat.reverse');
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
*/
|
||||
ol.geom.flat.reverse.coordinates = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_reverse_.coordinates = function(flatCoordinates, offset, end, stride) {
|
||||
while (offset < end - stride) {
|
||||
var i;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -19,3 +22,4 @@ ol.geom.flat.reverse.coordinates = function(flatCoordinates, offset, end, stride
|
||||
end -= stride;
|
||||
}
|
||||
};
|
||||
export default _ol_geom_flat_reverse_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.segments');
|
||||
/**
|
||||
* @module ol/geom/flat/segments
|
||||
*/
|
||||
var _ol_geom_flat_segments_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +19,7 @@ goog.provide('ol.geom.flat.segments');
|
||||
* @return {T|boolean} Value.
|
||||
* @template T,S
|
||||
*/
|
||||
ol.geom.flat.segments.forEach = function(flatCoordinates, offset, end, stride, callback, opt_this) {
|
||||
_ol_geom_flat_segments_.forEach = function(flatCoordinates, offset, end, stride, callback, opt_this) {
|
||||
var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
|
||||
var point2 = [];
|
||||
var ret;
|
||||
@@ -32,3 +35,4 @@ ol.geom.flat.segments.forEach = function(flatCoordinates, offset, end, stride, c
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_segments_;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @module ol/geom/flat/simplify
|
||||
*/
|
||||
// Based on simplify-js https://github.com/mourner/simplify-js
|
||||
// Copyright (c) 2012, Vladimir Agafonkin
|
||||
// All rights reserved.
|
||||
@@ -24,9 +27,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
goog.provide('ol.geom.flat.simplify');
|
||||
|
||||
goog.require('ol.math');
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_simplify_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -40,19 +42,19 @@ goog.require('ol.math');
|
||||
* coordinates.
|
||||
* @return {Array.<number>} Simplified line string.
|
||||
*/
|
||||
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_simplify_.lineString = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
|
||||
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
|
||||
opt_simplifiedFlatCoordinates : [];
|
||||
if (!highQuality) {
|
||||
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
|
||||
end = _ol_geom_flat_simplify_.radialDistance(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, 0);
|
||||
flatCoordinates = simplifiedFlatCoordinates;
|
||||
offset = 0;
|
||||
stride = 2;
|
||||
}
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker(
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.douglasPeucker(
|
||||
flatCoordinates, offset, end, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, 0);
|
||||
return simplifiedFlatCoordinates;
|
||||
@@ -70,7 +72,7 @@ ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
||||
* @param {number} simplifiedOffset Simplified offset.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
|
||||
var n = (end - offset) / stride;
|
||||
if (n < 3) {
|
||||
@@ -101,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 = _ol_math_.squaredSegmentDistance(
|
||||
x, y, x1, y1, x2, y2);
|
||||
if (squaredDistance > maxSquaredDistance) {
|
||||
index = i;
|
||||
@@ -142,13 +144,13 @@ ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
* @param {Array.<number>} simplifiedEnds Simplified ends.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.douglasPeuckers = function(flatCoordinates, offset,
|
||||
_ol_geom_flat_simplify_.douglasPeuckers = function(flatCoordinates, offset,
|
||||
ends, stride, squaredTolerance, simplifiedFlatCoordinates,
|
||||
simplifiedOffset, simplifiedEnds) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
simplifiedOffset = ol.geom.flat.simplify.douglasPeucker(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.douglasPeucker(
|
||||
flatCoordinates, offset, end, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset);
|
||||
simplifiedEnds.push(simplifiedOffset);
|
||||
@@ -170,14 +172,14 @@ ol.geom.flat.simplify.douglasPeuckers = function(flatCoordinates, offset,
|
||||
* @param {Array.<Array.<number>>} simplifiedEndss Simplified endss.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.douglasPeuckerss = function(
|
||||
_ol_geom_flat_simplify_.douglasPeuckerss = function(
|
||||
flatCoordinates, offset, endss, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedOffset = ol.geom.flat.simplify.douglasPeuckers(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.douglasPeuckers(
|
||||
flatCoordinates, offset, ends, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
|
||||
simplifiedEndss.push(simplifiedEnds);
|
||||
@@ -198,7 +200,7 @@ ol.geom.flat.simplify.douglasPeuckerss = function(
|
||||
* @param {number} simplifiedOffset Simplified offset.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_simplify_.radialDistance = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
|
||||
if (end <= offset + stride) {
|
||||
// zero or one point, no simplification possible, so copy and return
|
||||
@@ -219,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 (_ol_math_.squaredDistance(x1, y1, x2, y2) > squaredTolerance) {
|
||||
// copy point at offset
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = x2;
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = y2;
|
||||
@@ -241,7 +243,7 @@ ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end,
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @return {number} Rounded value.
|
||||
*/
|
||||
ol.geom.flat.simplify.snap = function(value, tolerance) {
|
||||
_ol_geom_flat_simplify_.snap = function(value, tolerance) {
|
||||
return tolerance * Math.round(value / tolerance);
|
||||
};
|
||||
|
||||
@@ -265,15 +267,15 @@ ol.geom.flat.simplify.snap = function(value, tolerance) {
|
||||
* @param {number} simplifiedOffset Simplified offset.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
_ol_geom_flat_simplify_.quantize = function(flatCoordinates, offset, end, stride,
|
||||
tolerance, simplifiedFlatCoordinates, simplifiedOffset) {
|
||||
// do nothing if the line is empty
|
||||
if (offset == end) {
|
||||
return simplifiedOffset;
|
||||
}
|
||||
// snap the first coordinate (P1)
|
||||
var x1 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);
|
||||
var y1 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);
|
||||
var x1 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset], tolerance);
|
||||
var y1 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset + 1], tolerance);
|
||||
offset += stride;
|
||||
// add the first coordinate to the output
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = x1;
|
||||
@@ -282,8 +284,8 @@ ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
// coordinate (P2)
|
||||
var x2, y2;
|
||||
do {
|
||||
x2 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);
|
||||
y2 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);
|
||||
x2 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset], tolerance);
|
||||
y2 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset + 1], tolerance);
|
||||
offset += stride;
|
||||
if (offset == end) {
|
||||
// all coordinates snap to the same value, the line collapses to a point
|
||||
@@ -298,8 +300,8 @@ ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
while (offset < end) {
|
||||
var x3, y3;
|
||||
// snap the next coordinate (P3)
|
||||
x3 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);
|
||||
y3 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);
|
||||
x3 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset], tolerance);
|
||||
y3 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset + 1], tolerance);
|
||||
offset += stride;
|
||||
// skip P3 if it is equal to P2
|
||||
if (x3 == x2 && y3 == y2) {
|
||||
@@ -351,14 +353,14 @@ ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
* @param {Array.<number>} simplifiedEnds Simplified ends.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.quantizes = function(
|
||||
_ol_geom_flat_simplify_.quantizes = function(
|
||||
flatCoordinates, offset, ends, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
simplifiedOffset = ol.geom.flat.simplify.quantize(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.quantize(
|
||||
flatCoordinates, offset, end, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset);
|
||||
@@ -381,7 +383,7 @@ ol.geom.flat.simplify.quantizes = function(
|
||||
* @param {Array.<Array.<number>>} simplifiedEndss Simplified endss.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.quantizess = function(
|
||||
_ol_geom_flat_simplify_.quantizess = function(
|
||||
flatCoordinates, offset, endss, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
|
||||
@@ -389,7 +391,7 @@ ol.geom.flat.simplify.quantizess = function(
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedOffset = ol.geom.flat.simplify.quantizes(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.quantizes(
|
||||
flatCoordinates, offset, ends, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
|
||||
@@ -398,3 +400,4 @@ ol.geom.flat.simplify.quantizess = function(
|
||||
}
|
||||
return simplifiedOffset;
|
||||
};
|
||||
export default _ol_geom_flat_simplify_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.straightchunk');
|
||||
/**
|
||||
* @module ol/geom/flat/straightchunk
|
||||
*/
|
||||
var _ol_geom_flat_straightchunk_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +13,7 @@ goog.provide('ol.geom.flat.straightchunk');
|
||||
* @return {Array.<number>} Start and end of the first suitable chunk of the
|
||||
* given `flatCoordinates`.
|
||||
*/
|
||||
ol.geom.flat.straightchunk.lineString = function(maxAngle, flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_straightchunk_.lineString = function(maxAngle, flatCoordinates, offset, end, stride) {
|
||||
var chunkStart = offset;
|
||||
var chunkEnd = offset;
|
||||
var chunkM = 0;
|
||||
@@ -47,3 +50,4 @@ ol.geom.flat.straightchunk.lineString = function(maxAngle, flatCoordinates, offs
|
||||
m += m23;
|
||||
return m > chunkM ? [start, i] : [chunkStart, chunkEnd];
|
||||
};
|
||||
export default _ol_geom_flat_straightchunk_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.textpath');
|
||||
|
||||
goog.require('ol.math');
|
||||
/**
|
||||
* @module ol/geom/flat/textpath
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_textpath_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,7 @@ goog.require('ol.math');
|
||||
* @return {Array.<Array.<*>>} The result array of null if `maxAngle` was
|
||||
* exceeded. Entries of the array are x, y, anchorX, angle, chunk.
|
||||
*/
|
||||
ol.geom.flat.textpath.lineString = function(
|
||||
_ol_geom_flat_textpath_.lineString = function(
|
||||
flatCoordinates, offset, end, stride, text, measure, startM, maxAngle) {
|
||||
var result = [];
|
||||
|
||||
@@ -65,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 = _ol_math_.lerp(x1, x2, interpolate);
|
||||
var y = _ol_math_.lerp(y1, y2, interpolate);
|
||||
if (previousAngle == angle) {
|
||||
if (reverse) {
|
||||
data[0] = x;
|
||||
@@ -89,3 +91,4 @@ ol.geom.flat.textpath.lineString = function(
|
||||
}
|
||||
return result;
|
||||
};
|
||||
export default _ol_geom_flat_textpath_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.topology');
|
||||
|
||||
goog.require('ol.geom.flat.area');
|
||||
/**
|
||||
* @module ol/geom/flat/topology
|
||||
*/
|
||||
import _ol_geom_flat_area_ from '../flat/area.js';
|
||||
var _ol_geom_flat_topology_ = {};
|
||||
|
||||
/**
|
||||
* Check if the linestring is a boundary.
|
||||
@@ -10,11 +12,12 @@ goog.require('ol.geom.flat.area');
|
||||
* @param {number} stride Stride.
|
||||
* @return {boolean} The linestring is a boundary.
|
||||
*/
|
||||
ol.geom.flat.topology.lineStringIsClosed = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_topology_.lineStringIsClosed = function(flatCoordinates, offset, end, stride) {
|
||||
var lastCoord = end - stride;
|
||||
if (flatCoordinates[offset] === flatCoordinates[lastCoord] &&
|
||||
flatCoordinates[offset + 1] === flatCoordinates[lastCoord + 1] && (end - offset) / stride > 3) {
|
||||
return !!ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride);
|
||||
return !!_ol_geom_flat_area_.linearRing(flatCoordinates, offset, end, stride);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_topology_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.transform');
|
||||
/**
|
||||
* @module ol/geom/flat/transform
|
||||
*/
|
||||
var _ol_geom_flat_transform_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +13,7 @@ goog.provide('ol.geom.flat.transform');
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.transform2D = function(flatCoordinates, offset, end, stride, transform, opt_dest) {
|
||||
_ol_geom_flat_transform_.transform2D = function(flatCoordinates, offset, end, stride, transform, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var i = 0;
|
||||
var j;
|
||||
@@ -37,7 +40,7 @@ ol.geom.flat.transform.transform2D = function(flatCoordinates, offset, end, stri
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.rotate = function(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {
|
||||
_ol_geom_flat_transform_.rotate = function(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var cos = Math.cos(angle);
|
||||
var sin = Math.sin(angle);
|
||||
@@ -72,7 +75,7 @@ ol.geom.flat.transform.rotate = function(flatCoordinates, offset, end, stride, a
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.scale = function(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {
|
||||
_ol_geom_flat_transform_.scale = function(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var anchorX = anchor[0];
|
||||
var anchorY = anchor[1];
|
||||
@@ -103,7 +106,7 @@ ol.geom.flat.transform.scale = function(flatCoordinates, offset, end, stride, sx
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.translate = function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
|
||||
_ol_geom_flat_transform_.translate = function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var i = 0;
|
||||
var j, k;
|
||||
@@ -119,3 +122,4 @@ ol.geom.flat.transform.translate = function(flatCoordinates, offset, end, stride
|
||||
}
|
||||
return dest;
|
||||
};
|
||||
export default _ol_geom_flat_transform_;
|
||||
|
||||
Reference in New Issue
Block a user