@maplat/transform 0.1.3 → 0.1.5

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 CHANGED
@@ -1,69 +1,69 @@
1
- # Maplat Transform
2
-
3
- Maplatで生成された座標変換定義を使用して、2つの平面座標系間で座標変換を実現するJavaScriptライブラリです。
4
- [Maplat](https://github.com/code4history/Maplat/)プロジェクトの一部として開発されています。
5
-
6
- English README is [here](./README.md).
7
-
8
- ## 主な機能
9
-
10
- - **座標変換定義のインポート:** Maplatで生成された座標変換定義をインポートし、変換のための内部構造を構築
11
- - **双方向座標変換:** 2つの平面間で双方向の座標変換が可能
12
- - **位相保存:** 変換時の同相性(トポロジー)を維持
13
- - **複数の座標系サポート:** 通常の直交座標系、Y軸反転座標系、鳥瞰図のような歪んだ座標系など、様々な座標系間の変換に対応
14
- - **状態管理:** 変換状態の保存と復元をサポート
15
-
16
- ## インストール方法
17
-
18
- ### npm
19
-
20
- ```sh
21
- npm install @maplat/transform
22
- ```
23
-
24
- ### ブラウザ
25
-
26
- ```html
27
- <script src="https://unpkg.com/@maplat/transform/dist/maplat_transform.umd.js"></script>
28
- ```
29
-
30
- ## 基本的な使用方法
31
-
32
- ```javascript
33
- // 変換定義データのインポート
34
- const transform = new Transform();
35
- transform.setCompiled(compiledData); // Maplatで生成された変換定義を適用
36
-
37
- // 順方向の変換(ソース座標系 → ターゲット座標系)
38
- const transformed = transform.transform([100, 100], false);
39
-
40
- // 逆方向の変換(ターゲット座標系 → ソース座標系)
41
- const restored = transform.transform(transformed, true);
42
- ```
43
-
44
- ### エラーハンドリング
45
-
46
- このライブラリは以下の場合にエラーをスローする可能性があります:
47
-
48
- - 厳密モードでの変換エラー時
49
- - 逆変換が許可されていない状態での逆変換実行時
50
- - 不正なデータ構造での変換実行時
51
-
52
- エラーが発生した場合は、変換定義データの修正が必要です。変換定義の修正は[@maplat/tin](https://github.com/code4history/MaplatTin/)を使用したエディタツールで行ってください。
53
-
54
- ## 注意事項
55
-
56
- このライブラリは座標変換の実行に特化しており、変換定義自体の生成や編集機能は含まれていません。変換定義の作成や編集が必要な場合は、[@maplat/tin](https://github.com/code4history/MaplatTin/)パッケージをご利用ください。
57
-
58
- ## ライセンス
59
-
60
- Maplat Limited License 1.1
61
-
62
- Copyright (c) 2024 Code for History
63
-
64
- ### 開発者
65
-
66
- - Kohei Otsuka
67
- - Code for History
68
-
1
+ # Maplat Transform
2
+
3
+ Maplatで生成された座標変換定義を使用して、2つの平面座標系間で座標変換を実現するJavaScriptライブラリです。
4
+ [Maplat](https://github.com/code4history/Maplat/)プロジェクトの一部として開発されています。
5
+
6
+ English README is [here](./README.md).
7
+
8
+ ## 主な機能
9
+
10
+ - **座標変換定義のインポート:** Maplatで生成された座標変換定義をインポートし、変換のための内部構造を構築
11
+ - **双方向座標変換:** 2つの平面間で双方向の座標変換が可能
12
+ - **位相保存:** 変換時の同相性(トポロジー)を維持
13
+ - **複数の座標系サポート:** 通常の直交座標系、Y軸反転座標系、鳥瞰図のような歪んだ座標系など、様々な座標系間の変換に対応
14
+ - **状態管理:** 変換状態の保存と復元をサポート
15
+
16
+ ## インストール方法
17
+
18
+ ### npm
19
+
20
+ ```sh
21
+ npm install @maplat/transform
22
+ ```
23
+
24
+ ### ブラウザ
25
+
26
+ ```html
27
+ <script src="https://unpkg.com/@maplat/transform/dist/maplat_transform.umd.js"></script>
28
+ ```
29
+
30
+ ## 基本的な使用方法
31
+
32
+ ```javascript
33
+ // 変換定義データのインポート
34
+ const transform = new Transform();
35
+ transform.setCompiled(compiledData); // Maplatで生成された変換定義を適用
36
+
37
+ // 順方向の変換(ソース座標系 → ターゲット座標系)
38
+ const transformed = transform.transform([100, 100], false);
39
+
40
+ // 逆方向の変換(ターゲット座標系 → ソース座標系)
41
+ const restored = transform.transform(transformed, true);
42
+ ```
43
+
44
+ ### エラーハンドリング
45
+
46
+ このライブラリは以下の場合にエラーをスローする可能性があります:
47
+
48
+ - 厳密モードでの変換エラー時
49
+ - 逆変換が許可されていない状態での逆変換実行時
50
+ - 不正なデータ構造での変換実行時
51
+
52
+ エラーが発生した場合は、変換定義データの修正が必要です。変換定義の修正は[@maplat/tin](https://github.com/code4history/MaplatTin/)を使用したエディタツールで行ってください。
53
+
54
+ ## 注意事項
55
+
56
+ このライブラリは座標変換の実行に特化しており、変換定義自体の生成や編集機能は含まれていません。変換定義の作成や編集が必要な場合は、[@maplat/tin](https://github.com/code4history/MaplatTin/)パッケージをご利用ください。
57
+
58
+ ## ライセンス
59
+
60
+ Maplat Limited License 1.1
61
+
62
+ Copyright (c) 2024 Code for History
63
+
64
+ ### 開発者
65
+
66
+ - Kohei Otsuka
67
+ - Code for History
68
+
69
69
  あなたの貢献をお待ちしています![イシューやプルリクエスト](https://github.com/code4history/MaplatTransform/issues)は大歓迎です。
package/README.md CHANGED
@@ -1,69 +1,69 @@
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
- ### Browser
25
-
26
- ```html
27
- <script src="https://unpkg.com/@maplat/transform/dist/maplat_transform.umd.js"></script>
28
- ```
29
-
30
- ## Basic Usage
31
-
32
- ```javascript
33
- // Import transformation definition
34
- const transform = new Transform();
35
- transform.setCompiled(compiledData); // Apply transformation definition generated by Maplat
36
-
37
- // Forward transformation (source → target coordinate system)
38
- const transformed = transform.transform([100, 100], false);
39
-
40
- // Backward transformation (target → source coordinate system)
41
- const restored = transform.transform(transformed, true);
42
- ```
43
-
44
- ### Error Handling
45
-
46
- The library may throw errors in the following cases:
47
-
48
- - Transformation errors in strict mode
49
- - Attempting backward transformation when not allowed
50
- - Invalid data structure during transformation
51
-
52
- 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.
53
-
54
- ## Important Note
55
-
56
- 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.
57
-
58
- ## License
59
-
60
- Maplat Limited License 1.1
61
-
62
- Copyright (c) 2024 Code for History
63
-
64
- ### Developers
65
-
66
- - Kohei Otsuka
67
- - Code for History
68
-
69
- 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
+ ### Browser
25
+
26
+ ```html
27
+ <script src="https://unpkg.com/@maplat/transform/dist/maplat_transform.umd.js"></script>
28
+ ```
29
+
30
+ ## Basic Usage
31
+
32
+ ```javascript
33
+ // Import transformation definition
34
+ const transform = new Transform();
35
+ transform.setCompiled(compiledData); // Apply transformation definition generated by Maplat
36
+
37
+ // Forward transformation (source → target coordinate system)
38
+ const transformed = transform.transform([100, 100], false);
39
+
40
+ // Backward transformation (target → source coordinate system)
41
+ const restored = transform.transform(transformed, true);
42
+ ```
43
+
44
+ ### Error Handling
45
+
46
+ The library may throw errors in the following cases:
47
+
48
+ - Transformation errors in strict mode
49
+ - Attempting backward transformation when not allowed
50
+ - Invalid data structure during transformation
51
+
52
+ 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.
53
+
54
+ ## Important Note
55
+
56
+ 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.
57
+
58
+ ## License
59
+
60
+ Maplat Limited License 1.1
61
+
62
+ Copyright (c) 2024 Code for History
63
+
64
+ ### Developers
65
+
66
+ - Kohei Otsuka
67
+ - Code for History
68
+
69
+ We welcome your contributions! Feel free to submit [issues and pull requests](https://github.com/code4history/MaplatTransform/issues).
package/dist/index.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare function counterTri(tri: Tri): Tri;
61
61
  * エッジの終点を表す型
62
62
  * [始点のインデックス, 終点のインデックス]
63
63
  */
64
- declare type Edge = [number, number];
64
+ export declare type Edge = [number, number];
65
65
 
66
66
  /**
67
67
  * エッジセットの型
@@ -152,7 +152,7 @@ export declare type StrictMode = "strict" | "auto" | "loose";
152
152
  */
153
153
  export declare type StrictStatus = "strict" | "strict_error" | "loose";
154
154
 
155
- declare type Tins = FeatureCollection<Polygon, PropertiesTri>;
155
+ export declare type Tins = FeatureCollection<Polygon, PropertiesTri>;
156
156
 
157
157
  export declare type TinsBD = {
158
158
  [key in BiDirectionKey]?: Tins;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.1.3",
7
+ "version": "0.1.5",
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",
@@ -32,7 +32,8 @@
32
32
  "test:watch": "vitest",
33
33
  "coverage": "vitest run --coverage",
34
34
  "lint": "eslint src tests",
35
- "typecheck": "tsc --noEmit"
35
+ "typecheck": "tsc --noEmit",
36
+ "prepublishOnly": "npm run build"
36
37
  },
37
38
  "repository": {
38
39
  "type": "git",
package/src/index.ts CHANGED
@@ -10,10 +10,10 @@ import type {
10
10
  } from "./geometry";
11
11
  import { unitCalc, transformArr } from "./geometry";
12
12
  import type { EdgeSet, EdgeSetLegacy } from "./edgeutils";
13
- export type { Tri, PropertyTriKey } from './geometry';
13
+ export type { Tins, Tri, PropertyTriKey } from './geometry';
14
14
  export { transformArr } from './geometry';
15
15
  export { rotateVerticesTriangle, counterTri } from './triangulation';
16
- export type { EdgeSet, EdgeSetLegacy } from './edgeutils';
16
+ export type { Edge, EdgeSet, EdgeSetLegacy } from './edgeutils';
17
17
  export { normalizeEdges } from './edgeutils';
18
18
 
19
19
  /**