@maplat/tin 0.9.3 → 0.9.4

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.
@@ -1,4 +1,4 @@
1
- /*! @maplat/tin v0.9.3 | Kohei Otsuka, Code for History | license: Maplat Limited License 1.1 */
1
+ /*! @maplat/tin v0.9.4 | Kohei Otsuka, Code for History | license: Maplat Limited License 1.1 */
2
2
 
3
3
  /**
4
4
  * splaytree v3.1.0
@@ -1,41 +1,41 @@
1
- import { polygon, featureCollection } from "@turf/helpers";
2
- import Delaunator from "delaunator";
3
- import Constrainautor from "@kninnug/constrainautor";
4
- export default function (points, edges, z) {
5
- if (!edges)
6
- edges = [];
7
- if (typeof points !== "object" || points.type !== "FeatureCollection")
8
- throw "Argument points must be FeatureCollection";
9
- if (!Array.isArray(edges))
10
- throw "Argument points must be Array of Array";
11
- const del_points = points.features.map(point => point.geometry.coordinates);
12
- const del = Delaunator.from(del_points);
13
- let con;
14
- const tris = [];
15
- if (del.triangles.length !== 0 && edges.length !== 0) {
16
- con = new Constrainautor(del);
17
- con.constrainAll(edges);
18
- }
19
- for (let i = 0; i < del.triangles.length; i += 3) {
20
- tris.push([del.triangles[i], del.triangles[i + 1], del.triangles[i + 2]]);
21
- }
22
- const keys = ["a", "b", "c"];
23
- return featureCollection(tris.map(indices => {
24
- const properties = {};
25
- const coords = indices.map((index, i) => {
26
- const point = points.features[index];
27
- const xyz = point.geometry.coordinates;
28
- const coord = [xyz[0], xyz[1]];
29
- if (xyz.length === 3) {
30
- coord[2] = xyz[2];
31
- }
32
- else {
33
- properties[keys[i]] = point.properties[z];
34
- }
35
- return coord;
36
- });
37
- coords[3] = coords[0];
38
- return polygon([coords], properties);
39
- }));
40
- }
1
+ import { polygon, featureCollection } from "@turf/helpers";
2
+ import Delaunator from "delaunator";
3
+ import Constrainautor from "@kninnug/constrainautor";
4
+ export default function (points, edges, z) {
5
+ if (!edges)
6
+ edges = [];
7
+ if (typeof points !== "object" || points.type !== "FeatureCollection")
8
+ throw "Argument points must be FeatureCollection";
9
+ if (!Array.isArray(edges))
10
+ throw "Argument points must be Array of Array";
11
+ const del_points = points.features.map(point => point.geometry.coordinates);
12
+ const del = Delaunator.from(del_points);
13
+ let con;
14
+ const tris = [];
15
+ if (del.triangles.length !== 0 && edges.length !== 0) {
16
+ con = new Constrainautor(del);
17
+ con.constrainAll(edges);
18
+ }
19
+ for (let i = 0; i < del.triangles.length; i += 3) {
20
+ tris.push([del.triangles[i], del.triangles[i + 1], del.triangles[i + 2]]);
21
+ }
22
+ const keys = ["a", "b", "c"];
23
+ return featureCollection(tris.map(indices => {
24
+ const properties = {};
25
+ const coords = indices.map((index, i) => {
26
+ const point = points.features[index];
27
+ const xyz = point.geometry.coordinates;
28
+ const coord = [xyz[0], xyz[1]];
29
+ if (xyz.length === 3) {
30
+ coord[2] = xyz[2];
31
+ }
32
+ else {
33
+ properties[keys[i]] = point.properties[z];
34
+ }
35
+ return coord;
36
+ });
37
+ coords[3] = coords[0];
38
+ return polygon([coords], properties);
39
+ }));
40
+ }
41
41
  //# sourceMappingURL=constrained-tin.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maplat/tin",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "JavaScript library which performs homeomorphic conversion mutually between the coordinate systems of two planes based on the control points.",
5
5
  "main": "es5/index.js",
6
6
  "module": "lib/index.js",
@@ -75,7 +75,7 @@
75
75
  "typescript": "^4.7.2",
76
76
  "webpack": "^5.72.1",
77
77
  "webpack-cli": "^4.9.2",
78
- "webpack-dev-server": "^4.9.0",
78
+ "webpack-dev-server": "^4.11.1",
79
79
  "webpack-merge": "^5.8.0"
80
80
  }
81
81
  }