@maplat/transform 0.2.2 → 0.2.3
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/LICENSE +224 -224
- package/README.ja.md +68 -68
- package/README.md +143 -143
- package/dist/index.html +38 -38
- package/package.json +5 -5
- package/src/edgeutils.ts +47 -47
- package/src/geometry.ts +248 -248
- package/src/index.ts +566 -566
- package/src/triangulation.ts +179 -179
package/README.md
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
# Maplat Transform
|
|
2
|
-
|
|
3
|
-
A JavaScript library that performs coordinate transformation between two plane coordinate systems using transformation definitions generated by Maplat.
|
|
4
|
-
This is part of the [Maplat](https://github.com/code4history/Maplat/) project.
|
|
5
|
-
|
|
6
|
-
日本語のREADMEは[こちら](./README.ja.md)
|
|
7
|
-
|
|
8
|
-
## Key Features
|
|
9
|
-
|
|
10
|
-
- **Import Transformation Definitions:** Import and build internal structures from transformation definitions generated by Maplat
|
|
11
|
-
- **Bidirectional Coordinate Transformation:** Convert coordinates between two planes in both directions
|
|
12
|
-
- **Topology Preservation:** Maintains homeomorphic properties during transformation
|
|
13
|
-
- **Multiple Coordinate System Support:** Handles transformations between various coordinate systems including standard orthogonal coordinates, Y-axis inverted coordinates, and distorted coordinates like bird's-eye views
|
|
14
|
-
- **State Management:** Save and restore transformation states
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
### npm
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
npm install @maplat/transform
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### JSR (JavaScript Registry)
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
# For Deno
|
|
28
|
-
deno add @maplat/transform
|
|
29
|
-
|
|
30
|
-
# For npm/Node.js
|
|
31
|
-
npx jsr add @maplat/transform
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Deno
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
// Using JSR (recommended)
|
|
38
|
-
import { Transform } from "jsr:@maplat/transform";
|
|
39
|
-
|
|
40
|
-
// Using deno.json import map
|
|
41
|
-
import { Transform } from "@maplat/transform";
|
|
42
|
-
|
|
43
|
-
// Or directly from npm
|
|
44
|
-
import { Transform } from "npm:@maplat/transform";
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Browser
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<script src="https://unpkg.com/@maplat/transform/dist/maplat_transform.umd.js"></script>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Basic Usage
|
|
54
|
-
|
|
55
|
-
### Node.js/npm
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
import { Transform } from '@maplat/transform';
|
|
59
|
-
|
|
60
|
-
// Import transformation definition
|
|
61
|
-
const transform = new Transform();
|
|
62
|
-
transform.setCompiled(compiledData); // Apply transformation definition generated by Maplat
|
|
63
|
-
|
|
64
|
-
// Forward transformation (source → target coordinate system)
|
|
65
|
-
const transformed = transform.transform([100, 100], false);
|
|
66
|
-
|
|
67
|
-
// Backward transformation (target → source coordinate system)
|
|
68
|
-
const restored = transform.transform(transformed, true);
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Deno
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
import { Transform } from "../src/index.ts";
|
|
75
|
-
|
|
76
|
-
// Load compiled data from file
|
|
77
|
-
const compiledJson = await Deno.readTextFile('./compiled.json');
|
|
78
|
-
const compiledData = JSON.parse(compiledJson);
|
|
79
|
-
|
|
80
|
-
// Create and configure transform
|
|
81
|
-
const transform = new Transform();
|
|
82
|
-
transform.setCompiled(compiledData);
|
|
83
|
-
|
|
84
|
-
// Use the same API as Node.js
|
|
85
|
-
const transformed = transform.transform([100, 100], false);
|
|
86
|
-
const restored = transform.transform(transformed, true);
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Error Handling
|
|
90
|
-
|
|
91
|
-
The library may throw errors in the following cases:
|
|
92
|
-
|
|
93
|
-
- Transformation errors in strict mode
|
|
94
|
-
- Attempting backward transformation when not allowed
|
|
95
|
-
- Invalid data structure during transformation
|
|
96
|
-
|
|
97
|
-
If errors occur, the transformation definition data needs to be modified. Please use editor tools that incorporate [@maplat/tin](https://github.com/code4history/MaplatTin/) to modify transformation definitions.
|
|
98
|
-
|
|
99
|
-
## Development
|
|
100
|
-
|
|
101
|
-
### Running Tests
|
|
102
|
-
|
|
103
|
-
#### Node.js
|
|
104
|
-
```sh
|
|
105
|
-
npm test
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
#### Deno
|
|
109
|
-
```sh
|
|
110
|
-
deno task test
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Running Examples
|
|
114
|
-
|
|
115
|
-
#### Deno
|
|
116
|
-
```sh
|
|
117
|
-
# Run the example
|
|
118
|
-
deno run --allow-read examples/deno-example.ts
|
|
119
|
-
|
|
120
|
-
# Or using deno task
|
|
121
|
-
cd examples && deno run --allow-read deno-example.ts
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Important Note
|
|
125
|
-
|
|
126
|
-
This library specializes in executing coordinate transformations and does not include functionality for generating or editing transformation definitions. If you need to create or edit transformation definitions, please use the [@maplat/tin](https://github.com/code4history/MaplatTin/) package.
|
|
127
|
-
|
|
128
|
-
## Deno Support
|
|
129
|
-
|
|
130
|
-
This library fully supports Deno. See the [Deno Usage Guide](./docs/DENO_USAGE.md) for detailed instructions on using MaplatTransform with Deno.
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
|
|
134
|
-
Maplat Limited License 1.1
|
|
135
|
-
|
|
136
|
-
Copyright (c) 2024 Code for History
|
|
137
|
-
|
|
138
|
-
### Developers
|
|
139
|
-
|
|
140
|
-
- Kohei Otsuka
|
|
141
|
-
- Code for History
|
|
142
|
-
|
|
143
|
-
We welcome your contributions! Feel free to submit [issues and pull requests](https://github.com/code4history/MaplatTransform/issues).
|
|
1
|
+
# Maplat Transform
|
|
2
|
+
|
|
3
|
+
A JavaScript library that performs coordinate transformation between two plane coordinate systems using transformation definitions generated by Maplat.
|
|
4
|
+
This is part of the [Maplat](https://github.com/code4history/Maplat/) project.
|
|
5
|
+
|
|
6
|
+
日本語のREADMEは[こちら](./README.ja.md)
|
|
7
|
+
|
|
8
|
+
## Key Features
|
|
9
|
+
|
|
10
|
+
- **Import Transformation Definitions:** Import and build internal structures from transformation definitions generated by Maplat
|
|
11
|
+
- **Bidirectional Coordinate Transformation:** Convert coordinates between two planes in both directions
|
|
12
|
+
- **Topology Preservation:** Maintains homeomorphic properties during transformation
|
|
13
|
+
- **Multiple Coordinate System Support:** Handles transformations between various coordinate systems including standard orthogonal coordinates, Y-axis inverted coordinates, and distorted coordinates like bird's-eye views
|
|
14
|
+
- **State Management:** Save and restore transformation states
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### npm
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install @maplat/transform
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### JSR (JavaScript Registry)
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
# For Deno
|
|
28
|
+
deno add @maplat/transform
|
|
29
|
+
|
|
30
|
+
# For npm/Node.js
|
|
31
|
+
npx jsr add @maplat/transform
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Deno
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// Using JSR (recommended)
|
|
38
|
+
import { Transform } from "jsr:@maplat/transform";
|
|
39
|
+
|
|
40
|
+
// Using deno.json import map
|
|
41
|
+
import { Transform } from "@maplat/transform";
|
|
42
|
+
|
|
43
|
+
// Or directly from npm
|
|
44
|
+
import { Transform } from "npm:@maplat/transform";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Browser
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<script src="https://unpkg.com/@maplat/transform/dist/maplat_transform.umd.js"></script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Basic Usage
|
|
54
|
+
|
|
55
|
+
### Node.js/npm
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import { Transform } from '@maplat/transform';
|
|
59
|
+
|
|
60
|
+
// Import transformation definition
|
|
61
|
+
const transform = new Transform();
|
|
62
|
+
transform.setCompiled(compiledData); // Apply transformation definition generated by Maplat
|
|
63
|
+
|
|
64
|
+
// Forward transformation (source → target coordinate system)
|
|
65
|
+
const transformed = transform.transform([100, 100], false);
|
|
66
|
+
|
|
67
|
+
// Backward transformation (target → source coordinate system)
|
|
68
|
+
const restored = transform.transform(transformed, true);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Deno
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { Transform } from "../src/index.ts";
|
|
75
|
+
|
|
76
|
+
// Load compiled data from file
|
|
77
|
+
const compiledJson = await Deno.readTextFile('./compiled.json');
|
|
78
|
+
const compiledData = JSON.parse(compiledJson);
|
|
79
|
+
|
|
80
|
+
// Create and configure transform
|
|
81
|
+
const transform = new Transform();
|
|
82
|
+
transform.setCompiled(compiledData);
|
|
83
|
+
|
|
84
|
+
// Use the same API as Node.js
|
|
85
|
+
const transformed = transform.transform([100, 100], false);
|
|
86
|
+
const restored = transform.transform(transformed, true);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Error Handling
|
|
90
|
+
|
|
91
|
+
The library may throw errors in the following cases:
|
|
92
|
+
|
|
93
|
+
- Transformation errors in strict mode
|
|
94
|
+
- Attempting backward transformation when not allowed
|
|
95
|
+
- Invalid data structure during transformation
|
|
96
|
+
|
|
97
|
+
If errors occur, the transformation definition data needs to be modified. Please use editor tools that incorporate [@maplat/tin](https://github.com/code4history/MaplatTin/) to modify transformation definitions.
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
### Running Tests
|
|
102
|
+
|
|
103
|
+
#### Node.js
|
|
104
|
+
```sh
|
|
105
|
+
npm test
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Deno
|
|
109
|
+
```sh
|
|
110
|
+
deno task test
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Running Examples
|
|
114
|
+
|
|
115
|
+
#### Deno
|
|
116
|
+
```sh
|
|
117
|
+
# Run the example
|
|
118
|
+
deno run --allow-read examples/deno-example.ts
|
|
119
|
+
|
|
120
|
+
# Or using deno task
|
|
121
|
+
cd examples && deno run --allow-read deno-example.ts
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Important Note
|
|
125
|
+
|
|
126
|
+
This library specializes in executing coordinate transformations and does not include functionality for generating or editing transformation definitions. If you need to create or edit transformation definitions, please use the [@maplat/tin](https://github.com/code4history/MaplatTin/) package.
|
|
127
|
+
|
|
128
|
+
## Deno Support
|
|
129
|
+
|
|
130
|
+
This library fully supports Deno. See the [Deno Usage Guide](./docs/DENO_USAGE.md) for detailed instructions on using MaplatTransform with Deno.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
Maplat Limited License 1.1
|
|
135
|
+
|
|
136
|
+
Copyright (c) 2024 Code for History
|
|
137
|
+
|
|
138
|
+
### Developers
|
|
139
|
+
|
|
140
|
+
- Kohei Otsuka
|
|
141
|
+
- Code for History
|
|
142
|
+
|
|
143
|
+
We welcome your contributions! Feel free to submit [issues and pull requests](https://github.com/code4history/MaplatTransform/issues).
|
package/dist/index.html
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>MaplatTransform Test</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>MaplatTransform Test</h1>
|
|
9
|
-
<div id="output"></div>
|
|
10
|
-
<script type="module">
|
|
11
|
-
import { Transform as Tin } from '/src/index.ts';
|
|
12
|
-
|
|
13
|
-
const tin = new Tin({
|
|
14
|
-
bounds: [[100, 50], [150, 150], [150, 200], [60, 190], [50, 100]],
|
|
15
|
-
strictMode: Tin.MODE_STRICT
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
tin.setPoints([
|
|
19
|
-
[[80, 90], [160, -90]],
|
|
20
|
-
[[120, 120], [240, -120]],
|
|
21
|
-
[[100, 140], [200, -140]],
|
|
22
|
-
[[130, 180], [260, -180]],
|
|
23
|
-
[[70, 150], [140, -150]]
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
tin.updateTinAsync().then(() => {
|
|
27
|
-
const output = document.getElementById('output');
|
|
28
|
-
const result1 = tin.transform([140, 150]);
|
|
29
|
-
const result2 = tin.transform(result1, true);
|
|
30
|
-
|
|
31
|
-
output.innerHTML = `
|
|
32
|
-
<h2>Test Results:</h2>
|
|
33
|
-
<p>Forward transform [140, 150] => [${result1.join(', ')}]</p>
|
|
34
|
-
<p>Backward transform [${result1.join(', ')}] => [${result2.join(', ')}]</p>
|
|
35
|
-
`;
|
|
36
|
-
});
|
|
37
|
-
</script>
|
|
38
|
-
</body>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="ja">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>MaplatTransform Test</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>MaplatTransform Test</h1>
|
|
9
|
+
<div id="output"></div>
|
|
10
|
+
<script type="module">
|
|
11
|
+
import { Transform as Tin } from '/src/index.ts';
|
|
12
|
+
|
|
13
|
+
const tin = new Tin({
|
|
14
|
+
bounds: [[100, 50], [150, 150], [150, 200], [60, 190], [50, 100]],
|
|
15
|
+
strictMode: Tin.MODE_STRICT
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
tin.setPoints([
|
|
19
|
+
[[80, 90], [160, -90]],
|
|
20
|
+
[[120, 120], [240, -120]],
|
|
21
|
+
[[100, 140], [200, -140]],
|
|
22
|
+
[[130, 180], [260, -180]],
|
|
23
|
+
[[70, 150], [140, -150]]
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
tin.updateTinAsync().then(() => {
|
|
27
|
+
const output = document.getElementById('output');
|
|
28
|
+
const result1 = tin.transform([140, 150]);
|
|
29
|
+
const result2 = tin.transform(result1, true);
|
|
30
|
+
|
|
31
|
+
output.innerHTML = `
|
|
32
|
+
<h2>Test Results:</h2>
|
|
33
|
+
<p>Forward transform [140, 150] => [${result1.join(', ')}]</p>
|
|
34
|
+
<p>Backward transform [${result1.join(', ')}] => [${result2.join(', ')}]</p>
|
|
35
|
+
`;
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
</body>
|
|
39
39
|
</html>
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.3",
|
|
8
8
|
"description": "A JavaScript library that performs coordinate transformation between two plane coordinate systems using transformation definitions generated by Maplat.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/maplat_transform.cjs",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@types/node": "^22.10.2",
|
|
68
68
|
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
69
69
|
"@typescript-eslint/parser": "^8.18.2",
|
|
70
|
-
"@vitest/coverage-v8": "^
|
|
70
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
71
71
|
"cross-env": "^7.0.3",
|
|
72
72
|
"eslint": "^9.17.0",
|
|
73
73
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"jsdom": "^25.0.1",
|
|
76
76
|
"prettier": "^3.4.2",
|
|
77
77
|
"typescript": "^5.7.2",
|
|
78
|
-
"vite": "^
|
|
78
|
+
"vite": "^6.3.5",
|
|
79
79
|
"vite-plugin-dts": "^4.4.0",
|
|
80
|
-
"vitest": "^
|
|
80
|
+
"vitest": "^3.2.4"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@turf/boolean-point-in-polygon": "^7.2.0",
|
|
84
84
|
"@turf/helpers": "7.2.0",
|
|
85
85
|
"@turf/invariant": "^7.2.0"
|
|
86
86
|
}
|
|
87
|
-
}
|
|
87
|
+
}
|
package/src/edgeutils.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import type { Position } from "geojson";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* エッジの終点を表す型
|
|
5
|
-
* [始点のインデックス, 終点のインデックス]
|
|
6
|
-
*/
|
|
7
|
-
export type Edge = [number, number];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* エッジセットの型
|
|
11
|
-
* [始点と終点の間の中間点群(地図座標系),
|
|
12
|
-
* 始点と終点の間の中間点群(変換先座標系),
|
|
13
|
-
* 始点と終点のインデックスペア]
|
|
14
|
-
*/
|
|
15
|
-
export type EdgeSet = [Position[], Position[], Edge];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 古いバージョンのエッジセット型
|
|
19
|
-
* @deprecated 2.00703以降は EdgeSet を使用
|
|
20
|
-
*/
|
|
21
|
-
export type EdgeSetLegacy = {
|
|
22
|
-
illstNodes: Position[];
|
|
23
|
-
mercNodes: Position[];
|
|
24
|
-
startEnd: Edge;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* エッジセットを正規化する
|
|
29
|
-
* 古いバージョンのフォーマットを新しいフォーマットに変換する
|
|
30
|
-
*
|
|
31
|
-
* @param edges エッジセット配列
|
|
32
|
-
* @param version バージョン番号(オプション)
|
|
33
|
-
* @returns 正規化されたエッジセット配列
|
|
34
|
-
*/
|
|
35
|
-
function normalizeEdges(
|
|
36
|
-
edges: EdgeSet[] | EdgeSetLegacy[],
|
|
37
|
-
version?: number
|
|
38
|
-
): EdgeSet[] {
|
|
39
|
-
if ((version && version >= 2.00703) || Array.isArray(edges[0]))
|
|
40
|
-
return edges as EdgeSet[];
|
|
41
|
-
return (edges as EdgeSetLegacy[]).map(edge => [
|
|
42
|
-
edge.illstNodes,
|
|
43
|
-
edge.mercNodes,
|
|
44
|
-
edge.startEnd
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
|
|
1
|
+
import type { Position } from "geojson";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* エッジの終点を表す型
|
|
5
|
+
* [始点のインデックス, 終点のインデックス]
|
|
6
|
+
*/
|
|
7
|
+
export type Edge = [number, number];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* エッジセットの型
|
|
11
|
+
* [始点と終点の間の中間点群(地図座標系),
|
|
12
|
+
* 始点と終点の間の中間点群(変換先座標系),
|
|
13
|
+
* 始点と終点のインデックスペア]
|
|
14
|
+
*/
|
|
15
|
+
export type EdgeSet = [Position[], Position[], Edge];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 古いバージョンのエッジセット型
|
|
19
|
+
* @deprecated 2.00703以降は EdgeSet を使用
|
|
20
|
+
*/
|
|
21
|
+
export type EdgeSetLegacy = {
|
|
22
|
+
illstNodes: Position[];
|
|
23
|
+
mercNodes: Position[];
|
|
24
|
+
startEnd: Edge;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* エッジセットを正規化する
|
|
29
|
+
* 古いバージョンのフォーマットを新しいフォーマットに変換する
|
|
30
|
+
*
|
|
31
|
+
* @param edges エッジセット配列
|
|
32
|
+
* @param version バージョン番号(オプション)
|
|
33
|
+
* @returns 正規化されたエッジセット配列
|
|
34
|
+
*/
|
|
35
|
+
function normalizeEdges(
|
|
36
|
+
edges: EdgeSet[] | EdgeSetLegacy[],
|
|
37
|
+
version?: number
|
|
38
|
+
): EdgeSet[] {
|
|
39
|
+
if ((version && version >= 2.00703) || Array.isArray(edges[0]))
|
|
40
|
+
return edges as EdgeSet[];
|
|
41
|
+
return (edges as EdgeSetLegacy[]).map(edge => [
|
|
42
|
+
edge.illstNodes,
|
|
43
|
+
edge.mercNodes,
|
|
44
|
+
edge.startEnd
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
48
|
export { normalizeEdges };
|