@maplat/tin 0.11.0 → 0.11.2
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.ja.md +218 -120
- package/README.md +219 -121
- package/dist/constrained-tin.d.ts +29 -0
- package/dist/index.d.ts +17 -196
- package/dist/kinks.d.ts +8 -0
- package/dist/searchutils.d.ts +21 -0
- package/dist/tin.cjs +3 -0
- package/dist/tin.d.ts +100 -0
- package/dist/tin.js +2194 -0
- package/dist/tin.umd.js +3 -0
- package/dist/vertexutils.d.ts +24 -0
- package/package.json +99 -87
- package/src/constrained-tin.ts +23 -17
- package/src/index.ts +36 -929
- package/src/kinks.ts +41 -35
- package/src/searchutils.ts +16 -15
- package/src/tin.ts +1027 -0
- package/src/types/constrainautor.d.ts +2 -2
- package/src/types/kinks.d.ts +49 -0
- package/src/types/tin.d.ts +54 -0
- package/src/vertexutils.ts +34 -27
- package/dist/maplat_tin.cjs +0 -3
- package/dist/maplat_tin.js +0 -3291
- package/dist/maplat_tin.umd.js +0 -3
package/README.md
CHANGED
|
@@ -1,122 +1,220 @@
|
|
|
1
|
-
# Maplat Tin
|
|
2
|
-
|
|
3
|
-
A JavaScript library that defines and executes homeomorphic conversion between two plane coordinate systems based on control points.
|
|
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
|
-
- **Generate Transformation Definitions:** Create coordinate transformation definitions based on control points and edge constraints
|
|
11
|
-
- **Bidirectional Coordinate Transformation:** Convert coordinates between two planes in both directions
|
|
12
|
-
- **Topology Preservation:** Maintains homeomorphic properties during transformation
|
|
13
|
-
- **Flexible Configuration:**
|
|
14
|
-
- Vertex handling modes (normal/bird's-eye view)
|
|
15
|
-
- Topology check modes (strict/auto/loose)
|
|
16
|
-
- Y-axis direction control
|
|
17
|
-
- **Edge Constraints:** Ability to specify constrained edges for more accurate transformation
|
|
18
|
-
- **State Management:** Save and restore transformation definitions
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
### npm
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
# Install the main package
|
|
26
|
-
npm install @maplat/tin
|
|
27
|
-
|
|
28
|
-
# Install required dependency
|
|
29
|
-
npm install delaunator
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
###
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
tin.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
1
|
+
# Maplat Tin
|
|
2
|
+
|
|
3
|
+
A JavaScript library that defines and executes homeomorphic conversion between two plane coordinate systems based on control points.
|
|
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
|
+
- **Generate Transformation Definitions:** Create coordinate transformation definitions based on control points and edge constraints
|
|
11
|
+
- **Bidirectional Coordinate Transformation:** Convert coordinates between two planes in both directions
|
|
12
|
+
- **Topology Preservation:** Maintains homeomorphic properties during transformation
|
|
13
|
+
- **Flexible Configuration:**
|
|
14
|
+
- Vertex handling modes (normal/bird's-eye view)
|
|
15
|
+
- Topology check modes (strict/auto/loose)
|
|
16
|
+
- Y-axis direction control
|
|
17
|
+
- **Edge Constraints:** Ability to specify constrained edges for more accurate transformation
|
|
18
|
+
- **State Management:** Save and restore transformation definitions
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### npm
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
# Install the main package
|
|
26
|
+
npm install @maplat/tin
|
|
27
|
+
|
|
28
|
+
# Install required dependency
|
|
29
|
+
npm install delaunator
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### JSR (JavaScript Registry)
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
# For Deno
|
|
36
|
+
deno add @maplat/tin
|
|
37
|
+
|
|
38
|
+
# For npm/Node.js
|
|
39
|
+
npx jsr add @maplat/tin
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Deno
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// Using JSR (recommended)
|
|
46
|
+
import Tin from "jsr:@maplat/tin";
|
|
47
|
+
|
|
48
|
+
// Using deno.json import map
|
|
49
|
+
import Tin from "@maplat/tin";
|
|
50
|
+
|
|
51
|
+
// Or directly from npm
|
|
52
|
+
import Tin from "npm:@maplat/tin@0.11.2";
|
|
53
|
+
|
|
54
|
+
// Use the library
|
|
55
|
+
const tin = new Tin({
|
|
56
|
+
wh: [500, 500],
|
|
57
|
+
yaxisMode: Tin.YAXIS_FOLLOW
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Development Setup
|
|
62
|
+
|
|
63
|
+
This project supports using local dependencies for development. We recommend using `yalc` for managing local package dependencies.
|
|
64
|
+
|
|
65
|
+
### Using yalc for Local Development
|
|
66
|
+
|
|
67
|
+
1. **Install yalc globally:**
|
|
68
|
+
```sh
|
|
69
|
+
npm install -g yalc
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. **Publish local dependencies:**
|
|
73
|
+
```sh
|
|
74
|
+
# In the MaplatTransform directory
|
|
75
|
+
cd ../MaplatTransform
|
|
76
|
+
yalc publish
|
|
77
|
+
|
|
78
|
+
# In the MaplatEdgeBound directory
|
|
79
|
+
cd ../MaplatEdgeBound
|
|
80
|
+
yalc publish
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
3. **Link local dependencies in this project:**
|
|
84
|
+
```sh
|
|
85
|
+
# In the MaplatTin directory
|
|
86
|
+
yalc add @maplat/transform @maplat/edgebound
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
4. **Update local dependencies when changed:**
|
|
90
|
+
```sh
|
|
91
|
+
# In the dependency directory (e.g., MaplatTransform)
|
|
92
|
+
yalc publish --push
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
5. **Remove local dependencies (to use npm packages):**
|
|
96
|
+
```sh
|
|
97
|
+
# In the MaplatTin directory
|
|
98
|
+
yalc remove @maplat/transform @maplat/edgebound
|
|
99
|
+
npm install
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Note:** The `.yalc` directory and `yalc.lock` file are ignored by git and will not be committed.
|
|
103
|
+
|
|
104
|
+
### Browser
|
|
105
|
+
|
|
106
|
+
When using in the browser, you need to include the peer dependencies:
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<!-- Required dependencies -->
|
|
110
|
+
<script src="https://unpkg.com/delaunator@5.0.0/delaunator.min.js"></script>
|
|
111
|
+
<script src="https://unpkg.com/@turf/helpers@7.2.0/dist/turf-helpers.min.js"></script>
|
|
112
|
+
<script src="https://unpkg.com/@turf/boolean-point-in-polygon@7.2.0/dist/turf-boolean-point-in-polygon.min.js"></script>
|
|
113
|
+
<script src="https://unpkg.com/@turf/centroid@7.2.0/dist/turf-centroid.min.js"></script>
|
|
114
|
+
<script src="https://unpkg.com/@turf/convex@7.2.0/dist/turf-convex.min.js"></script>
|
|
115
|
+
<script src="https://unpkg.com/@turf/line-intersect@7.2.0/dist/turf-line-intersect.min.js"></script>
|
|
116
|
+
|
|
117
|
+
<!-- Maplat Tin (UMD) -->
|
|
118
|
+
<script src="https://unpkg.com/@maplat/tin/dist/tin.umd.js"></script>
|
|
119
|
+
<script>
|
|
120
|
+
// Use the library
|
|
121
|
+
const tin = new tin.default({
|
|
122
|
+
wh: [500, 500]
|
|
123
|
+
});
|
|
124
|
+
</script>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or using ES modules:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<!-- Maplat Tin (ESM) -->
|
|
131
|
+
<script type="module">
|
|
132
|
+
import Tin from "https://unpkg.com/@maplat/tin/dist/index.js";
|
|
133
|
+
// Use the library
|
|
134
|
+
const tin = new Tin({
|
|
135
|
+
wh: [500, 500]
|
|
136
|
+
});
|
|
137
|
+
</script>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Basic Usage
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
// Create a new instance with basic configuration
|
|
144
|
+
const tin = new Tin({
|
|
145
|
+
wh: [500, 500], // Width and height of the source plane
|
|
146
|
+
yaxisMode: Tin.YAXIS_FOLLOW // Y-axis direction handling
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Set control points: Array of [source, target] coordinates
|
|
150
|
+
tin.setPoints([
|
|
151
|
+
[[100,100], [200, 200]], // Point 1
|
|
152
|
+
[[200,200], [400, 400]], // Point 2
|
|
153
|
+
[[150,150], [320, 350]], // Point 3
|
|
154
|
+
[[200,100], [420, 220]] // Point 4
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
// Initialize the TIN network
|
|
158
|
+
tin.updateTin();
|
|
159
|
+
|
|
160
|
+
// Check topology status
|
|
161
|
+
if (tin.strict_status === Tin.STATUS_STRICT) {
|
|
162
|
+
console.log('Topology OK: Roundtrip transform is guaranteed');
|
|
163
|
+
} else if (tin.strict_status === Tin.STATUS_LOOSE) {
|
|
164
|
+
console.log('Topology warning: Roundtrip transform is not guaranteed');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Forward transform: source to target
|
|
168
|
+
const transformed = tin.transform([160, 160], false);
|
|
169
|
+
|
|
170
|
+
// Backward transform: target to source
|
|
171
|
+
const restored = tin.transform(transformed, true);
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Configuration
|
|
175
|
+
|
|
176
|
+
### Constructor Options
|
|
177
|
+
|
|
178
|
+
| **Option** | **Type** | **Description** | **Default** |
|
|
179
|
+
| ------------- | --------------------------- | ------------------------- | ------------- |
|
|
180
|
+
| `bounds` | `Position[]` | **Boundary polygon vertices** | `-` |
|
|
181
|
+
| `wh` | `number[]` | **Width and height [w, h]** | `-` |
|
|
182
|
+
| `vertexMode` | `"plain"|"birdeye"` | **Vertex handling mode** | `"plain"` |
|
|
183
|
+
| `strictMode` | `"strict"|"auto"|"loose"` | **Topology check mode** | `"auto"` |
|
|
184
|
+
| `yaxisMode` | `"follow"|"invert"` | **Y-axis direction** | `"invert"` |
|
|
185
|
+
| `importance` | `number` | **Map importance** | `0` |
|
|
186
|
+
| `priority` | `number` | **Map priority** | `0` |
|
|
187
|
+
|
|
188
|
+
Either `bounds` or `wh` must be specified.
|
|
189
|
+
|
|
190
|
+
### Methods
|
|
191
|
+
|
|
192
|
+
| **Method** | **Description** |
|
|
193
|
+
| ---------------------------- | --------------------------------- |
|
|
194
|
+
| `setPoints(points)` | **Set control points** |
|
|
195
|
+
| `setEdges(edges)` | **Set constrained edges** |
|
|
196
|
+
| `updateTin()` | **Initialize/update TIN network** |
|
|
197
|
+
| `transform(coords, inverse)` | **Execute coordinate transformation** |
|
|
198
|
+
| `getCompiled()` | **Get serializable state** |
|
|
199
|
+
| `setCompiled(state)` | **Restore from serialized state** |
|
|
200
|
+
|
|
201
|
+
### Error Handling
|
|
202
|
+
|
|
203
|
+
The library may throw errors in the following cases:
|
|
204
|
+
|
|
205
|
+
- `"TOO LINEAR1"`,`"TOO LINEAR2"`: Control points are too linear
|
|
206
|
+
- `"SOME POINTS OUTSIDE"`: Points outside boundary
|
|
207
|
+
- Custom error when attempting backward transformation in a disallowed state
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
Maplat Limited License 1.1
|
|
212
|
+
|
|
213
|
+
Copyright (c) 2024 Code for History
|
|
214
|
+
|
|
215
|
+
## Developers
|
|
216
|
+
|
|
217
|
+
- Kohei Otsuka
|
|
218
|
+
- Code for History
|
|
219
|
+
|
|
122
220
|
We welcome your contributions! Feel free to submit [issues and pull requests](https://github.com/code4history/MaplatTin/issues).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FeatureCollection, Point, Polygon } from 'geojson';
|
|
2
|
+
import { Edge } from '@maplat/transform';
|
|
3
|
+
/**
|
|
4
|
+
* 制約付きTIN(Triangulated Irregular Network)を生成します
|
|
5
|
+
*
|
|
6
|
+
* 点群から三角形分割を行い、指定されたエッジ(制約線)を
|
|
7
|
+
* 必ず三角形の辺として含むように調整します。
|
|
8
|
+
*
|
|
9
|
+
* @param points - 点群を含むFeatureCollection
|
|
10
|
+
* 各Featureは座標を持つPointである必要があります
|
|
11
|
+
* @param edges - 制約として扱うエッジの配列
|
|
12
|
+
* 各エッジは2つの頂点インデックスの組として指定
|
|
13
|
+
* @param z - 生成される三角形のプロパティに含める項目の名前
|
|
14
|
+
* (例: "target")
|
|
15
|
+
*
|
|
16
|
+
* @returns 三角形のFeatureCollectionを返します
|
|
17
|
+
* 各三角形は以下の情報を持ちます:
|
|
18
|
+
* - geometry: 三角形の座標
|
|
19
|
+
* - properties: 頂点に関連付けられた情報(a, b, cプロパティ)
|
|
20
|
+
*
|
|
21
|
+
* @throws {Error} pointsがFeatureCollectionでない場合
|
|
22
|
+
* @throws {Error} edgesが配列でない場合
|
|
23
|
+
*
|
|
24
|
+
* 処理の流れ:
|
|
25
|
+
* 1. Delaunay三角分割を実行
|
|
26
|
+
* 2. 制約エッジに基づいて三角分割を調整
|
|
27
|
+
* 3. 結果をGeoJSON形式に変換
|
|
28
|
+
*/
|
|
29
|
+
export default function (points: FeatureCollection<Point>, edges: Edge[], z: string): FeatureCollection<Polygon>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,196 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @property {Position[]} bounds - 境界ポリゴンを定義する頂点配列
|
|
19
|
-
* @property {number[]} wh - 幅と高さ [width, height]
|
|
20
|
-
* @property {VertexMode} vertexMode - 頂点モード ("plain" | "birdeye")
|
|
21
|
-
* @property {StrictMode} strictMode - 厳密性モード ("strict" | "auto" | "loose")
|
|
22
|
-
* @property {YaxisMode} yaxisMode - Y軸の向き ("follow" | "invert")
|
|
23
|
-
* @property {number} importance - 重要度
|
|
24
|
-
* @property {number} priority - 優先度
|
|
25
|
-
* @property {boolean} stateFull - 状態を保持するかどうか
|
|
26
|
-
* @property {PointSet[]} points - 制御点の配列
|
|
27
|
-
* @property {EdgeSet[]} edges - エッジ(制約線)の配列
|
|
28
|
-
*/
|
|
29
|
-
export declare interface Options {
|
|
30
|
-
bounds: Position[];
|
|
31
|
-
wh: number[];
|
|
32
|
-
vertexMode: VertexMode;
|
|
33
|
-
strictMode: StrictMode;
|
|
34
|
-
yaxisMode: YaxisMode;
|
|
35
|
-
importance: number;
|
|
36
|
-
priority: number;
|
|
37
|
-
stateFull: boolean;
|
|
38
|
-
points: PointSet[];
|
|
39
|
-
edges: EdgeSet[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Tin (Triangulated Irregular Network) クラス
|
|
44
|
-
* 2つの平面座標系間の同相変換を実現します。
|
|
45
|
-
*
|
|
46
|
-
* @property {number} importance - マップの重要度
|
|
47
|
-
* @property {number} priority - マップの優先度
|
|
48
|
-
* @property {any} pointsSet - 変換用の点群セット
|
|
49
|
-
*/
|
|
50
|
-
declare class Tin extends Transform {
|
|
51
|
-
importance: number;
|
|
52
|
-
priority: number;
|
|
53
|
-
pointsSet: any;
|
|
54
|
-
/**
|
|
55
|
-
* Tinクラスのインスタンスを生成します
|
|
56
|
-
*
|
|
57
|
-
* @param {Partial<Options>} options - 初期化オプション
|
|
58
|
-
* bounds または wh のどちらかが必須です
|
|
59
|
-
*/
|
|
60
|
-
constructor(options?: Partial<Options>);
|
|
61
|
-
/**
|
|
62
|
-
* フォーマットバージョンを取得します
|
|
63
|
-
*
|
|
64
|
-
* @returns {number} 現在のフォーマットバージョン
|
|
65
|
-
*/
|
|
66
|
-
getFormatVersion(): number;
|
|
67
|
-
/**
|
|
68
|
-
* 制御点(GCP: Ground Control Points)を設定します
|
|
69
|
-
*
|
|
70
|
-
* @param points - 制御点の配列。各要素は [ソース座標, ターゲット座標] の形式
|
|
71
|
-
*
|
|
72
|
-
* 注意:この操作によりTINネットワークはリセットされ、
|
|
73
|
-
* 再度updateTin()を呼び出す必要があります。
|
|
74
|
-
*/
|
|
75
|
-
setPoints(points: PointSet[]): void;
|
|
76
|
-
/**
|
|
77
|
-
* エッジ(制約線)を設定します
|
|
78
|
-
*
|
|
79
|
-
* @param edges - エッジの配列。新規フォーマットまたはレガシーフォーマットに対応
|
|
80
|
-
*
|
|
81
|
-
* 注意:この操作によりTINネットワークはリセットされ、
|
|
82
|
-
* 再度updateTin()を呼び出す必要があります。
|
|
83
|
-
*/
|
|
84
|
-
setEdges(edges?: EdgeSet[] | EdgeSetLegacy[]): void;
|
|
85
|
-
/**
|
|
86
|
-
* 境界ポリゴンを設定します
|
|
87
|
-
*
|
|
88
|
-
* @param bounds - 境界を定義する頂点座標の配列
|
|
89
|
-
*
|
|
90
|
-
* - 境界ポリゴンの計算
|
|
91
|
-
* - バウンディングボックスの計算
|
|
92
|
-
* - 内部状態の更新
|
|
93
|
-
*/
|
|
94
|
-
setBounds(bounds: number[][]): void;
|
|
95
|
-
/**
|
|
96
|
-
* 現在の設定を永続化可能な形式にコンパイルします
|
|
97
|
-
*
|
|
98
|
-
* @returns Compiled - コンパイルされた設定オブジェクト
|
|
99
|
-
*
|
|
100
|
-
* 以下の情報が含まれます:
|
|
101
|
-
* - バージョン情報
|
|
102
|
-
* - 制御点データ
|
|
103
|
-
* - TINネットワーク情報
|
|
104
|
-
* - 境界情報
|
|
105
|
-
* - 各種モード設定
|
|
106
|
-
*/
|
|
107
|
-
getCompiled(): Compiled;
|
|
108
|
-
/**
|
|
109
|
-
* 幅と高さを設定します
|
|
110
|
-
*
|
|
111
|
-
* @param {number[]} wh - [width, height] の形式で指定
|
|
112
|
-
* この操作によりTINネットワークはリセットされます
|
|
113
|
-
*/
|
|
114
|
-
setWh(wh: number[]): void;
|
|
115
|
-
/**
|
|
116
|
-
* 頂点モードを設定します
|
|
117
|
-
*
|
|
118
|
-
* @param {VertexMode} mode - "plain" または "birdeye"
|
|
119
|
-
* この操作によりTINネットワークはリセットされます
|
|
120
|
-
*/
|
|
121
|
-
setVertexMode(mode: VertexMode): void;
|
|
122
|
-
/**
|
|
123
|
-
* 厳密性モードを設定します
|
|
124
|
-
*
|
|
125
|
-
* @param {StrictMode} mode - "strict", "auto", または "loose"
|
|
126
|
-
* この操作によりTINネットワークはリセットされます
|
|
127
|
-
*/
|
|
128
|
-
setStrictMode(mode: StrictMode): void;
|
|
129
|
-
/**
|
|
130
|
-
* 厳密なTINを計算します
|
|
131
|
-
*
|
|
132
|
-
* - 逆方向の三角形を生成
|
|
133
|
-
* - 交差チェックを実行
|
|
134
|
-
* - 結果に基づいてstrict_statusを更新
|
|
135
|
-
*
|
|
136
|
-
* strict_statusは以下のいずれかになります:
|
|
137
|
-
* - STATUS_STRICT: 交差なし
|
|
138
|
-
* - STATUS_ERROR: 交差あり
|
|
139
|
-
*/
|
|
140
|
-
calcurateStrictTin(): void;
|
|
141
|
-
/**
|
|
142
|
-
* 点群セットを生成します
|
|
143
|
-
*
|
|
144
|
-
* 以下の処理を行います:
|
|
145
|
-
* 1. 制御点からポイントセットを生成
|
|
146
|
-
* 2. エッジ節点の生成と追加
|
|
147
|
-
* 3. エッジの接続関係の構築
|
|
148
|
-
*
|
|
149
|
-
* @returns {object} 生成された点群セットと接続情報
|
|
150
|
-
* @property {FeatureCollection} forw - 順方向の点群
|
|
151
|
-
* @property {FeatureCollection} bakw - 逆方向の点群
|
|
152
|
-
* @property {Array} edges - エッジ接続情報
|
|
153
|
-
*/
|
|
154
|
-
generatePointsSet(): {
|
|
155
|
-
forw: FeatureCollection<Geometry, GeoJsonProperties>;
|
|
156
|
-
bakw: FeatureCollection<Geometry, GeoJsonProperties>;
|
|
157
|
-
edges: Edge[];
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* 入力データの検証と初期データの準備
|
|
161
|
-
* - 境界値のチェック
|
|
162
|
-
* - バッファー付き境界の計算
|
|
163
|
-
* - 点群セットの生成
|
|
164
|
-
* @returns {object} 検証済みの点群セットと境界データ
|
|
165
|
-
* @throws {Error} "SOME POINTS OUTSIDE" 制御点が境界外にある場合
|
|
166
|
-
*/
|
|
167
|
-
private validateAndPrepareInputs;
|
|
168
|
-
/**
|
|
169
|
-
* TINネットワークを更新し、座標変換の準備を行います
|
|
170
|
-
*
|
|
171
|
-
* このメソッドは以下の処理を実行します:
|
|
172
|
-
* 1. 入力データの検証
|
|
173
|
-
* 2. 制御点のTIN生成
|
|
174
|
-
* 3. Convex Hull(凸包)の計算
|
|
175
|
-
* 4. 境界の調整
|
|
176
|
-
* 5. 変換パラメータの計算
|
|
177
|
-
*
|
|
178
|
-
* @throws {Error} "TOO LINEAR1" - 制御点が直線的すぎる場合
|
|
179
|
-
* @throws {Error} "TOO LINEAR2" - 変換後の点が直線的すぎる場合
|
|
180
|
-
* @throws {Error} "SOME POINTS OUTSIDE" - 制御点が境界外にある場合
|
|
181
|
-
*/
|
|
182
|
-
updateTin(): void;
|
|
183
|
-
/**
|
|
184
|
-
* 点の重み付けを計算します
|
|
185
|
-
*
|
|
186
|
-
* - 各点について周辺の三角形から重みを計算
|
|
187
|
-
* - 順方向と逆方向(必要な場合)の重みを計算
|
|
188
|
-
* - 重心点の重みも計算
|
|
189
|
-
*
|
|
190
|
-
* 重みは変換の精度と安定性に影響を与えます
|
|
191
|
-
*/
|
|
192
|
-
calculatePointsWeight(): void;
|
|
193
|
-
}
|
|
194
|
-
export default Tin;
|
|
195
|
-
|
|
196
|
-
export { }
|
|
1
|
+
/**
|
|
2
|
+
* @maplat/tin - TIN (Triangulated Irregular Network) generation library
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the library.
|
|
5
|
+
* Provides TIN generation with constrained edges for map transformation.
|
|
6
|
+
*/
|
|
7
|
+
export { Tin } from "./tin";
|
|
8
|
+
export type { Options } from "./tin";
|
|
9
|
+
export { default as constrainedTin } from "./constrained-tin";
|
|
10
|
+
export { default as findIntersections } from "./kinks";
|
|
11
|
+
export { insertSearchIndex } from "./searchutils";
|
|
12
|
+
export { counterPoint, createPoint, vertexCalc } from "./vertexutils";
|
|
13
|
+
export type { SearchIndex } from "./searchutils";
|
|
14
|
+
export type { IntersectionPoint } from "./types/kinks.d";
|
|
15
|
+
export type { TriangleProperties } from "./types/tin.d";
|
|
16
|
+
export type { Compiled, Edge, EdgeSet, EdgeSetLegacy, PointSet, PropertyTriKey, StrictMode, StrictStatus, Tins, Transform, Tri, VertexMode, YaxisMode, } from '@maplat/transform';
|
|
17
|
+
export { format_version } from '@maplat/transform';
|
package/dist/kinks.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Tins, Tri } from '@maplat/transform';
|
|
2
|
+
type BiDirectionKey = "forw" | "bakw";
|
|
3
|
+
type TinsBD = {
|
|
4
|
+
[key in BiDirectionKey]?: Tins;
|
|
5
|
+
};
|
|
6
|
+
type SearchTris = {
|
|
7
|
+
[key in BiDirectionKey]: Tri;
|
|
8
|
+
};
|
|
9
|
+
export type SearchIndex = {
|
|
10
|
+
[key: string]: SearchTris[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 検索インデックスに三角形を追加する
|
|
14
|
+
*
|
|
15
|
+
* @param searchIndex 検索インデックス
|
|
16
|
+
* @param tris 追加する三角形ペア
|
|
17
|
+
* @param tins (オプション)追加先の三角形群
|
|
18
|
+
* @throws キーの不一致エラー
|
|
19
|
+
*/
|
|
20
|
+
declare function insertSearchIndex(searchIndex: SearchIndex, tris: SearchTris, tins?: TinsBD): void;
|
|
21
|
+
export { insertSearchIndex };
|