@turf/boolean-disjoint 6.4.0 → 7.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,12 +6,12 @@
6
6
 
7
7
  Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set.
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `feature1` **([Geometry][1] \| [Feature][2]<any>)** GeoJSON Feature or Geometry
12
- - `feature2` **([Geometry][1] \| [Feature][2]<any>)** GeoJSON Feature or Geometry
11
+ * `feature1` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
12
+ * `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
13
13
 
14
- **Examples**
14
+ ### Examples
15
15
 
16
16
  ```javascript
17
17
  var point = turf.point([2, 2]);
package/dist/es/index.js CHANGED
@@ -17,9 +17,9 @@ import polygonToLine from "@turf/polygon-to-line";
17
17
  * //=true
18
18
  */
19
19
  function booleanDisjoint(feature1, feature2) {
20
- var bool = true;
21
- flattenEach(feature1, function (flatten1) {
22
- flattenEach(feature2, function (flatten2) {
20
+ let bool = true;
21
+ flattenEach(feature1, (flatten1) => {
22
+ flattenEach(feature2, (flatten2) => {
23
23
  if (bool === false) {
24
24
  return false;
25
25
  }
@@ -74,7 +74,7 @@ function disjoint(geom1, geom2) {
74
74
  }
75
75
  // http://stackoverflow.com/a/11908158/1979085
76
76
  function isPointOnLine(lineString, pt) {
77
- for (var i = 0; i < lineString.coordinates.length - 1; i++) {
77
+ for (let i = 0; i < lineString.coordinates.length - 1; i++) {
78
78
  if (isPointOnLineSegment(lineString.coordinates[i], lineString.coordinates[i + 1], pt.coordinates)) {
79
79
  return true;
80
80
  }
@@ -82,20 +82,19 @@ function isPointOnLine(lineString, pt) {
82
82
  return false;
83
83
  }
84
84
  function isLineOnLine(lineString1, lineString2) {
85
- var doLinesIntersect = lineIntersect(lineString1, lineString2);
85
+ const doLinesIntersect = lineIntersect(lineString1, lineString2);
86
86
  if (doLinesIntersect.features.length > 0) {
87
87
  return true;
88
88
  }
89
89
  return false;
90
90
  }
91
91
  function isLineInPoly(polygon, lineString) {
92
- for (var _i = 0, _a = lineString.coordinates; _i < _a.length; _i++) {
93
- var coord = _a[_i];
92
+ for (const coord of lineString.coordinates) {
94
93
  if (booleanPointInPolygon(coord, polygon)) {
95
94
  return true;
96
95
  }
97
96
  }
98
- var doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon));
97
+ const doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon));
99
98
  if (doLinesIntersect.features.length > 0) {
100
99
  return true;
101
100
  }
@@ -112,30 +111,28 @@ function isLineInPoly(polygon, lineString) {
112
111
  * @returns {boolean} true/false
113
112
  */
114
113
  function isPolyInPoly(feature1, feature2) {
115
- for (var _i = 0, _a = feature1.coordinates[0]; _i < _a.length; _i++) {
116
- var coord1 = _a[_i];
114
+ for (const coord1 of feature1.coordinates[0]) {
117
115
  if (booleanPointInPolygon(coord1, feature2)) {
118
116
  return true;
119
117
  }
120
118
  }
121
- for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) {
122
- var coord2 = _c[_b];
119
+ for (const coord2 of feature2.coordinates[0]) {
123
120
  if (booleanPointInPolygon(coord2, feature1)) {
124
121
  return true;
125
122
  }
126
123
  }
127
- var doLinesIntersect = lineIntersect(polygonToLine(feature1), polygonToLine(feature2));
124
+ const doLinesIntersect = lineIntersect(polygonToLine(feature1), polygonToLine(feature2));
128
125
  if (doLinesIntersect.features.length > 0) {
129
126
  return true;
130
127
  }
131
128
  return false;
132
129
  }
133
130
  function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt) {
134
- var dxc = pt[0] - lineSegmentStart[0];
135
- var dyc = pt[1] - lineSegmentStart[1];
136
- var dxl = lineSegmentEnd[0] - lineSegmentStart[0];
137
- var dyl = lineSegmentEnd[1] - lineSegmentStart[1];
138
- var cross = dxc * dyl - dyc * dxl;
131
+ const dxc = pt[0] - lineSegmentStart[0];
132
+ const dyc = pt[1] - lineSegmentStart[1];
133
+ const dxl = lineSegmentEnd[0] - lineSegmentStart[0];
134
+ const dyl = lineSegmentEnd[1] - lineSegmentStart[1];
135
+ const cross = dxc * dyl - dyc * dxl;
139
136
  if (cross !== 0) {
140
137
  return false;
141
138
  }
@@ -1,4 +1,4 @@
1
- import { Feature, Geometry } from "@turf/helpers";
1
+ import { Feature, Geometry } from "geojson";
2
2
  /**
3
3
  * Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set.
4
4
  *
package/dist/js/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var boolean_point_in_polygon_1 = __importDefault(require("@turf/boolean-point-in-polygon"));
7
- var line_intersect_1 = __importDefault(require("@turf/line-intersect"));
8
- var meta_1 = require("@turf/meta");
9
- var polygon_to_line_1 = __importDefault(require("@turf/polygon-to-line"));
3
+ const tslib_1 = require("tslib");
4
+ const boolean_point_in_polygon_1 = tslib_1.__importDefault(require("@turf/boolean-point-in-polygon"));
5
+ const line_intersect_1 = tslib_1.__importDefault(require("@turf/line-intersect"));
6
+ const meta_1 = require("@turf/meta");
7
+ const polygon_to_line_1 = tslib_1.__importDefault(require("@turf/polygon-to-line"));
10
8
  /**
11
9
  * Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set.
12
10
  *
@@ -22,9 +20,9 @@ var polygon_to_line_1 = __importDefault(require("@turf/polygon-to-line"));
22
20
  * //=true
23
21
  */
24
22
  function booleanDisjoint(feature1, feature2) {
25
- var bool = true;
26
- meta_1.flattenEach(feature1, function (flatten1) {
27
- meta_1.flattenEach(feature2, function (flatten2) {
23
+ let bool = true;
24
+ meta_1.flattenEach(feature1, (flatten1) => {
25
+ meta_1.flattenEach(feature2, (flatten2) => {
28
26
  if (bool === false) {
29
27
  return false;
30
28
  }
@@ -79,7 +77,7 @@ function disjoint(geom1, geom2) {
79
77
  }
80
78
  // http://stackoverflow.com/a/11908158/1979085
81
79
  function isPointOnLine(lineString, pt) {
82
- for (var i = 0; i < lineString.coordinates.length - 1; i++) {
80
+ for (let i = 0; i < lineString.coordinates.length - 1; i++) {
83
81
  if (isPointOnLineSegment(lineString.coordinates[i], lineString.coordinates[i + 1], pt.coordinates)) {
84
82
  return true;
85
83
  }
@@ -87,20 +85,19 @@ function isPointOnLine(lineString, pt) {
87
85
  return false;
88
86
  }
89
87
  function isLineOnLine(lineString1, lineString2) {
90
- var doLinesIntersect = line_intersect_1.default(lineString1, lineString2);
88
+ const doLinesIntersect = line_intersect_1.default(lineString1, lineString2);
91
89
  if (doLinesIntersect.features.length > 0) {
92
90
  return true;
93
91
  }
94
92
  return false;
95
93
  }
96
94
  function isLineInPoly(polygon, lineString) {
97
- for (var _i = 0, _a = lineString.coordinates; _i < _a.length; _i++) {
98
- var coord = _a[_i];
95
+ for (const coord of lineString.coordinates) {
99
96
  if (boolean_point_in_polygon_1.default(coord, polygon)) {
100
97
  return true;
101
98
  }
102
99
  }
103
- var doLinesIntersect = line_intersect_1.default(lineString, polygon_to_line_1.default(polygon));
100
+ const doLinesIntersect = line_intersect_1.default(lineString, polygon_to_line_1.default(polygon));
104
101
  if (doLinesIntersect.features.length > 0) {
105
102
  return true;
106
103
  }
@@ -117,30 +114,28 @@ function isLineInPoly(polygon, lineString) {
117
114
  * @returns {boolean} true/false
118
115
  */
119
116
  function isPolyInPoly(feature1, feature2) {
120
- for (var _i = 0, _a = feature1.coordinates[0]; _i < _a.length; _i++) {
121
- var coord1 = _a[_i];
117
+ for (const coord1 of feature1.coordinates[0]) {
122
118
  if (boolean_point_in_polygon_1.default(coord1, feature2)) {
123
119
  return true;
124
120
  }
125
121
  }
126
- for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) {
127
- var coord2 = _c[_b];
122
+ for (const coord2 of feature2.coordinates[0]) {
128
123
  if (boolean_point_in_polygon_1.default(coord2, feature1)) {
129
124
  return true;
130
125
  }
131
126
  }
132
- var doLinesIntersect = line_intersect_1.default(polygon_to_line_1.default(feature1), polygon_to_line_1.default(feature2));
127
+ const doLinesIntersect = line_intersect_1.default(polygon_to_line_1.default(feature1), polygon_to_line_1.default(feature2));
133
128
  if (doLinesIntersect.features.length > 0) {
134
129
  return true;
135
130
  }
136
131
  return false;
137
132
  }
138
133
  function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt) {
139
- var dxc = pt[0] - lineSegmentStart[0];
140
- var dyc = pt[1] - lineSegmentStart[1];
141
- var dxl = lineSegmentEnd[0] - lineSegmentStart[0];
142
- var dyl = lineSegmentEnd[1] - lineSegmentStart[1];
143
- var cross = dxc * dyl - dyc * dxl;
134
+ const dxc = pt[0] - lineSegmentStart[0];
135
+ const dyc = pt[1] - lineSegmentStart[1];
136
+ const dxl = lineSegmentEnd[0] - lineSegmentStart[0];
137
+ const dyl = lineSegmentEnd[1] - lineSegmentStart[1];
138
+ const cross = dxc * dyl - dyc * dxl;
144
139
  if (cross !== 0) {
145
140
  return false;
146
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/boolean-disjoint",
3
- "version": "6.4.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf boolean-disjoint module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -16,6 +16,7 @@
16
16
  "type": "git",
17
17
  "url": "git://github.com/Turfjs/turf.git"
18
18
  },
19
+ "funding": "https://opencollective.com/turf",
19
20
  "publishConfig": {
20
21
  "access": "public"
21
22
  },
@@ -60,11 +61,12 @@
60
61
  "typescript": "*"
61
62
  },
62
63
  "dependencies": {
63
- "@turf/boolean-point-in-polygon": "^6.4.0",
64
- "@turf/helpers": "^6.4.0",
65
- "@turf/line-intersect": "^6.4.0",
66
- "@turf/meta": "^6.4.0",
67
- "@turf/polygon-to-line": "^6.4.0"
64
+ "@turf/boolean-point-in-polygon": "^7.0.0-alpha.0",
65
+ "@turf/helpers": "^7.0.0-alpha.0",
66
+ "@turf/line-intersect": "^7.0.0-alpha.0",
67
+ "@turf/meta": "^7.0.0-alpha.0",
68
+ "@turf/polygon-to-line": "^7.0.0-alpha.0",
69
+ "tslib": "^2.3.0"
68
70
  },
69
- "gitHead": "1e62773cfc88c627cca8effcb5c14cfb65a905ac"
71
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
70
72
  }