@maplat/tin 1.1.1 → 1.1.2-rc.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 +6 -6
- package/README.md +6 -6
- package/dist/boundary-vertices.d.ts +1 -1
- package/dist/edge-nodes.d.ts +27 -0
- package/dist/edgebound/constrain.d.ts +23 -2
- package/dist/edgebound/index.d.ts +4 -4
- package/dist/index.d.ts +11 -11
- package/dist/kinks.d.ts +20 -0
- package/dist/maplat_tin.js +1533 -1420
- package/dist/maplat_tin.umd.js +3 -3
- package/dist/strict-overlap.d.ts +1 -1
- package/dist/tin.d.ts +5 -2
- package/dist/types/kinks.d.ts +12 -0
- package/dist/types/tin.d.ts +49 -0
- package/package.json +6 -7
- package/src/boundary-vertices.ts +1 -1
- package/src/constrained-tin.ts +1 -1
- package/src/edge-nodes.ts +126 -0
- package/src/edgebound/constrain.ts +74 -0
- package/src/index.ts +2 -2
- package/src/kinks.ts +76 -42
- package/src/tin.ts +45 -91
- package/src/types/kinks.ts +24 -0
- package/src/types/kinks.d.ts +0 -51
- /package/src/types/{tin.d.ts → tin.ts} +0 -0
package/README.ja.md
CHANGED
|
@@ -37,8 +37,8 @@ MaplatTin は Apache License 2.0(バージョン 0.14.2 以降)のオープ
|
|
|
37
37
|
## クイックスタート
|
|
38
38
|
|
|
39
39
|
<!-- release-pinned:start -->
|
|
40
|
-
> **現在のリリース: `1.1.
|
|
41
|
-
>
|
|
40
|
+
> **現在のリリース: `1.1.2-rc.2`**。このブロックは本リポジトリで唯一
|
|
41
|
+
> リリース版数を持つ場所です。ブロックの外はすべて 1.0 正式版を前提に
|
|
42
42
|
> 書かれています。
|
|
43
43
|
> npm: [`@maplat/tin`](https://www.npmjs.com/package/@maplat/tin)
|
|
44
44
|
> [](https://www.npmjs.com/package/@maplat/tin)
|
|
@@ -86,7 +86,7 @@ const restored = tin.transform(transformed, true);
|
|
|
86
86
|
|
|
87
87
|
```html
|
|
88
88
|
<!-- MaplatTin (UMD) -->
|
|
89
|
-
<script src="https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.
|
|
89
|
+
<script src="https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.2-rc.2/dist/maplat_tin.umd.js"></script>
|
|
90
90
|
<script>
|
|
91
91
|
const tin = new maplatTin.default({ wh: [500, 500] });
|
|
92
92
|
</script>
|
|
@@ -96,7 +96,7 @@ const restored = tin.transform(transformed, true);
|
|
|
96
96
|
|
|
97
97
|
```html
|
|
98
98
|
<script type="module">
|
|
99
|
-
import Tin from 'https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.
|
|
99
|
+
import Tin from 'https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.2-rc.2/dist/maplat_tin.js';
|
|
100
100
|
const tin = new Tin({ wh: [500, 500] });
|
|
101
101
|
</script>
|
|
102
102
|
```
|
|
@@ -153,7 +153,7 @@ pnpm lint # リンター/フォーマッター (ESLint/Prettier) を実
|
|
|
153
153
|
<!-- SECTION 6: Prerequisites -->
|
|
154
154
|
## 動作環境
|
|
155
155
|
|
|
156
|
-
> `package.json` の `engines`
|
|
156
|
+
> `package.json` の `engines` フィールドから自動抽出(特定のリリースに紐づく値)。
|
|
157
157
|
|
|
158
158
|
- Node.js: `>=20.0.0`(GitHub Actions で検証済みの LTS)
|
|
159
159
|
- pnpm: `>=9.0.0`(必須・`package.json` で pnpm を強制)
|
|
@@ -194,7 +194,7 @@ Maplat エコシステムの一部です。全容は下記エコシステム図
|
|
|
194
194
|
| プロジェクト情報・機能紹介・事例 | <https://www.maplat.jp/> | 製品サイト |
|
|
195
195
|
| 支援企業・案件問い合わせ | <https://www.nayuta-inc.co.jp/> | コーポレートサイト(那由多社) |
|
|
196
196
|
|
|
197
|
-
>
|
|
197
|
+
> Apache ライセンスのリポジトリ(本リポジトリ)は両サイトへリンクします。
|
|
198
198
|
> MIT ライセンスの姉妹リポジトリ(Weiwudi / Quyuan / Chuci)へは那由多社リンクを置きません。
|
|
199
199
|
> 英語ページへ遷移する場合は `/en/` を付与してください(例: `https://www.maplat.jp/en/`)。
|
|
200
200
|
|
package/README.md
CHANGED
|
@@ -40,8 +40,8 @@ MaplatTin is open-source under the Apache License 2.0 (from version 0.14.2).
|
|
|
40
40
|
## Quick Start
|
|
41
41
|
|
|
42
42
|
<!-- release-pinned:start -->
|
|
43
|
-
> **Current release: `1.1.
|
|
44
|
-
> this repository that carries a release version
|
|
43
|
+
> **Current release: `1.1.2-rc.2`**. This block is the only place in
|
|
44
|
+
> this repository that carries a release version; everything outside it is
|
|
45
45
|
> written against the 1.0 release.
|
|
46
46
|
> npm: [`@maplat/tin`](https://www.npmjs.com/package/@maplat/tin)
|
|
47
47
|
> [](https://www.npmjs.com/package/@maplat/tin)
|
|
@@ -89,7 +89,7 @@ const restored = tin.transform(transformed, true);
|
|
|
89
89
|
|
|
90
90
|
```html
|
|
91
91
|
<!-- MaplatTin (UMD) -->
|
|
92
|
-
<script src="https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.
|
|
92
|
+
<script src="https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.2-rc.2/dist/maplat_tin.umd.js"></script>
|
|
93
93
|
<script>
|
|
94
94
|
const tin = new maplatTin.default({ wh: [500, 500] });
|
|
95
95
|
</script>
|
|
@@ -99,7 +99,7 @@ Or using ES modules:
|
|
|
99
99
|
|
|
100
100
|
```html
|
|
101
101
|
<script type="module">
|
|
102
|
-
import Tin from 'https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.
|
|
102
|
+
import Tin from 'https://cdn.jsdelivr.net/npm/@maplat/tin@1.1.2-rc.2/dist/maplat_tin.js';
|
|
103
103
|
const tin = new Tin({ wh: [500, 500] });
|
|
104
104
|
</script>
|
|
105
105
|
```
|
|
@@ -155,7 +155,7 @@ Test coverage:
|
|
|
155
155
|
<!-- SECTION 6: Prerequisites -->
|
|
156
156
|
## Prerequisites
|
|
157
157
|
|
|
158
|
-
> Derived from the `engines` field in `package.json` (
|
|
158
|
+
> Derived from the `engines` field in `package.json` (release-dependent).
|
|
159
159
|
|
|
160
160
|
- Node.js: `>=20.0.0` (LTS tested via GitHub Actions)
|
|
161
161
|
- pnpm: `>=9.0.0` (required; `package.json` enforces pnpm)
|
|
@@ -196,7 +196,7 @@ repository; the Sister repositories table below is the public substitute)*
|
|
|
196
196
|
| Project info / features / cases | <https://www.maplat.jp/en/> | Product site |
|
|
197
197
|
| Sponsor / business inquiry | <https://www.nayuta-inc.co.jp/en/> | Corporate site (Nayuta, Inc.) |
|
|
198
198
|
|
|
199
|
-
>
|
|
199
|
+
> Apache-licensed repositories (this one) link to both sites.
|
|
200
200
|
> MIT-licensed sister repos (Weiwudi / Quyuan / Chuci) carry no Nayuta link.
|
|
201
201
|
|
|
202
202
|
<!-- SECTION 10: License -->
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Position } from 'geojson';
|
|
2
|
+
/** [紙の面の位置, 地理面の位置, 折れ線の全長に対する比] */
|
|
3
|
+
export type EdgeNodeItem = [Position, Position, number];
|
|
4
|
+
/**
|
|
5
|
+
* 両面の折れ点を「同じ位置」とみなす累積長比の許容幅。
|
|
6
|
+
*
|
|
7
|
+
* 比は 0 以上 1 以下なので絶対許容幅で足りる。`Math.sqrt` と加算・除算の丸めだけで
|
|
8
|
+
* 生じる比のずれは理論上 (2n+12)×Number.EPSILON(n は片側のセグメント数、実測では
|
|
9
|
+
* 最大 2×Number.EPSILON)に収まるため、実測値の 128 倍・理論値(n=122)を覆う
|
|
10
|
+
* 256×Number.EPSILON を採る。正当に別の位置にある折れ点の比の間隔は実データで
|
|
11
|
+
* 6.9e-3 以上(合成の悪条件でも 1e-11)あるため、この幅では誤って結びつかない。
|
|
12
|
+
*/
|
|
13
|
+
export declare const RATIO_MATCH_TOLERANCE: number;
|
|
14
|
+
/**
|
|
15
|
+
* 必須エッジの中継点を作る。両面の折れ線(端点を含む)を、累積長の比で突き合わせ、片方の面の折れ点を
|
|
16
|
+
* 相手の面へ写す。比の順に並べて返す。
|
|
17
|
+
*
|
|
18
|
+
* 比が許容幅内に一致する折れ点同士は 1 つの中継点へまとめ、どちらの面の折れ点の位置もそのまま使う。
|
|
19
|
+
* 一致する相手が無ければ、相手面の該当する区間を線形補間する。丸めで比がわずかにずれただけの
|
|
20
|
+
* 対応する折れ点を 2 つに分けて作らせないため、範囲チェックより前に許容幅内の最寄りを探す。
|
|
21
|
+
*
|
|
22
|
+
* `Tin#generatePointsSet` がこの関数を使う。
|
|
23
|
+
*
|
|
24
|
+
* @param illstNodes 紙の面の折れ線(始点・折れ点・終点)
|
|
25
|
+
* @param mercNodes 地理面の折れ線(始点・折れ点・終点)
|
|
26
|
+
*/
|
|
27
|
+
export declare function interpolateEdgeNodes(illstNodes: Position[], mercNodes: Position[]): EdgeNodeItem[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Base, DelaunatorLike, intersectSegments as baseIntersectSegments } from "./base";
|
|
2
|
-
import { BitSet } from "./bitset";
|
|
1
|
+
import { Base, DelaunatorLike, intersectSegments as baseIntersectSegments } from "./base.js";
|
|
2
|
+
import { BitSet } from "./bitset.js";
|
|
3
3
|
export declare class Constrain extends Base {
|
|
4
4
|
vertMap: Uint32Array;
|
|
5
5
|
flips: BitSet;
|
|
@@ -15,6 +15,27 @@ export declare class Constrain extends Base {
|
|
|
15
15
|
* Constrain the triangulation such that there is an edge between p1 and p2.
|
|
16
16
|
*/
|
|
17
17
|
constrainOne(segP1: number, segP2: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Upper bound for the number of steps taken while constraining one edge.
|
|
20
|
+
*
|
|
21
|
+
* A constraint that crosses k edges is resolved in passes over the crossed
|
|
22
|
+
* edges, so the number of steps can grow with k squared (for example when
|
|
23
|
+
* the crossed edges fan out between two bowed rows of points). k is less
|
|
24
|
+
* than the number of half-edges, so the square of that number is never
|
|
25
|
+
* reached by a walk that terminates. The floor keeps tiny meshes away from
|
|
26
|
+
* the limit.
|
|
27
|
+
*/
|
|
28
|
+
private maxConstrainSteps;
|
|
29
|
+
/**
|
|
30
|
+
* Throw unless `vertex` is part of the triangulation. Delaunator leaves out
|
|
31
|
+
* points that coincide with another point, so a valid point id may have no
|
|
32
|
+
* triangle. An edge cannot start or end at such a point.
|
|
33
|
+
*/
|
|
34
|
+
private assertInTriangulation;
|
|
35
|
+
/**
|
|
36
|
+
* Throw unless `vertex` is an id of a point given to Delaunator.
|
|
37
|
+
*/
|
|
38
|
+
private assertVertex;
|
|
18
39
|
/**
|
|
19
40
|
* Fix the Delaunay condition.
|
|
20
41
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Constrain } from "./constrain";
|
|
2
|
-
export { nextEdge, prevEdge, intersectSegments, type DelaunatorLike, Base, } from "./base";
|
|
3
|
-
export { BitSet8, BitSet16, BitSet32 } from "./bitset";
|
|
4
|
-
export type { BitSet } from "./bitset";
|
|
1
|
+
export { Constrain } from "./constrain.js";
|
|
2
|
+
export { nextEdge, prevEdge, intersectSegments, type DelaunatorLike, Base, } from "./base.js";
|
|
3
|
+
export { BitSet8, BitSet16, BitSet32 } from "./bitset.js";
|
|
4
|
+
export type { BitSet } from "./bitset.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* This is the main entry point for the library.
|
|
5
5
|
* Provides TIN generation with constrained edges for map transformation.
|
|
6
6
|
*/
|
|
7
|
-
export { Tin } from "./tin";
|
|
8
|
-
export type { Options } from "./tin";
|
|
9
|
-
export { Tin as default } from "./tin";
|
|
10
|
-
export { default as constrainedTin } from "./constrained-tin";
|
|
11
|
-
export { default as findIntersections } from "./kinks";
|
|
12
|
-
export { insertSearchIndex } from "./searchutils";
|
|
13
|
-
export { counterPoint, createPoint, vertexCalc } from "./vertexutils";
|
|
14
|
-
export type { SearchIndex } from "./searchutils";
|
|
15
|
-
export type { IntersectionPoint } from "./types/kinks.
|
|
16
|
-
export type { TriangleProperties } from "./types/tin.
|
|
7
|
+
export { Tin } from "./tin.js";
|
|
8
|
+
export type { Options } from "./tin.js";
|
|
9
|
+
export { Tin as default } from "./tin.js";
|
|
10
|
+
export { default as constrainedTin } from "./constrained-tin.js";
|
|
11
|
+
export { default as findIntersections } from "./kinks.js";
|
|
12
|
+
export { insertSearchIndex } from "./searchutils.js";
|
|
13
|
+
export { counterPoint, createPoint, vertexCalc } from "./vertexutils.js";
|
|
14
|
+
export type { SearchIndex } from "./searchutils.js";
|
|
15
|
+
export type { IntersectionPoint } from "./types/kinks.js";
|
|
16
|
+
export type { TriangleProperties } from "./types/tin.js";
|
|
17
17
|
export type { Compiled, Edge, EdgeSet, EdgeSetLegacy, PointSet, PropertyTriKey, StrictMode, StrictStatus, Tins, Transform, Tri, VertexMode, YaxisMode, } from '@maplat/transform';
|
|
18
|
-
export { FORMAT_VERSION_V2 as format_version } from "./tin";
|
|
18
|
+
export { FORMAT_VERSION_V2 as format_version } from "./tin.js";
|
package/dist/kinks.d.ts
CHANGED
|
@@ -7,3 +7,23 @@ import { Feature, Point, Position } from 'geojson';
|
|
|
7
7
|
* @throws {Error} 座標に有限数(Number.isFinite)でない値が含まれる場合
|
|
8
8
|
*/
|
|
9
9
|
export default function findIntersections(coords: Position[][]): Feature<Point>[];
|
|
10
|
+
/**
|
|
11
|
+
* Tin が 1 方向(forw / bakw)について数え上げる交差の件数の上限
|
|
12
|
+
* (同じ位置の交差を 1 件に数えた件数)。
|
|
13
|
+
*
|
|
14
|
+
* 交差の件数は線分の数の 2 乗まで増えうる。対応が大きく乱れた制御点では
|
|
15
|
+
* 時間とメモリを使い切るため、ここで打ち切る。
|
|
16
|
+
* 同梱の実データで strict の交差が最も多いもの(約 3 万件)の 3 倍強にあたる。
|
|
17
|
+
*/
|
|
18
|
+
export declare const MAX_KINKS_PER_DIRECTION = 100000;
|
|
19
|
+
/**
|
|
20
|
+
* 線分の交差点を、件数の上限つきで検出する(Tin の内部用)
|
|
21
|
+
*
|
|
22
|
+
* @param coords - 線分群の座標配列
|
|
23
|
+
* @param limit - 返す交差点の件数の上限。同じ位置の交差を 1 件に数えた件数で数え、
|
|
24
|
+
* 届いた時点で検出をやめる。位置が重なる交差ばかりのときは、見つけた交差の総数が
|
|
25
|
+
* limit の 16 倍に届いた時点でもやめる
|
|
26
|
+
* @returns 検出された交差点のFeature配列(同じ位置の重複なし・高々 limit 件)
|
|
27
|
+
* @throws {Error} 座標に有限数(Number.isFinite)でない値が含まれる場合
|
|
28
|
+
*/
|
|
29
|
+
export declare function findIntersectionsUpTo(coords: Position[][], limit: number): Feature<Point>[];
|