all these changes

This commit is contained in:
Jake Kasper
2026-04-09 13:19:47 -05:00
parent e83a51a051
commit 65315f36d1
39102 changed files with 7932979 additions and 567 deletions

20
frontend/node_modules/@turf/kinks/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2017 TurfJS
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

79
frontend/node_modules/@turf/kinks/README.md generated vendored Normal file
View File

@@ -0,0 +1,79 @@
# @turf/kinks
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## kinks
Takes a [linestring][1], [multi-linestring][2], [multi-polygon][3], or [polygon][4] and returns [points][5] at all self-intersections.
**Parameters**
- `featureIn` **[Feature][6]&lt;([LineString][7] \| [MultiLineString][8] \| [MultiPolygon][9] \| [Polygon][10])>** input feature
**Examples**
```javascript
var poly = turf.polygon([[
[-12.034835, 8.901183],
[-12.060413, 8.899826],
[-12.03638, 8.873199],
[-12.059383, 8.871418],
[-12.034835, 8.901183]
]]);
var kinks = turf.kinks(poly);
//addToMap
var addToMap = [poly, kinks]
```
Returns **[FeatureCollection][11]&lt;[Point][12]>** self-intersections
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[2]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[3]: https://tools.ietf.org/html/rfc7946#section-3.1.7
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[5]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[6]: https://tools.ietf.org/html/rfc7946#section-3.2
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[9]: https://tools.ietf.org/html/rfc7946#section-3.1.7
[10]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[11]: https://tools.ietf.org/html/rfc7946#section-3.3
[12]: https://tools.ietf.org/html/rfc7946#section-3.1.2
<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
---
This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
### Installation
Install this module individually:
```sh
$ npm install @turf/kinks
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```

136
frontend/node_modules/@turf/kinks/dist/es/index.js generated vendored Executable file
View File

@@ -0,0 +1,136 @@
import { point } from "@turf/helpers";
/**
* Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},
* {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and
* returns {@link Point|points} at all self-intersections.
*
* @name kinks
* @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature
* @returns {FeatureCollection<Point>} self-intersections
* @example
* var poly = turf.polygon([[
* [-12.034835, 8.901183],
* [-12.060413, 8.899826],
* [-12.03638, 8.873199],
* [-12.059383, 8.871418],
* [-12.034835, 8.901183]
* ]]);
*
* var kinks = turf.kinks(poly);
*
* //addToMap
* var addToMap = [poly, kinks]
*/
export default function kinks(featureIn) {
var coordinates;
var feature;
var results = {
type: "FeatureCollection",
features: [],
};
if (featureIn.type === "Feature") {
feature = featureIn.geometry;
}
else {
feature = featureIn;
}
if (feature.type === "LineString") {
coordinates = [feature.coordinates];
}
else if (feature.type === "MultiLineString") {
coordinates = feature.coordinates;
}
else if (feature.type === "MultiPolygon") {
coordinates = [].concat.apply([], feature.coordinates);
}
else if (feature.type === "Polygon") {
coordinates = feature.coordinates;
}
else {
throw new Error("Input must be a LineString, MultiLineString, " +
"Polygon, or MultiPolygon Feature or Geometry");
}
coordinates.forEach(function (line1) {
coordinates.forEach(function (line2) {
for (var i = 0; i < line1.length - 1; i++) {
// start iteration at i, intersections for k < i have already
// been checked in previous outer loop iterations
for (var k = i; k < line2.length - 1; k++) {
if (line1 === line2) {
// segments are adjacent and always share a vertex, not a kink
if (Math.abs(i - k) === 1) {
continue;
}
// first and last segment in a closed lineString or ring always share a vertex, not a kink
if (
// segments are first and last segment of lineString
i === 0 &&
k === line1.length - 2 &&
// lineString is closed
line1[i][0] === line1[line1.length - 1][0] &&
line1[i][1] === line1[line1.length - 1][1]) {
continue;
}
}
var intersection = lineIntersects(line1[i][0], line1[i][1], line1[i + 1][0], line1[i + 1][1], line2[k][0], line2[k][1], line2[k + 1][0], line2[k + 1][1]);
if (intersection) {
results.features.push(point([intersection[0], intersection[1]]));
}
}
}
});
});
return results;
}
// modified from http://jsfiddle.net/justin_c_rounds/Gd2S2/light/
function lineIntersects(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {
// if the lines intersect, the result contains the x and y of the
// intersection (treating the lines as infinite) and booleans for whether
// line segment 1 or line segment 2 contain the point
var denominator;
var a;
var b;
var numerator1;
var numerator2;
var result = {
x: null,
y: null,
onLine1: false,
onLine2: false,
};
denominator =
(line2EndY - line2StartY) * (line1EndX - line1StartX) -
(line2EndX - line2StartX) * (line1EndY - line1StartY);
if (denominator === 0) {
if (result.x !== null && result.y !== null) {
return result;
}
else {
return false;
}
}
a = line1StartY - line2StartY;
b = line1StartX - line2StartX;
numerator1 = (line2EndX - line2StartX) * a - (line2EndY - line2StartY) * b;
numerator2 = (line1EndX - line1StartX) * a - (line1EndY - line1StartY) * b;
a = numerator1 / denominator;
b = numerator2 / denominator;
// if we cast these lines infinitely in both directions, they intersect here:
result.x = line1StartX + a * (line1EndX - line1StartX);
result.y = line1StartY + a * (line1EndY - line1StartY);
// if line1 is a segment and line2 is infinite, they intersect if:
if (a >= 0 && a <= 1) {
result.onLine1 = true;
}
// if line2 is a segment and line1 is infinite, they intersect if:
if (b >= 0 && b <= 1) {
result.onLine2 = true;
}
// if line1 and line2 are segments, they intersect if both of the above are true
if (result.onLine1 && result.onLine2) {
return [result.x, result.y];
}
else {
return false;
}
}

View File

@@ -0,0 +1,288 @@
// Inlined from
// https://github.com/rowanwins/sweepline-intersections
// Needed to go through babel to transform ES6 classes
var commonjsGlobal = typeof globalThis !== "undefined"
? globalThis
: typeof window !== "undefined"
? window
: typeof global !== "undefined"
? global
: typeof self !== "undefined"
? self
: {};
function createCommonjsModule(fn, module) {
return (module = { exports: {} }), fn(module, module.exports), module.exports;
}
var tinyqueue = createCommonjsModule(function (module) {
(function (global, factory) {
module.exports = factory();
})(commonjsGlobal, function () {
var TinyQueue = function TinyQueue(data, compare) {
if (data === void 0)
data = [];
if (compare === void 0)
compare = defaultCompare;
this.data = data;
this.length = this.data.length;
this.compare = compare;
if (this.length > 0) {
for (var i = (this.length >> 1) - 1; i >= 0; i--) {
this._down(i);
}
}
};
TinyQueue.prototype.push = function push(item) {
this.data.push(item);
this.length++;
this._up(this.length - 1);
};
TinyQueue.prototype.pop = function pop() {
if (this.length === 0) {
return undefined;
}
var top = this.data[0];
var bottom = this.data.pop();
this.length--;
if (this.length > 0) {
this.data[0] = bottom;
this._down(0);
}
return top;
};
TinyQueue.prototype.peek = function peek() {
return this.data[0];
};
TinyQueue.prototype._up = function _up(pos) {
var ref = this;
var data = ref.data;
var compare = ref.compare;
var item = data[pos];
while (pos > 0) {
var parent = (pos - 1) >> 1;
var current = data[parent];
if (compare(item, current) >= 0) {
break;
}
data[pos] = current;
pos = parent;
}
data[pos] = item;
};
TinyQueue.prototype._down = function _down(pos) {
var ref = this;
var data = ref.data;
var compare = ref.compare;
var halfLength = this.length >> 1;
var item = data[pos];
while (pos < halfLength) {
var left = (pos << 1) + 1;
var best = data[left];
var right = left + 1;
if (right < this.length && compare(data[right], best) < 0) {
left = right;
best = data[right];
}
if (compare(best, item) >= 0) {
break;
}
data[pos] = best;
pos = left;
}
data[pos] = item;
};
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
return TinyQueue;
});
});
function checkWhichEventIsLeft(e1, e2) {
if (e1.p.x > e2.p.x)
return 1;
if (e1.p.x < e2.p.x)
return -1;
if (e1.p.y !== e2.p.y)
return e1.p.y > e2.p.y ? 1 : -1;
return 1;
}
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x)
return 1;
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x)
return -1;
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y)
return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
return 1;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
var Event = /*#__PURE__*/ (function () {
function Event(p, featureId, ringId, eventId) {
_classCallCheck(this, Event);
this.p = {
x: p[0],
y: p[1],
};
this.featureId = featureId;
this.ringId = ringId;
this.eventId = eventId;
this.otherEvent = null;
this.isLeftEndpoint = null;
}
_createClass(Event, [
{
key: "isSamePoint",
value: function isSamePoint(eventToCheck) {
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
},
},
]);
return Event;
})();
function fillEventQueue(geojson, eventQueue) {
if (geojson.type === "FeatureCollection") {
var features = geojson.features;
for (var i = 0; i < features.length; i++) {
processFeature(features[i], eventQueue);
}
}
else {
processFeature(geojson, eventQueue);
}
}
var featureId = 0;
var ringId = 0;
var eventId = 0;
function processFeature(featureOrGeometry, eventQueue) {
var geom = featureOrGeometry.type === "Feature"
? featureOrGeometry.geometry
: featureOrGeometry;
var coords = geom.coordinates; // standardise the input
if (geom.type === "Polygon" || geom.type === "MultiLineString")
coords = [coords];
if (geom.type === "LineString")
coords = [[coords]];
for (var i = 0; i < coords.length; i++) {
for (var ii = 0; ii < coords[i].length; ii++) {
var currentP = coords[i][ii][0];
var nextP = null;
ringId = ringId + 1;
for (var iii = 0; iii < coords[i][ii].length - 1; iii++) {
nextP = coords[i][ii][iii + 1];
var e1 = new Event(currentP, featureId, ringId, eventId);
var e2 = new Event(nextP, featureId, ringId, eventId + 1);
e1.otherEvent = e2;
e2.otherEvent = e1;
if (checkWhichEventIsLeft(e1, e2) > 0) {
e2.isLeftEndpoint = true;
e1.isLeftEndpoint = false;
}
else {
e1.isLeftEndpoint = true;
e2.isLeftEndpoint = false;
}
eventQueue.push(e1);
eventQueue.push(e2);
currentP = nextP;
eventId = eventId + 1;
}
}
}
featureId = featureId + 1;
}
var Segment = function Segment(event) {
_classCallCheck(this, Segment);
this.leftSweepEvent = event;
this.rightSweepEvent = event.otherEvent;
};
function testSegmentIntersect(seg1, seg2) {
if (seg1 === null || seg2 === null)
return false;
if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId &&
(seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) ||
seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) ||
seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) ||
seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) ||
seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent)))
return false;
var x1 = seg1.leftSweepEvent.p.x;
var y1 = seg1.leftSweepEvent.p.y;
var x2 = seg1.rightSweepEvent.p.x;
var y2 = seg1.rightSweepEvent.p.y;
var x3 = seg2.leftSweepEvent.p.x;
var y3 = seg2.leftSweepEvent.p.y;
var x4 = seg2.rightSweepEvent.p.x;
var y4 = seg2.rightSweepEvent.p.y;
var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
if (denom === 0) {
if (numeA === 0 && numeB === 0)
return false;
return false;
}
var uA = numeA / denom;
var uB = numeB / denom;
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
var x = x1 + uA * (x2 - x1);
var y = y1 + uA * (y2 - y1);
return [x, y];
}
return false;
}
function runCheck(eventQueue, ignoreSelfIntersections) {
ignoreSelfIntersections = ignoreSelfIntersections
? ignoreSelfIntersections
: false;
var intersectionPoints = [];
var outQueue = new tinyqueue([], checkWhichSegmentHasRightEndpointFirst);
while (eventQueue.length) {
var event = eventQueue.pop();
if (event.isLeftEndpoint) {
// debugEventAndSegments(event.p, outQueue.data)
var segment = new Segment(event);
for (var i = 0; i < outQueue.data.length; i++) {
var otherSeg = outQueue.data[i];
if (ignoreSelfIntersections) {
if (otherSeg.leftSweepEvent.featureId === event.featureId)
continue;
}
var intersection = testSegmentIntersect(segment, otherSeg);
if (intersection !== false)
intersectionPoints.push(intersection);
}
outQueue.push(segment);
}
else if (event.isLeftEndpoint === false) {
outQueue.pop(); // const seg = outQueue.pop()
// debugRemovingSegment(event.p, seg)
}
}
return intersectionPoints;
}
function sweeplineIntersections(geojson, ignoreSelfIntersections) {
var eventQueue = new tinyqueue([], checkWhichEventIsLeft);
fillEventQueue(geojson, eventQueue);
return runCheck(eventQueue, ignoreSelfIntersections);
}
export default sweeplineIntersections;

View File

@@ -0,0 +1 @@
{"type":"module"}

24
frontend/node_modules/@turf/kinks/dist/js/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,24 @@
import { Feature, FeatureCollection, LineString, MultiLineString, MultiPolygon, Point, Polygon } from "@turf/helpers";
/**
* Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},
* {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and
* returns {@link Point|points} at all self-intersections.
*
* @name kinks
* @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature
* @returns {FeatureCollection<Point>} self-intersections
* @example
* var poly = turf.polygon([[
* [-12.034835, 8.901183],
* [-12.060413, 8.899826],
* [-12.03638, 8.873199],
* [-12.059383, 8.871418],
* [-12.034835, 8.901183]
* ]]);
*
* var kinks = turf.kinks(poly);
*
* //addToMap
* var addToMap = [poly, kinks]
*/
export default function kinks<T extends LineString | MultiLineString | Polygon | MultiPolygon>(featureIn: Feature<T> | T): FeatureCollection<Point>;

139
frontend/node_modules/@turf/kinks/dist/js/index.js generated vendored Executable file
View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var helpers_1 = require("@turf/helpers");
/**
* Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},
* {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and
* returns {@link Point|points} at all self-intersections.
*
* @name kinks
* @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature
* @returns {FeatureCollection<Point>} self-intersections
* @example
* var poly = turf.polygon([[
* [-12.034835, 8.901183],
* [-12.060413, 8.899826],
* [-12.03638, 8.873199],
* [-12.059383, 8.871418],
* [-12.034835, 8.901183]
* ]]);
*
* var kinks = turf.kinks(poly);
*
* //addToMap
* var addToMap = [poly, kinks]
*/
function kinks(featureIn) {
var coordinates;
var feature;
var results = {
type: "FeatureCollection",
features: [],
};
if (featureIn.type === "Feature") {
feature = featureIn.geometry;
}
else {
feature = featureIn;
}
if (feature.type === "LineString") {
coordinates = [feature.coordinates];
}
else if (feature.type === "MultiLineString") {
coordinates = feature.coordinates;
}
else if (feature.type === "MultiPolygon") {
coordinates = [].concat.apply([], feature.coordinates);
}
else if (feature.type === "Polygon") {
coordinates = feature.coordinates;
}
else {
throw new Error("Input must be a LineString, MultiLineString, " +
"Polygon, or MultiPolygon Feature or Geometry");
}
coordinates.forEach(function (line1) {
coordinates.forEach(function (line2) {
for (var i = 0; i < line1.length - 1; i++) {
// start iteration at i, intersections for k < i have already
// been checked in previous outer loop iterations
for (var k = i; k < line2.length - 1; k++) {
if (line1 === line2) {
// segments are adjacent and always share a vertex, not a kink
if (Math.abs(i - k) === 1) {
continue;
}
// first and last segment in a closed lineString or ring always share a vertex, not a kink
if (
// segments are first and last segment of lineString
i === 0 &&
k === line1.length - 2 &&
// lineString is closed
line1[i][0] === line1[line1.length - 1][0] &&
line1[i][1] === line1[line1.length - 1][1]) {
continue;
}
}
var intersection = lineIntersects(line1[i][0], line1[i][1], line1[i + 1][0], line1[i + 1][1], line2[k][0], line2[k][1], line2[k + 1][0], line2[k + 1][1]);
if (intersection) {
results.features.push(helpers_1.point([intersection[0], intersection[1]]));
}
}
}
});
});
return results;
}
exports.default = kinks;
// modified from http://jsfiddle.net/justin_c_rounds/Gd2S2/light/
function lineIntersects(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {
// if the lines intersect, the result contains the x and y of the
// intersection (treating the lines as infinite) and booleans for whether
// line segment 1 or line segment 2 contain the point
var denominator;
var a;
var b;
var numerator1;
var numerator2;
var result = {
x: null,
y: null,
onLine1: false,
onLine2: false,
};
denominator =
(line2EndY - line2StartY) * (line1EndX - line1StartX) -
(line2EndX - line2StartX) * (line1EndY - line1StartY);
if (denominator === 0) {
if (result.x !== null && result.y !== null) {
return result;
}
else {
return false;
}
}
a = line1StartY - line2StartY;
b = line1StartX - line2StartX;
numerator1 = (line2EndX - line2StartX) * a - (line2EndY - line2StartY) * b;
numerator2 = (line1EndX - line1StartX) * a - (line1EndY - line1StartY) * b;
a = numerator1 / denominator;
b = numerator2 / denominator;
// if we cast these lines infinitely in both directions, they intersect here:
result.x = line1StartX + a * (line1EndX - line1StartX);
result.y = line1StartY + a * (line1EndY - line1StartY);
// if line1 is a segment and line2 is infinite, they intersect if:
if (a >= 0 && a <= 1) {
result.onLine1 = true;
}
// if line2 is a segment and line1 is infinite, they intersect if:
if (b >= 0 && b <= 1) {
result.onLine2 = true;
}
// if line1 and line2 are segments, they intersect if both of the above are true
if (result.onLine1 && result.onLine2) {
return [result.x, result.y];
}
else {
return false;
}
}

View File

@@ -0,0 +1,2 @@
export default sweeplineIntersections;
declare function sweeplineIntersections(geojson: any, ignoreSelfIntersections: any): any[][];

View File

@@ -0,0 +1,290 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Inlined from
// https://github.com/rowanwins/sweepline-intersections
// Needed to go through babel to transform ES6 classes
var commonjsGlobal = typeof globalThis !== "undefined"
? globalThis
: typeof window !== "undefined"
? window
: typeof global !== "undefined"
? global
: typeof self !== "undefined"
? self
: {};
function createCommonjsModule(fn, module) {
return (module = { exports: {} }), fn(module, module.exports), module.exports;
}
var tinyqueue = createCommonjsModule(function (module) {
(function (global, factory) {
module.exports = factory();
})(commonjsGlobal, function () {
var TinyQueue = function TinyQueue(data, compare) {
if (data === void 0)
data = [];
if (compare === void 0)
compare = defaultCompare;
this.data = data;
this.length = this.data.length;
this.compare = compare;
if (this.length > 0) {
for (var i = (this.length >> 1) - 1; i >= 0; i--) {
this._down(i);
}
}
};
TinyQueue.prototype.push = function push(item) {
this.data.push(item);
this.length++;
this._up(this.length - 1);
};
TinyQueue.prototype.pop = function pop() {
if (this.length === 0) {
return undefined;
}
var top = this.data[0];
var bottom = this.data.pop();
this.length--;
if (this.length > 0) {
this.data[0] = bottom;
this._down(0);
}
return top;
};
TinyQueue.prototype.peek = function peek() {
return this.data[0];
};
TinyQueue.prototype._up = function _up(pos) {
var ref = this;
var data = ref.data;
var compare = ref.compare;
var item = data[pos];
while (pos > 0) {
var parent = (pos - 1) >> 1;
var current = data[parent];
if (compare(item, current) >= 0) {
break;
}
data[pos] = current;
pos = parent;
}
data[pos] = item;
};
TinyQueue.prototype._down = function _down(pos) {
var ref = this;
var data = ref.data;
var compare = ref.compare;
var halfLength = this.length >> 1;
var item = data[pos];
while (pos < halfLength) {
var left = (pos << 1) + 1;
var best = data[left];
var right = left + 1;
if (right < this.length && compare(data[right], best) < 0) {
left = right;
best = data[right];
}
if (compare(best, item) >= 0) {
break;
}
data[pos] = best;
pos = left;
}
data[pos] = item;
};
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
return TinyQueue;
});
});
function checkWhichEventIsLeft(e1, e2) {
if (e1.p.x > e2.p.x)
return 1;
if (e1.p.x < e2.p.x)
return -1;
if (e1.p.y !== e2.p.y)
return e1.p.y > e2.p.y ? 1 : -1;
return 1;
}
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x)
return 1;
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x)
return -1;
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y)
return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
return 1;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
var Event = /*#__PURE__*/ (function () {
function Event(p, featureId, ringId, eventId) {
_classCallCheck(this, Event);
this.p = {
x: p[0],
y: p[1],
};
this.featureId = featureId;
this.ringId = ringId;
this.eventId = eventId;
this.otherEvent = null;
this.isLeftEndpoint = null;
}
_createClass(Event, [
{
key: "isSamePoint",
value: function isSamePoint(eventToCheck) {
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
},
},
]);
return Event;
})();
function fillEventQueue(geojson, eventQueue) {
if (geojson.type === "FeatureCollection") {
var features = geojson.features;
for (var i = 0; i < features.length; i++) {
processFeature(features[i], eventQueue);
}
}
else {
processFeature(geojson, eventQueue);
}
}
var featureId = 0;
var ringId = 0;
var eventId = 0;
function processFeature(featureOrGeometry, eventQueue) {
var geom = featureOrGeometry.type === "Feature"
? featureOrGeometry.geometry
: featureOrGeometry;
var coords = geom.coordinates; // standardise the input
if (geom.type === "Polygon" || geom.type === "MultiLineString")
coords = [coords];
if (geom.type === "LineString")
coords = [[coords]];
for (var i = 0; i < coords.length; i++) {
for (var ii = 0; ii < coords[i].length; ii++) {
var currentP = coords[i][ii][0];
var nextP = null;
ringId = ringId + 1;
for (var iii = 0; iii < coords[i][ii].length - 1; iii++) {
nextP = coords[i][ii][iii + 1];
var e1 = new Event(currentP, featureId, ringId, eventId);
var e2 = new Event(nextP, featureId, ringId, eventId + 1);
e1.otherEvent = e2;
e2.otherEvent = e1;
if (checkWhichEventIsLeft(e1, e2) > 0) {
e2.isLeftEndpoint = true;
e1.isLeftEndpoint = false;
}
else {
e1.isLeftEndpoint = true;
e2.isLeftEndpoint = false;
}
eventQueue.push(e1);
eventQueue.push(e2);
currentP = nextP;
eventId = eventId + 1;
}
}
}
featureId = featureId + 1;
}
var Segment = function Segment(event) {
_classCallCheck(this, Segment);
this.leftSweepEvent = event;
this.rightSweepEvent = event.otherEvent;
};
function testSegmentIntersect(seg1, seg2) {
if (seg1 === null || seg2 === null)
return false;
if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId &&
(seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) ||
seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) ||
seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) ||
seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) ||
seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent)))
return false;
var x1 = seg1.leftSweepEvent.p.x;
var y1 = seg1.leftSweepEvent.p.y;
var x2 = seg1.rightSweepEvent.p.x;
var y2 = seg1.rightSweepEvent.p.y;
var x3 = seg2.leftSweepEvent.p.x;
var y3 = seg2.leftSweepEvent.p.y;
var x4 = seg2.rightSweepEvent.p.x;
var y4 = seg2.rightSweepEvent.p.y;
var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
if (denom === 0) {
if (numeA === 0 && numeB === 0)
return false;
return false;
}
var uA = numeA / denom;
var uB = numeB / denom;
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
var x = x1 + uA * (x2 - x1);
var y = y1 + uA * (y2 - y1);
return [x, y];
}
return false;
}
function runCheck(eventQueue, ignoreSelfIntersections) {
ignoreSelfIntersections = ignoreSelfIntersections
? ignoreSelfIntersections
: false;
var intersectionPoints = [];
var outQueue = new tinyqueue([], checkWhichSegmentHasRightEndpointFirst);
while (eventQueue.length) {
var event = eventQueue.pop();
if (event.isLeftEndpoint) {
// debugEventAndSegments(event.p, outQueue.data)
var segment = new Segment(event);
for (var i = 0; i < outQueue.data.length; i++) {
var otherSeg = outQueue.data[i];
if (ignoreSelfIntersections) {
if (otherSeg.leftSweepEvent.featureId === event.featureId)
continue;
}
var intersection = testSegmentIntersect(segment, otherSeg);
if (intersection !== false)
intersectionPoints.push(intersection);
}
outQueue.push(segment);
}
else if (event.isLeftEndpoint === false) {
outQueue.pop(); // const seg = outQueue.pop()
// debugRemovingSegment(event.p, seg)
}
}
return intersectionPoints;
}
function sweeplineIntersections(geojson, ignoreSelfIntersections) {
var eventQueue = new tinyqueue([], checkWhichEventIsLeft);
fillEventQueue(geojson, eventQueue);
return runCheck(eventQueue, ignoreSelfIntersections);
}
exports.default = sweeplineIntersections;

62
frontend/node_modules/@turf/kinks/package.json generated vendored Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "@turf/kinks",
"version": "6.5.0",
"description": "turf kinks module",
"author": "Turf Authors",
"license": "MIT",
"bugs": {
"url": "https://github.com/Turfjs/turf/issues"
},
"homepage": "https://github.com/Turfjs/turf",
"repository": {
"type": "git",
"url": "git://github.com/Turfjs/turf.git"
},
"funding": "https://opencollective.com/turf",
"publishConfig": {
"access": "public"
},
"keywords": [
"turf",
"kinks",
"self-intersection"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "ts-node bench.js",
"build": "npm-run-all build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
"test": "npm-run-all test:*",
"test:tape": "ts-node -r esm test.js",
"test:types": "tsc --esModuleInterop --noEmit types.ts"
},
"devDependencies": {
"@turf/meta": "^6.5.0",
"benchmark": "*",
"load-json-file": "*",
"npm-run-all": "*",
"tape": "*",
"ts-node": "*",
"typescript": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/helpers": "^6.5.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
}