@maplat/tin 0.14.0 → 0.14.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/LICENSE CHANGED
@@ -1,26 +1,4 @@
1
- Maplat Limited License
2
- Ver. 1.1 Mar. 9 2021
3
1
 
4
- 残念ながら、悪質なフリーライダーの発生により、Maplat関連のライブラリはオープンソースであることを一時放棄し、制限ライセンスで公開せざるを得なくなりました。
5
- 本ライセンスのVer.1.1を公開した2021年3月9日以降、問題が解決し再びApache 2.0ライセンスに戻せるようになるまでの間、MaplatTin Version 0.8.0以降のバージョンを制限ライセンスで公開します。
6
- 制限期間のライセンス条項は以下の通りです。
7
-
8
- 1. 次項以降に記されない一般の利用者については、通常のApache 2.0に等しい条件での利用を認める。ただし、本ライセンスとApache 2.0ライセンスが矛盾する場合は、本ライセンスが優先される。
9
- 2. しかし、下記に記す特定のユーザについては、ライブラリの利用、コードの閲覧や再利用、また利用に伴う特許の知的財産利用権など、本ライブラリの利用に関する一切の権限を認めない。
10
- * 株式会社コギト 日本、京都市中京区錦小路通烏丸西入ル占出山町311 アニマート錦5F
11
- 3. 本ライセンスの記載内容について日本語表記と英語表記が矛盾する場合、日本語表記での内容が優先される。
12
-
13
- Unfortunately, due to the occurrence of malicious free riders, we have been forced to temporarily abandon the Maplat-related libraries as open source and release them under a restricted license.
14
- After March 9, 2021, when we released Version 1.1 of this license, we will release MaplatTin Version 0.8.0 and later versions under a restricted license until the problem is resolved and we can revert to the Apache 2.0 license again.
15
- The license terms for the restricted period are as follows:
16
-
17
- 1. For general users not listed in the next sections, the terms of the license are the same as for regular Apache 2.0 license. However, if there is any conflict between this License and the Apache 2.0 License, this License shall prevail.
18
- 2. However, the specific users listed below are not granted any rights related to the use of the library, including but not limited to the use of the library, viewing and reuse of the code, and the right to use any patents associated with the use of the library.
19
- * COGITO Inc., 5F Animato Nishiki, 311 Uradeyamacho, Nakagyo-ku, Kyoto, Japan
20
- 3. In the event of any discrepancy between the Japanese and English versions of this license, the Japanese version shall prevail.
21
-
22
- =====
23
- Reference:
24
2
  Apache License
25
3
  Version 2.0, January 2004
26
4
  http://www.apache.org/licenses/
@@ -209,7 +187,7 @@ Reference:
209
187
  same "printed page" as the copyright notice for easier
210
188
  identification within third-party archives.
211
189
 
212
- Copyright 2019 Kohei Otsuka, Code for History
190
+ Copyright 2019-2026 Kohei Otsuka, Code for History / Nayuta, Inc.
213
191
 
214
192
  Licensed under the Apache License, Version 2.0 (the "License");
215
193
  you may not use this file except in compliance with the License.
package/README.ja.md CHANGED
@@ -1,220 +1,230 @@
1
- # Maplat Tin
1
+ <!-- SECTION 1: Header (logo, badges, title) -->
2
+ <h1 align="center">MaplatTin</h1>
2
3
 
3
- [![CI](https://github.com/code4history/MaplatTin/actions/workflows/ci.yml/badge.svg)](https://github.com/code4history/MaplatTin/actions/workflows/ci.yml)
4
+ <p align="center">
5
+ <a href="https://github.com/code4history/MaplatTin/actions/workflows/ci.yml"><img src="https://github.com/code4history/MaplatTin/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
6
+ <a href="https://www.npmjs.com/package/@maplat/tin"><img src="https://img.shields.io/npm/v/@maplat/tin" alt="npm version" /></a>
7
+ <a href="LICENSE"><img src="https://img.shields.io/npm/l/@maplat/tin" alt="License" /></a>
8
+ </p>
4
9
 
5
- 2つの平面座標系間で制御点に基づく同相変換を定義・実行するJavaScriptライブラリです。
6
- [Maplat](https://github.com/code4history/Maplat/)プロジェクトの一部として開発されています。
10
+ <!-- SECTION 2: Elevator Pitch -->
11
+ ## MaplatTin について
7
12
 
8
- English README is [here](./README.md).
13
+ MaplatTin は制御点に基づいて2つの平面座標系間の同相変換を定義・実行する
14
+ JavaScript ライブラリです。非線形かつ位相を保存する(同相な)双方向写像を
15
+ 保証し、これが [Maplat](https://github.com/code4history/Maplat) ビューアが
16
+ 古地図を正確な現代地図へ**元の画像を歪めずに**重ね合わせるための中核特性
17
+ です。
9
18
 
10
- ## 主な機能
19
+ MaplatTin は Apache License 2.0(バージョン 0.14.2 以降)のオープンソース
20
+ プロジェクトです。
11
21
 
12
- - **座標変換定義の生成:** 制御点とエッジ制約に基づいて座標変換定義を生成
13
- - **双方向座標変換:** 2つの平面間で双方向の座標変換が可能
14
- - **位相保存:** 変換時の同相性(トポロジー)を維持
15
- - **柔軟な設定:**
16
- - 通常/鳥瞰図モードの頂点処理
17
- - 厳密/自動/緩和モードのトポロジーチェック
18
- - Y軸の向きの制御
19
- - **エッジ制約:** より正確な変換のための制約付きエッジの指定が可能
20
- - **状態管理:** 変換定義の保存と復元をサポート
22
+ <!-- SECTION 3: Language switch link -->
23
+ **[英語版はこちら / Read this document in English](README.md)**
21
24
 
22
- ## 動作要件
25
+ <!-- SECTION 4: Key Features -->
26
+ ## 主な特徴
23
27
 
24
- - **Node.js**: 20.0.0 以上
25
- - **パッケージマネージャー**: pnpm 9.0.0 以上(推奨)または npm
28
+ - **座標変換定義の生成** — 制御点とエッジ制約に基づいて座標変換定義を生成
29
+ - **双方向座標変換** — 2つの平面間で双方向の座標変換が可能
30
+ - **位相保存** — 変換時の同相性(トポロジー)を維持
31
+ - **柔軟な設定** — 通常/鳥瞰図モードの頂点処理・厳密/自動/緩和モードの
32
+ トポロジーチェック・Y 軸の向きの制御
33
+ - **エッジ制約** — より正確な変換のための制約付きエッジの指定が可能
34
+ - **状態管理** — 変換定義の保存と復元をサポート
35
+ - オープンソース(Apache 2.0・バージョン 0.14.2 以降)— Maplat エコシステムの一部
26
36
 
27
- ## インストール方法
37
+ <!-- SECTION 5: Quick Start -->
38
+ ## クイックスタート
28
39
 
29
- ### pnpm(推奨)
40
+ > リリース依存情報(ADR-0012)。下記バージョン `0.14.2` は現在の
41
+ > リリースです。リリースごとに更新してください。
30
42
 
31
- ```sh
32
- pnpm add @maplat/tin
33
- ```
43
+ ### インストール
34
44
 
35
- ### npm
45
+ ```bash
46
+ # pnpm(推奨)
47
+ pnpm add @maplat/tin
36
48
 
37
- ```sh
49
+ # npm
38
50
  npm install @maplat/tin
39
51
  ```
40
52
 
53
+ ### 最小利用例
41
54
 
42
- ## 開発環境のセットアップ
43
-
44
- ### テスト
45
-
46
- プロジェクトには、TIN変換ロジックと内部EdgeBound制約エンジンの両方に対する包括的なユニットテストが含まれています。
47
-
48
- **すべてのテストを実行:**
49
- ```sh
50
- pnpm test
51
- ```
55
+ ```typescript
56
+ import Tin from '@maplat/tin';
52
57
 
53
- **特定のテストスイートを実行:**
54
- ```sh
55
- # EdgeBound制約エンジンのテスト
56
- pnpm test tests/edgebound
57
-
58
- # TIN変換のテスト
59
- pnpm test tests/tin
60
- ```
58
+ // 基本設定でインスタンスを作成
59
+ const tin = new Tin({
60
+ wh: [500, 500], // ソース座標系の幅と高さ
61
+ yaxisMode: Tin.YAXIS_FOLLOW,
62
+ });
61
63
 
62
- **テストカバレッジ:**
63
- - `tests/edgebound/` - 内部EdgeBound制約エンジンのテスト(455テスト)
64
- - `constrain.test.ts` - 制約操作の統合テスト
65
- - `constrain.unit.test.ts` - 制約メソッドのユニットテスト
66
- - `intersect.test.ts` - 線分交差検出テスト
67
- - `validators.ts` - 三角形分割の整合性検証用テストユーティリティ
68
- - `tests/tin.test.ts` - 実際の地図データを使用したTIN変換テスト
69
- - `tests/transform.test.ts` - 座標変換テスト
64
+ // 制御点の設定: [ソース座標, ターゲット座標] の配列
65
+ tin.setPoints([
66
+ [[100, 100], [200, 200]],
67
+ [[200, 200], [400, 400]],
68
+ [[150, 150], [320, 350]],
69
+ [[200, 100], [420, 220]],
70
+ ]);
70
71
 
71
- ### ビルド
72
+ // TIN ネットワークの初期化
73
+ tin.updateTin();
72
74
 
73
- ライブラリのビルド:
74
- ```sh
75
- pnpm run build
76
- ```
75
+ // 順方向の変換(ソース → ターゲット)
76
+ const transformed = tin.transform([160, 160], false);
77
77
 
78
- デモサイトのビルド:
79
- ```sh
80
- pnpm run build:demo
78
+ // 逆方向の変換(ターゲット → ソース)
79
+ const restored = tin.transform(transformed, true);
81
80
  ```
82
81
 
83
- ### ブラウザ
84
-
85
- ブラウザで使用する場合:
82
+ ### CDN(jsDelivr)
86
83
 
87
84
  ```html
88
- <!-- Maplat Tin (UMD) -->
89
- <script src="https://unpkg.com/@maplat/tin/dist/tin.umd.js"></script>
85
+ <!-- MaplatTin (UMD) -->
86
+ <script src="https://cdn.jsdelivr.net/npm/@maplat/tin@0.14.2/dist/maplat_tin.umd.js"></script>
90
87
  <script>
91
- // ライブラリを使用
92
- const tin = new tin.default({
93
- wh: [500, 500]
94
- });
88
+ const tin = new maplatTin.default({ wh: [500, 500] });
95
89
  </script>
96
90
  ```
97
91
 
98
- またはESモジュールとして使用する場合:
92
+ または ES モジュールとして使用する場合:
99
93
 
100
94
  ```html
101
- <!-- Maplat Tin (ESモジュール) -->
102
95
  <script type="module">
103
- import Tin from "https://unpkg.com/@maplat/tin/dist/index.js";
104
- // ライブラリを使用
105
- const tin = new Tin({
106
- wh: [500, 500]
107
- });
96
+ import Tin from 'https://cdn.jsdelivr.net/npm/@maplat/tin@0.14.2/dist/maplat_tin.js';
97
+ const tin = new Tin({ wh: [500, 500] });
108
98
  </script>
109
99
  ```
110
100
 
111
- ## 基本的な使用方法
101
+ ※最新の互換バージョンを使用してください。
112
102
 
113
- ```javascript
114
- // 基本設定でインスタンスを作成
115
- const tin = new Tin({
116
- wh: [500, 500], // ソース座標系の幅と高さ
117
- yaxisMode: Tin.YAXIS_FOLLOW // Y軸の向きの設定
118
- });
103
+ ### API リファレンス
119
104
 
120
- // 制御点の設定: [ソース座標, ターゲット座標] の配列
121
- tin.setPoints([
122
- [[100,100], [200, 200]], // 点1
123
- [[200,200], [400, 400]], // 点2
124
- [[150,150], [320, 350]], // 点3
125
- [[200,100], [420, 220]] // 点4
126
- ]);
105
+ - **API シグネチャ**(リリース依存): [`docs/api/`](docs/api/) を参照
106
+ - **概念解説**(リリース非依存):
107
+ [Wiki API-Reference](https://github.com/code4history/MaplatTin/wiki/API-Reference)
108
+ を参照
127
109
 
128
- // TINネットワークの初期化
129
- tin.updateTin();
110
+ ### 開発
130
111
 
131
- // トポロジーの状態確認
132
- if (tin.strict_status === Tin.STATUS_STRICT) {
133
- console.log('トポロジーOK: 往復変換が保証されます');
134
- } else if (tin.strict_status === Tin.STATUS_LOOSE) {
135
- console.log('トポロジー警告: 往復変換が保証されません');
136
- }
112
+ #### セットアップ
113
+ リポジトリをクローンし依存関係をインストールします。
137
114
 
138
- // 順方向の変換(ソース → ターゲット)
139
- const transformed = tin.transform([160, 160], false);
115
+ ```bash
116
+ git clone https://github.com/code4history/MaplatTin.git
117
+ cd MaplatTin
118
+ pnpm install
119
+ ```
140
120
 
141
- // 逆方向の変換(ターゲット → ソース)
142
- const restored = tin.transform(transformed, true);
121
+ #### 開発サーバー
122
+ ホットリロード付きの開発サーバーを起動します。
123
+
124
+ ```bash
125
+ pnpm dev
143
126
  ```
144
127
 
145
- ## 設定オプション
128
+ #### ビルド
146
129
 
147
- ### コンストラクタオプション
148
- | **オプション** | **型** | **説明** | **デフォルト** |
149
- | -------------- | --------------------------- | ---------------------------- | -------------- |
150
- | `bounds` | `Position[]` | **境界多角形の頂点** | `-` |
151
- | `wh` | `number[]` | **幅と高さ [w, h]** | `-` |
152
- | `vertexMode` | `"plain"|"birdeye"` | **頂点処理モード** | `"plain"` |
153
- | `strictMode` | `"strict"|"auto"|"loose"` | **トポロジーチェックモード** | `"auto"` |
154
- | `yaxisMode` | `"follow"|"invert"` | **Y軸の向き** | `"invert"` |
155
- | `importance` | `number` | **地図の重要度** | `0` |
156
- | `priority` | `number` | **地図の優先度** | `0` |
130
+ ```bash
131
+ pnpm build # ライブラリをビルド (dist/)
132
+ pnpm build:demo # デモサイトをビルド (dist-demo/)
133
+ ```
134
+
135
+ #### テスト
136
+
137
+ ```bash
138
+ pnpm test # ユニットテスト (Vitest) を実行
139
+ pnpm typecheck # 型チェック (TypeScript) を実行
140
+ pnpm lint # リンター/フォーマッター (ESLint/Prettier) を実行
141
+ ```
142
+
143
+ テストカバレッジ:
144
+
145
+ - `tests/edgebound/` — 内部 EdgeBound 制約エンジンのテスト(455 テスト)
146
+ - `tests/tin.test.ts` — 実際の地図データを使用した TIN 変換テスト
147
+ - `tests/transform.test.ts` — 座標変換テスト
157
148
 
158
- `bounds`または`wh`のいずれかを指定する必要があります。
149
+ <!-- SECTION 6: Prerequisites -->
150
+ ## 動作環境
159
151
 
160
- ### メソッド
152
+ > `package.json` の `engines` フィールドから自動抽出(ADR-0012: リリース依存)。
161
153
 
162
- | **メソッド** | **説明** |
163
- | ---------------------------- | ------------------------------------ |
164
- | `setPoints(points)` | **制御点の設定** |
165
- | `setEdges(edges)` | **制約付きエッジの設定** |
166
- | `updateTin()` | **TINネットワークの初期化/更新** |
167
- | `transform(coords, inverse)` | **座標変換の実行** |
168
- | `getCompiled()` | **シリアライズ可能な状態の取得** |
169
- | `setCompiled(state)` | **シリアライズされた状態からの復元** |
170
- | `getFormatVersion()` | **フォーマットバージョン番号の取得** |
154
+ - Node.js: `>=20.0.0`(GitHub Actions で検証済みの LTS)
155
+ - pnpm: `>=9.0.0`(必須・`package.json` で pnpm を強制)
171
156
 
172
- ### 定数
157
+ <!-- SECTION 7 Peer Dependencies: 省略(OpenLayers 依存なし) -->
173
158
 
174
- **Y軸モード:**
175
- - `Tin.YAXIS_FOLLOW` - Y軸が座標系に従う
176
- - `Tin.YAXIS_INVERT` - Y軸が反転する
159
+ <!-- SECTION 8: Ecosystem / Related Repositories -->
160
+ ## エコシステム
177
161
 
178
- **ステータス値:**
179
- - `Tin.STATUS_STRICT` - 厳密なトポロジー(往復変換が保証される)
180
- - `Tin.STATUS_LOOSE` - 緩和されたトポロジー(往復変換が保証されない)
162
+ MaplatTin は [Code for History](https://github.com/code4history) が運営する
163
+ Maplat エコシステムの一部です。全容は下記エコシステム図を参照してください。
181
164
 
182
- **フォーマットバージョン:**
183
- - `format_version` - 現在のTINフォーマットバージョン
165
+ 📖 **エコシステム図** — *(図は現在外部非公開の計画リポジトリに保持して
166
+ います。下記の姉妹リポジトリ表が公開版の代替です)*
184
167
 
185
- ### ユーティリティ関数
168
+ ### 姉妹リポジトリ
186
169
 
187
- | **関数** | **説明** |
188
- | --------------------------------------------------------------------- | ---------------------------------- |
189
- | `constrainedTin(points, edges, z)` | **制約付きドロネー三角分割の生成** |
190
- | `findIntersections(features)` | **フィーチャ内の交点を検出** |
191
- | `insertSearchIndex(tins, centroid, strict)` | **TINの検索インデックスを挿入** |
192
- | `counterPoint(point)` | **対向点の計算** |
193
- | `createPoint(xy, mercator, forw)` | **ポイントフィーチャの作成** |
194
- | `vertexCalc(points, edgeNodes, centroid, originPoly, xy, vertexMode)` | **頂点座標の計算** |
170
+ | リポジトリ | ライセンス | npm | 役割 |
171
+ |---|---|---|---|
172
+ | [Maplat](https://github.com/code4history/Maplat) | Apache 2.0 | `@maplat/ui` | メインビューア |
173
+ | [MaplatCore](https://github.com/code4history/MaplatCore) | Apache 2.0 | `@maplat/core` | コアライブラリ |
174
+ | [MaplatTin](https://github.com/code4history/MaplatTin) | Apache 2.0 | `@maplat/tin` | TIN 変換 |
175
+ | [MaplatTransform](https://github.com/code4history/MaplatTransform) | Apache 2.0 | `@maplat/transform` | 座標変換 |
176
+ | [MaplatEditor](https://github.com/code4history/MaplatEditor) | Apache 2.0 | — | データ作成ツール(デスクトップ) |
195
177
 
196
- ## ドキュメント
178
+ > MaplatEditor は上記ビューアライブラリが描画する地図・POI を作成する
179
+ > データ作成ツールです。Maplat エコシステムはエンドツーエンド:
180
+ > MaplatEditor で作成し、いずれかのビューアライブラリで公開、という流れになります。
197
181
 
198
- TIN内部構造の詳細情報:
199
- - [TIN 内部構造](docs/tin-internals.ja.md)
182
+ <!-- SECTION 9: Nayuta links -->
183
+ ## リンク
200
184
 
201
- ### エラーハンドリング
185
+ | 対象 | リンク | 用途 |
186
+ |---|---|---|
187
+ | プロジェクト情報・機能紹介・事例 | <https://www.maplat.jp/> | 製品サイト |
188
+ | 支援企業・案件問い合わせ | <https://www.nayuta-inc.co.jp/> | コーポレートサイト(那由多社) |
202
189
 
203
- このライブラリは以下の場合にエラーをスローします:
190
+ > ADR-0013: Apache ライセンスのリポジトリ(本リポジトリ)は両サイトへリンクします。
191
+ > MIT ライセンスの姉妹リポジトリ(Weiwudi / Quyuan / Chuci)へは那由多社リンクを置きません。
192
+ > 英語ページへ遷移する場合は `/en/` を付与してください(例: `https://www.maplat.jp/en/`)。
204
193
 
205
- - `"TOO LINEAR1"`,`"TOO LINEAR2"`: 制御点が直線状に並びすぎている
206
- - `"SOME POINTS OUTSIDE"`: 点が境界外にある
207
- - 逆変換が許可されていない状態での逆変換実行時
194
+ <!-- SECTION 10: License -->
195
+ ## License
208
196
 
209
- ## ライセンス
197
+ Apache License 2.0 — 詳細は [LICENSE](LICENSE) を参照。
198
+
199
+ ```
200
+ Copyright 2019-2026 Kohei Otsuka, Code for History / Nayuta, Inc.
201
+
202
+ Licensed under the Apache License, Version 2.0 (the "License");
203
+ you may not use this file except in compliance with the License.
204
+ You may obtain a copy of the License at
205
+
206
+ http://www.apache.org/licenses/LICENSE-2.0
207
+
208
+ Unless required by applicable law or agreed to in writing, software
209
+ distributed under the License is distributed on an "AS IS" BASIS,
210
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211
+ See the License for the specific language governing permissions and
212
+ limitations under the License.
213
+ ```
210
214
 
211
- Maplat Limited License 1.1
215
+ > **特許注記**: Maplat の座標変換技術は日本国内で特許登録されています
216
+ > (Patent No. 6684776)。
212
217
 
213
- Copyright (c) 2024-2026 Code for History
218
+ > **過去のバージョン**: 0.14.2 より前のバージョンは Maplat Limited License
219
+ > 1.1 の下で配布されていました。Apache 2.0 へのライセンス復帰は 0.14.2
220
+ > 以降に適用されます。npmjs.com 上の過去版は元の制限付きライセンス条項の
221
+ > まま残ります。
214
222
 
215
- ## 開発者
223
+ <!-- SECTION 11: Contributors / Sponsors -->
224
+ ## Contributors
216
225
 
217
226
  - Kohei Otsuka
218
227
  - Code for History
219
228
 
220
- あなたの貢献をお待ちしています![イシューやプルリクエスト](https://github.com/code4history/MaplatTin/issues)は大歓迎です。
229
+ あなたの貢献をお待ちしています!
230
+ [イシューやプルリクエスト](https://github.com/code4history/MaplatTin/issues)は大歓迎です。