@maplat/tin 0.11.0 → 0.11.1

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/dist/index.d.ts CHANGED
@@ -1,196 +1,17 @@
1
- import { Compiled } from '@maplat/transform';
2
- import { Edge } from '@maplat/transform';
3
- import { EdgeSet } from '@maplat/transform';
4
- import { EdgeSetLegacy } from '@maplat/transform';
5
- import { FeatureCollection } from 'geojson';
6
- import { GeoJsonProperties } from 'geojson';
7
- import { Geometry } from 'geojson';
8
- import { PointSet } from '@maplat/transform';
9
- import { Position } from 'geojson';
10
- import { StrictMode } from '@maplat/transform';
11
- import { Transform } from '@maplat/transform';
12
- import { VertexMode } from '@maplat/transform';
13
- import { YaxisMode } from '@maplat/transform';
14
-
15
- /**
16
- * Tinクラスの初期化オプション
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 { createPoint, counterPoint, vertexCalc } from "./vertexutils";
13
+ export type { SearchIndex } from "./searchutils";
14
+ export type { IntersectionPoint } from "./types/kinks";
15
+ export type { TriangleProperties } from "./types/tin";
16
+ export type { Compiled, Edge, EdgeSet, EdgeSetLegacy, PointSet, PropertyTriKey, StrictMode, StrictStatus, Tri, Tins, Transform, VertexMode, YaxisMode } from '@maplat/transform';
17
+ export { format_version } from '@maplat/transform';
@@ -0,0 +1,8 @@
1
+ import { Position, Feature, Point } from 'geojson';
2
+ /**
3
+ * 線分の交差点を検出するメインの関数
4
+ *
5
+ * @param coords - 線分群の座標配列。各線分は始点と終点の座標で表現
6
+ * @returns 検出された交差点のFeature配列
7
+ */
8
+ export default function findIntersections(coords: Position[][]): Feature<Point>[];
@@ -0,0 +1,21 @@
1
+ import { Tri, Tins } 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 };
package/dist/tin.cjs ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";var Ge=Object.defineProperty;var Ke=(o,t,e)=>t in o?Ge(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var rt=(o,t,e)=>Ke(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qe=require("@turf/boolean-point-in-polygon"),Ze=require("@turf/centroid"),ye=require("@turf/convex"),ft=require("@turf/helpers"),tn=require("@turf/line-intersect"),en=require("delaunator");var nn=Object.defineProperty,sn=(o,t,e)=>t in o?nn(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,st=(o,t,e)=>sn(o,typeof t!="symbol"?t+"":t,e);const Tt=11102230246251565e-32,dt=134217729,rn=(3+8*Tt)*Tt;function ae(o,t,e,n,i){let s,r,a,f,h=t[0],u=n[0],c=0,l=0;u>h==u>-h?(s=h,h=t[++c]):(s=u,u=n[++l]);let p=0;if(c<o&&l<e)for(u>h==u>-h?(r=h+s,a=s-(r-h),h=t[++c]):(r=u+s,a=s-(r-u),u=n[++l]),s=r,a!==0&&(i[p++]=a);c<o&&l<e;)u>h==u>-h?(r=s+h,f=r-s,a=s-(r-f)+(h-f),h=t[++c]):(r=s+u,f=r-s,a=s-(r-f)+(u-f),u=n[++l]),s=r,a!==0&&(i[p++]=a);for(;c<o;)r=s+h,f=r-s,a=s-(r-f)+(h-f),h=t[++c],s=r,a!==0&&(i[p++]=a);for(;l<e;)r=s+u,f=r-s,a=s-(r-f)+(u-f),u=n[++l],s=r,a!==0&&(i[p++]=a);return(s!==0||p===0)&&(i[p++]=s),p}function on(o,t){let e=t[0];for(let n=1;n<o;n++)e+=t[n];return e}function Qt(o){return new Float64Array(o)}const an=(3+16*Tt)*Tt,cn=(2+12*Tt)*Tt,hn=(9+64*Tt)*Tt*Tt,Vt=Qt(4),ke=Qt(8),xe=Qt(12),_e=Qt(16),pt=Qt(4);function fn(o,t,e,n,i,s,r){let a,f,h,u,c,l,p,y,g,b,w,M,_,v,T,I,N,V;const W=o-i,G=e-i,tt=t-s,z=n-s;v=W*z,l=dt*W,p=l-(l-W),y=W-p,l=dt*z,g=l-(l-z),b=z-g,T=y*b-(v-p*g-y*g-p*b),I=tt*G,l=dt*tt,p=l-(l-tt),y=tt-p,l=dt*G,g=l-(l-G),b=G-g,N=y*b-(I-p*g-y*g-p*b),w=T-N,c=T-w,Vt[0]=T-(w+c)+(c-N),M=v+w,c=M-v,_=v-(M-c)+(w-c),w=_-I,c=_-w,Vt[1]=_-(w+c)+(c-I),V=M+w,c=V-M,Vt[2]=M-(V-c)+(w-c),Vt[3]=V;let it=on(4,Vt),d=cn*r;if(it>=d||-it>=d||(c=o-W,a=o-(W+c)+(c-i),c=e-G,h=e-(G+c)+(c-i),c=t-tt,f=t-(tt+c)+(c-s),c=n-z,u=n-(z+c)+(c-s),a===0&&f===0&&h===0&&u===0)||(d=hn*r+rn*Math.abs(it),it+=W*u+z*a-(tt*h+G*f),it>=d||-it>=d))return it;v=a*z,l=dt*a,p=l-(l-a),y=a-p,l=dt*z,g=l-(l-z),b=z-g,T=y*b-(v-p*g-y*g-p*b),I=f*G,l=dt*f,p=l-(l-f),y=f-p,l=dt*G,g=l-(l-G),b=G-g,N=y*b-(I-p*g-y*g-p*b),w=T-N,c=T-w,pt[0]=T-(w+c)+(c-N),M=v+w,c=M-v,_=v-(M-c)+(w-c),w=_-I,c=_-w,pt[1]=_-(w+c)+(c-I),V=M+w,c=V-M,pt[2]=M-(V-c)+(w-c),pt[3]=V;const m=ae(4,Vt,4,pt,ke);v=W*u,l=dt*W,p=l-(l-W),y=W-p,l=dt*u,g=l-(l-u),b=u-g,T=y*b-(v-p*g-y*g-p*b),I=tt*h,l=dt*tt,p=l-(l-tt),y=tt-p,l=dt*h,g=l-(l-h),b=h-g,N=y*b-(I-p*g-y*g-p*b),w=T-N,c=T-w,pt[0]=T-(w+c)+(c-N),M=v+w,c=M-v,_=v-(M-c)+(w-c),w=_-I,c=_-w,pt[1]=_-(w+c)+(c-I),V=M+w,c=V-M,pt[2]=M-(V-c)+(w-c),pt[3]=V;const x=ae(m,ke,4,pt,xe);v=a*u,l=dt*a,p=l-(l-a),y=a-p,l=dt*u,g=l-(l-u),b=u-g,T=y*b-(v-p*g-y*g-p*b),I=f*h,l=dt*f,p=l-(l-f),y=f-p,l=dt*h,g=l-(l-h),b=h-g,N=y*b-(I-p*g-y*g-p*b),w=T-N,c=T-w,pt[0]=T-(w+c)+(c-N),M=v+w,c=M-v,_=v-(M-c)+(w-c),w=_-I,c=_-w,pt[1]=_-(w+c)+(c-I),V=M+w,c=V-M,pt[2]=M-(V-c)+(w-c),pt[3]=V;const A=ae(x,xe,4,pt,_e);return _e[A-1]}function un(o,t,e,n,i,s){const r=(t-s)*(e-i),a=(o-i)*(n-s),f=r-a,h=Math.abs(r+a);return Math.abs(f)>=an*h?f:-fn(o,t,e,n,i,s,h)}function ln(o,t){var e,n,i=0,s,r,a,f,h,u,c,l=o[0],p=o[1],y=t.length;for(e=0;e<y;e++){n=0;var g=t[e],b=g.length-1;if(u=g[0],u[0]!==g[b][0]&&u[1]!==g[b][1])throw new Error("First and last coordinates in a ring must be the same");for(r=u[0]-l,a=u[1]-p,n;n<b;n++){if(c=g[n+1],f=c[0]-l,h=c[1]-p,a===0&&h===0){if(f<=0&&r>=0||r<=0&&f>=0)return 0}else if(h>=0&&a<=0||h<=0&&a>=0){if(s=un(r,f,a,h,0,0),s===0)return 0;(s>0&&h>0&&a<=0||s<0&&h<=0&&a>0)&&i++}u=c,a=h,r=f}}return i%2!==0}function Be(o,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=o,n}function Xt(o,t,e={}){if(!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Se(o[0])||!Se(o[1]))throw new Error("coordinates must contain numbers");return Be({type:"Point",coordinates:o},t,e)}function De(o,t,e={}){for(const n of o){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<n[n.length-1].length;i++)if(n[n.length-1][i]!==n[0][i])throw new Error("First and last Position are not equivalent.")}return Be({type:"Polygon",coordinates:o},t,e)}function Lt(o,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=o,e}function Se(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}function dn(o){if(!o)throw new Error("coord is required");if(!Array.isArray(o)){if(o.type==="Feature"&&o.geometry!==null&&o.geometry.type==="Point")return[...o.geometry.coordinates];if(o.type==="Point")return[...o.coordinates]}if(Array.isArray(o)&&o.length>=2&&!Array.isArray(o[0])&&!Array.isArray(o[1]))return[...o];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Me(o){if(Array.isArray(o))return o;if(o.type==="Feature"){if(o.geometry!==null)return o.geometry.coordinates}else if(o.coordinates)return o.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gn(o){return o.type==="Feature"?o.geometry:o}function pn(o,t,e={}){if(!o)throw new Error("point is required");if(!t)throw new Error("polygon is required");const n=dn(o),i=gn(t),s=i.type,r=t.bbox;let a=i.coordinates;if(r&&wn(n,r)===!1)return!1;s==="Polygon"&&(a=[a]);let f=!1;for(var h=0;h<a.length;++h){const u=ln(n,a[h]);if(u===0)return!e.ignoreBoundary;u&&(f=!0)}return f}function wn(o,t){return t[0]<=o[0]&&t[1]<=o[1]&&t[2]>=o[0]&&t[3]>=o[1]}var pe=pn;function Ae(o){const t=o.features;for(let e=0;e<t.length;e++){const n=t[e];`${n.properties.a.index}`.substring(0,1)==="b"&&`${n.properties.b.index}`.substring(0,1)==="b"?t[e]={geometry:{type:"Polygon",coordinates:[[n.geometry.coordinates[0][2],n.geometry.coordinates[0][0],n.geometry.coordinates[0][1],n.geometry.coordinates[0][2]]]},properties:{a:{geom:n.properties.c.geom,index:n.properties.c.index},b:{geom:n.properties.a.geom,index:n.properties.a.index},c:{geom:n.properties.b.geom,index:n.properties.b.index}},type:"Feature"}:`${n.properties.c.index}`.substring(0,1)==="b"&&`${n.properties.a.index}`.substring(0,1)==="b"&&(t[e]={geometry:{type:"Polygon",coordinates:[[n.geometry.coordinates[0][1],n.geometry.coordinates[0][2],n.geometry.coordinates[0][0],n.geometry.coordinates[0][1]]]},properties:{a:{geom:n.properties.b.geom,index:n.properties.b.index},b:{geom:n.properties.c.geom,index:n.properties.c.index},c:{geom:n.properties.a.geom,index:n.properties.a.index}},type:"Feature"})}return o}function mn(o){const t=["a","b","c","a"].map(s=>o.properties[s].geom),e=o.geometry.coordinates[0],n=o.properties,i={a:{geom:e[0],index:n.a.index},b:{geom:e[1],index:n.b.index},c:{geom:e[2],index:n.c.index}};return De([t],i)}function bn(o){const t=[0,1,2,0].map(n=>o[n][0][0]),e={a:{geom:o[0][0][1],index:o[0][1]},b:{geom:o[1][0][1],index:o[1][1]},c:{geom:o[2][0][1],index:o[2][1]}};return De([t],e)}function Zt(o,t,e,n,i,s=!1,r){const a=o.map(f=>{(!r||r<2.00703)&&(f=Fe(f));const h=isFinite(f)?t[f]:f==="c"?n:f==="b0"?i[0]:f==="b1"?i[1]:f==="b2"?i[2]:f==="b3"?i[3]:function(){const u=f.match(/e(\d+)/);if(u){const c=parseInt(u[1]);return e[c]}throw"Bad index value for indexesToTri"}();return s?[[h[1],h[0]],f]:[[h[0],h[1]],f]});return bn(a)}function Fe(o){return typeof o=="number"?o:o.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/,"$1$2")}function je(o,t){return t&&t>=2.00703||Array.isArray(o[0])?o:o.map(e=>[e.illstNodes,e.mercNodes,e.startEnd])}function Ee(o,t){for(let e=0;e<t.features.length;e++)if(pe(o,t.features[e]))return t.features[e]}function Le(o,t,e){const n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],s=t.geometry.coordinates[0][2],r=o.geometry.coordinates,a=t.properties.a.geom,f=t.properties.b.geom,h=t.properties.c.geom,u=[i[0]-n[0],i[1]-n[1]],c=[s[0]-n[0],s[1]-n[1]],l=[r[0]-n[0],r[1]-n[1]],p=[f[0]-a[0],f[1]-a[1]],y=[h[0]-a[0],h[1]-a[1]];let g=(c[1]*l[0]-c[0]*l[1])/(u[0]*c[1]-u[1]*c[0]),b=(u[0]*l[1]-u[1]*l[0])/(u[0]*c[1]-u[1]*c[0]);if(e){const w=e[t.properties.a.index],M=e[t.properties.b.index],_=e[t.properties.c.index];let v;if(g<0||b<0||1-g-b<0){const T=g/(g+b),I=b/(g+b);v=g/M/(T/M+I/_),b=b/_/(T/M+I/_)}else v=g/M/(g/M+b/_+(1-g-b)/w),b=b/_/(g/M+b/_+(1-g-b)/w);g=v}return[g*p[0]+b*y[0]+a[0],g*p[1]+b*y[1]+a[1]]}function yn(o,t,e,n){const i=o.geometry.coordinates,s=e.geometry.coordinates,r=Math.atan2(i[0]-s[0],i[1]-s[1]),a=kn(r,t[0]);if(a===void 0)throw new Error("Unable to determine vertex index");const f=t[1][a];return Le(o,f.features[0],n)}function re(o,t,e,n,i,s,r,a){let f;if(r&&(f=Ee(o,Lt([r]))),!f){if(e){const h=o.geometry.coordinates,u=e.gridNum,c=e.xOrigin,l=e.yOrigin,p=e.xUnit,y=e.yUnit,g=e.gridCache,b=Et(h[0],c,p,u),w=Et(h[1],l,y,u),M=g[b]?g[b][w]?g[b][w]:[]:[];t=Lt(M.map(_=>t.features[_]))}f=Ee(o,t)}return a&&a(f),f?Le(o,f,s):yn(o,n,i,s)}function Et(o,t,e,n){let i=Math.floor((o-t)/e);return i>=n&&(i=n-1),i}function kn(o,t){let e=ve(o-t[0]),n=Math.PI*2,i;for(let s=0;s<t.length;s++){const r=(s+1)%t.length,a=ve(o-t[r]),f=Math.min(Math.abs(e),Math.abs(a));e*a<=0&&f<n&&(n=f,i=s),e=a}return i}function ve(o,t=!1){const e=t?function(n){return!(n>=0&&n<Math.PI*2)}:function(n){return!(n>-1*Math.PI&&n<=Math.PI)};for(;e(o);)o=o+2*Math.PI*(o>0?-1:1);return o}const Kt=2.00703,xt=class _t{constructor(){st(this,"points",[]),st(this,"pointsWeightBuffer"),st(this,"strict_status"),st(this,"vertices_params"),st(this,"centroid"),st(this,"edgeNodes"),st(this,"edges"),st(this,"tins"),st(this,"kinks"),st(this,"yaxisMode",_t.YAXIS_INVERT),st(this,"strictMode",_t.MODE_AUTO),st(this,"vertexMode",_t.VERTEX_PLAIN),st(this,"bounds"),st(this,"boundsPolygon"),st(this,"wh"),st(this,"xy"),st(this,"indexedTins"),st(this,"stateFull",!1),st(this,"stateTriangle"),st(this,"stateBackward")}setCompiled(t){if(t.version||!t.tins&&t.points&&t.tins_points){this.points=t.points,this.pointsWeightBuffer=!t.version||t.version<2.00703?["forw","bakw"].reduce((n,i)=>{const s=t.weight_buffer[i];return s&&(n[i]=Object.keys(s).reduce((r,a)=>{const f=Fe(a);return r[f]=s[a],r},{})),n},{}):t.weight_buffer,t.strict_status?this.strict_status=t.strict_status:t.kinks_points?this.strict_status=_t.STATUS_ERROR:t.tins_points.length==2?this.strict_status=_t.STATUS_LOOSE:this.strict_status=_t.STATUS_STRICT,this.vertices_params={forw:[t.vertices_params[0]],bakw:[t.vertices_params[1]]},this.vertices_params.forw[1]=[0,1,2,3].map(n=>{const i=(n+1)%4,s=Zt(["c",`b${n}`,`b${i}`],t.points,t.edgeNodes||[],t.centroid_point,t.vertices_points,!1,Kt);return Lt([s])}),this.vertices_params.bakw[1]=[0,1,2,3].map(n=>{const i=(n+1)%4,s=Zt(["c",`b${n}`,`b${i}`],t.points,t.edgeNodes||[],t.centroid_point,t.vertices_points,!0,Kt);return Lt([s])}),this.centroid={forw:Xt(t.centroid_point[0],{target:{geom:t.centroid_point[1],index:"c"}}),bakw:Xt(t.centroid_point[1],{target:{geom:t.centroid_point[0],index:"c"}})},this.edges=je(t.edges||[]),this.edgeNodes=t.edgeNodes||[];const e=t.tins_points.length==1?0:1;this.tins={forw:Lt(t.tins_points[0].map(n=>Zt(n,t.points,t.edgeNodes||[],t.centroid_point,t.vertices_points,!1,t.version))),bakw:Lt(t.tins_points[e].map(n=>Zt(n,t.points,t.edgeNodes||[],t.centroid_point,t.vertices_points,!0,t.version)))},this.addIndexedTin(),t.kinks_points&&(this.kinks={bakw:Lt(t.kinks_points.map(n=>Xt(n)))}),t.yaxisMode?this.yaxisMode=t.yaxisMode:this.yaxisMode=_t.YAXIS_INVERT,t.vertexMode&&(this.vertexMode=t.vertexMode),t.strictMode&&(this.strictMode=t.strictMode),t.bounds?(this.bounds=t.bounds,this.boundsPolygon=t.boundsPolygon,this.xy=t.xy,this.wh=t.wh):(this.xy=[0,0],t.wh&&(this.wh=t.wh),this.bounds=void 0,this.boundsPolygon=void 0)}else{t=JSON.parse(JSON.stringify(t).replace('"cent"','"c"').replace(/"bbox(\d+)"/g,'"b$1"')),this.tins=t.tins,this.addIndexedTin(),this.strict_status=t.strict_status,this.pointsWeightBuffer=t.weight_buffer,this.vertices_params=t.vertices_params,this.centroid=t.centroid,this.kinks=t.kinks;const e=[];for(let n=0;n<this.tins.forw.features.length;n++){const i=this.tins.forw.features[n];["a","b","c"].map((s,r)=>{const a=i.geometry.coordinates[0][r],f=i.properties[s].geom,h=i.properties[s].index;typeof h=="number"&&(e[h]=[a,f])})}this.points=e}}addIndexedTin(){const t=this.tins,e=t.forw,n=t.bakw,i=Math.ceil(Math.sqrt(e.features.length));if(i<3){this.indexedTins=void 0;return}let s=[],r=[];const a=e.features.map(g=>{let b=[];return Me(g)[0].map(w=>{s.length===0?s=[Array.from(w),Array.from(w)]:(w[0]<s[0][0]&&(s[0][0]=w[0]),w[0]>s[1][0]&&(s[1][0]=w[0]),w[1]<s[0][1]&&(s[0][1]=w[1]),w[1]>s[1][1]&&(s[1][1]=w[1])),b.length===0?b=[Array.from(w),Array.from(w)]:(w[0]<b[0][0]&&(b[0][0]=w[0]),w[0]>b[1][0]&&(b[1][0]=w[0]),w[1]<b[0][1]&&(b[0][1]=w[1]),w[1]>b[1][1]&&(b[1][1]=w[1]))}),b}),f=(s[1][0]-s[0][0])/i,h=(s[1][1]-s[0][1])/i,u=a.reduce((g,b,w)=>{const M=Et(b[0][0],s[0][0],f,i),_=Et(b[1][0],s[0][0],f,i),v=Et(b[0][1],s[0][1],h,i),T=Et(b[1][1],s[0][1],h,i);for(let I=M;I<=_;I++){g[I]||(g[I]=[]);for(let N=v;N<=T;N++)g[I][N]||(g[I][N]=[]),g[I][N].push(w)}return g},[]),c=n.features.map(g=>{let b=[];return Me(g)[0].map(w=>{r.length===0?r=[Array.from(w),Array.from(w)]:(w[0]<r[0][0]&&(r[0][0]=w[0]),w[0]>r[1][0]&&(r[1][0]=w[0]),w[1]<r[0][1]&&(r[0][1]=w[1]),w[1]>r[1][1]&&(r[1][1]=w[1])),b.length===0?b=[Array.from(w),Array.from(w)]:(w[0]<b[0][0]&&(b[0][0]=w[0]),w[0]>b[1][0]&&(b[1][0]=w[0]),w[1]<b[0][1]&&(b[0][1]=w[1]),w[1]>b[1][1]&&(b[1][1]=w[1]))}),b}),l=(r[1][0]-r[0][0])/i,p=(r[1][1]-r[0][1])/i,y=c.reduce((g,b,w)=>{const M=Et(b[0][0],r[0][0],l,i),_=Et(b[1][0],r[0][0],l,i),v=Et(b[0][1],r[0][1],p,i),T=Et(b[1][1],r[0][1],p,i);for(let I=M;I<=_;I++){g[I]||(g[I]=[]);for(let N=v;N<=T;N++)g[I][N]||(g[I][N]=[]),g[I][N].push(w)}return g},[]);this.indexedTins={forw:{gridNum:i,xOrigin:s[0][0],yOrigin:s[0][1],xUnit:f,yUnit:h,gridCache:u},bakw:{gridNum:i,xOrigin:r[0][0],yOrigin:r[0][1],xUnit:l,yUnit:p,gridCache:y}}}transform(t,e,n){if(e&&this.strict_status==_t.STATUS_ERROR)throw'Backward transform is not allowed if strict_status == "strict_error"';this.yaxisMode==_t.YAXIS_FOLLOW&&e&&(t=[t[0],-1*t[1]]);const i=Xt(t);if(this.bounds&&!e&&!n&&!pe(i,this.boundsPolygon))return!1;const s=e?this.tins.bakw:this.tins.forw,r=e?this.indexedTins.bakw:this.indexedTins.forw,a=e?this.vertices_params.bakw:this.vertices_params.forw,f=e?this.centroid.bakw:this.centroid.forw,h=e?this.pointsWeightBuffer.bakw:this.pointsWeightBuffer.forw;let u,c;this.stateFull&&(this.stateBackward==e?u=this.stateTriangle:(this.stateBackward=e,this.stateTriangle=void 0),c=p=>{this.stateTriangle=p});let l=re(i,s,r,a,f,h,u,c);if(this.bounds&&e&&!n){const p=Xt(l);if(!pe(p,this.boundsPolygon))return!1}else this.yaxisMode==_t.YAXIS_FOLLOW&&!e&&(l=[l[0],-1*l[1]]);return l}};st(xt,"VERTEX_PLAIN","plain"),st(xt,"VERTEX_BIRDEYE","birdeye"),st(xt,"MODE_STRICT","strict"),st(xt,"MODE_AUTO","auto"),st(xt,"MODE_LOOSE","loose"),st(xt,"STATUS_STRICT","strict"),st(xt,"STATUS_ERROR","strict_error"),st(xt,"STATUS_LOOSE","loose"),st(xt,"YAXIS_FOLLOW","follow"),st(xt,"YAXIS_INVERT","invert");let xn=xt;const gt=11102230246251565e-32,$=134217729,Ve=(3+8*gt)*gt;function ht(o,t,e,n,i){let s,r,a,f,h=t[0],u=n[0],c=0,l=0;u>h==u>-h?(s=h,h=t[++c]):(s=u,u=n[++l]);let p=0;if(c<o&&l<e)for(u>h==u>-h?(r=h+s,a=s-(r-h),h=t[++c]):(r=u+s,a=s-(r-u),u=n[++l]),s=r,a!==0&&(i[p++]=a);c<o&&l<e;)u>h==u>-h?(r=s+h,f=r-s,a=s-(r-f)+(h-f),h=t[++c]):(r=s+u,f=r-s,a=s-(r-f)+(u-f),u=n[++l]),s=r,a!==0&&(i[p++]=a);for(;c<o;)r=s+h,f=r-s,a=s-(r-f)+(h-f),h=t[++c],s=r,a!==0&&(i[p++]=a);for(;l<e;)r=s+u,f=r-s,a=s-(r-f)+(u-f),u=n[++l],s=r,a!==0&&(i[p++]=a);return(s!==0||p===0)&&(i[p++]=s),p}function kt(o,t,e,n,i,s,r,a){return ht(ht(o,t,e,n,r),r,i,s,a)}function S(o,t,e,n){let i,s,r,a,f,h,u,c,l,p,y;u=$*e,p=u-(u-e),y=e-p;let g=t[0];i=g*e,u=$*g,c=u-(u-g),l=g-c,r=l*y-(i-c*p-l*p-c*y);let b=0;r!==0&&(n[b++]=r);for(let w=1;w<o;w++)g=t[w],a=g*e,u=$*g,c=u-(u-g),l=g-c,f=l*y-(a-c*p-l*p-c*y),s=i+f,h=s-i,r=i-(s-h)+(f-h),r!==0&&(n[b++]=r),i=a+s,r=s-(i-a),r!==0&&(n[b++]=r);return(i!==0||b===0)&&(n[b++]=i),b}function Ce(o,t){let e=t[0];for(let n=1;n<o;n++)e+=t[n];return e}function H(o){return new Float64Array(o)}const _n=(3+16*gt)*gt,Sn=(2+12*gt)*gt,Mn=(9+64*gt)*gt*gt,Ct=H(4),Oe=H(8),Te=H(12),Ie=H(16),wt=H(4);function An(o,t,e,n,i,s,r){let a,f,h,u,c,l,p,y,g,b,w,M,_,v,T,I,N,V;const W=o-i,G=e-i,tt=t-s,z=n-s;v=W*z,l=$*W,p=l-(l-W),y=W-p,l=$*z,g=l-(l-z),b=z-g,T=y*b-(v-p*g-y*g-p*b),I=tt*G,l=$*tt,p=l-(l-tt),y=tt-p,l=$*G,g=l-(l-G),b=G-g,N=y*b-(I-p*g-y*g-p*b),w=T-N,c=T-w,Ct[0]=T-(w+c)+(c-N),M=v+w,c=M-v,_=v-(M-c)+(w-c),w=_-I,c=_-w,Ct[1]=_-(w+c)+(c-I),V=M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]=_-(w+c)+(c-I),V=M+w,c=V-M,wt[2]=M-(V-c)+(w-c),wt[3]=V;const A=ht(x,Te,4,wt,Ie);return Ie[A-1]}function qt(o,t,e,n,i,s){const r=(t-s)*(e-i),a=(o-i)*(n-s),f=r-a,h=Math.abs(r+a);return Math.abs(f)>=_n*h?f:-An(o,t,e,n,i,s,h)}const En=(10+96*gt)*gt,vn=(4+48*gt)*gt,On=(44+576*gt)*gt*gt,It=H(4),Pt=H(4),$t=H(4),St=H(4),Mt=H(4),At=H(4),mt=H(4),bt=H(4),ce=H(8),he=H(8),fe=H(8),ue=H(8),le=H(8),de=H(8),te=H(8),ee=H(8),ne=H(8),Bt=H(4),Dt=H(4),Ft=H(4),U=H(8),L=H(16),et=H(16),nt=H(16),Z=H(32),Rt=H(32),at=H(48),yt=H(64);let Wt=H(1152),ge=H(1152);function ct(o,t,e){o=ht(o,Wt,t,e,ge);const n=Wt;return Wt=ge,ge=n,o}function Tn(o,t,e,n,i,s,r,a,f){let h,u,c,l,p,y,g,b,w,M,_,v,T,I,N,V,W,G,tt,z,it,d,m,x,A,E,R,k,O,B,P,D,F,C,j;const X=o-r,q=e-r,Y=i-r,K=t-a,J=n-a,Q=s-a;P=q*Q,m=$*q,x=m-(m-q),A=q-x,m=$*Q,E=m-(m-Q),R=Q-E,D=A*R-(P-x*E-A*E-x*R),F=Y*J,m=$*Y,x=m-(m-Y),A=Y-x,m=$*J,E=m-(m-J),R=J-E,C=A*R-(F-x*E-A*E-x*R),k=D-C,d=D-k,It[0]=D-(k+d)+(d-C),O=P+k,d=O-P,B=P-(O-d)+(k-d),k=B-F,d=B-k,It[1]=B-(k+d)+(d-F),j=O+k,d=j-O,It[2]=O-(j-d)+(k-d),It[3]=j,P=Y*K,m=$*Y,x=m-(m-Y),A=Y-x,m=$*K,E=m-(m-K),R=K-E,D=A*R-(P-x*E-A*E-x*R),F=X*Q,m=$*X,x=m-(m-X),A=X-x,m=$*Q,E=m-(m-Q),R=Q-E,C=A*R-(F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t)}}return Wt[h-1]}function In(o,t,e,n,i,s,r,a){const f=o-r,h=e-r,u=i-r,c=t-a,l=n-a,p=s-a,y=h*p,g=u*l,b=f*f+c*c,w=u*c,M=f*p,_=h*h+l*l,v=f*l,T=h*c,I=u*u+p*p,N=b*(y-g)+_*(w-M)+I*(v-T),V=(Math.abs(y)+Math.abs(g))*b+(Math.abs(w)+Math.abs(M))*_+(Math.abs(v)+Math.abs(T))*I,W=En*V;return N>W||-N>W?N:Tn(o,t,e,n,i,s,r,a,V)}class Pn{constructor(t,e){this.W=t,this.bs=e}add(t){const e=this.W,n=t/e|0,i=t%e;return this.bs[n]|=1<<i,this}delete(t){const e=this.W,n=t/e|0,i=t%e;return this.bs[n]&=~(1<<i),this}set(t,e){const n=this.W,i=t/n|0,s=t%n,r=1<<s;return this.bs[i]^=(-e^this.bs[i])&r,e}has(t){const e=this.W,n=t/e|0,i=t%e;return!!(this.bs[n]&1<<i)}forEach(t){const e=this.W,n=this.bs,i=n.length;for(let s=0;s<i;s++){let r=0;for(;n[s]&&r<e;)n[s]&1<<r&&t(s*e+r),r++}return this}}class Pe extends Pn{constructor(t){const e=new Uint8Array(Math.ceil(t/8)).fill(0);super(8,e)}}function jt(o){return o%3===2?o-2:o+1}function vt(o){return o%3===0?o+2:o-1}function We(o,t,e,n,i,s,r,a){const f=qt(o,t,i,s,r,a),h=qt(e,n,i,s,r,a);if(f>0&&h>0||f<0&&h<0)return!1;const u=qt(i,s,o,t,e,n),c=qt(r,a,o,t,e,n);return u>0&&c>0||u<0&&c<0?!1:f===0&&h===0&&u===0&&c===0?!(Math.max(i,r)<Math.min(o,e)||Math.max(o,e)<Math.min(i,r)||Math.max(s,a)<Math.min(t,n)||Math.max(t,n)<Math.min(s,a)):!0}class $n{constructor(t){this.del=t}}const ze=class extends $n{constructor(t,e){if(!t||typeof t!="object"||!t.triangles||!t.halfedges||!t.coords)throw new Error("Expected an object with Delaunator output");if(t.triangles.length%3||t.halfedges.length!==t.triangles.length||t.coords.length%2)throw new Error("Delaunator output appears inconsistent");if(t.triangles.length<3)throw new Error("No edges in triangulation");super(t);const n=2**32-1,i=t.coords.length>>1,s=t.triangles.length;this.vertMap=new Uint32Array(i).fill(n),this.flips=new Pe(s),this.consd=new Pe(s);for(let r=0;r<s;r++){const a=t.triangles[r];this.vertMap[a]===n&&this.updateVert(r)}e&&this.constrainAll(e)}constrainOne(t,e){const{triangles:n,halfedges:i}=this.del,s=this.vertMap[t];let r=s;do{const h=n[r],u=jt(r);if(h===e)return this.protect(r);const c=vt(r),l=n[c];if(l===e)return this.protect(u),u;if(this.intersectSegments(t,e,l,h)){r=c;break}r=i[u]}while(r!==-1&&r!==s);let a=r,f=-1;for(;r!==-1;){const h=i[r],u=vt(r),c=vt(h),l=jt(h);if(h===-1)throw new Error("Constraining edge exited the hull");if(this.consd.has(r))throw new Error("Edge intersects already constrained edge");if(this.isCollinear(t,e,n[r])||this.isCollinear(t,e,n[h]))throw new Error("Constraining edge intersects point");if(!this.intersectSegments(n[r],n[h],n[u],n[c])){if(f===-1&&(f=r),n[c]===e){if(r===f)throw new Error("Infinite loop: non-convex quadrilateral");r=f,f=-1;continue}if(this.intersectSegments(t,e,n[c],n[h]))r=c;else if(this.intersectSegments(t,e,n[l],n[c]))r=l;else if(f===r)throw new Error("Infinite loop: no further intersect after non-convex");continue}if(this.flipDiagonal(r),this.intersectSegments(t,e,n[u],n[c])&&(f===-1&&(f=u),f===u))throw new Error("Infinite loop: flipped diagonal still intersects");n[c]===e?(a=c,r=f,f=-1):this.intersectSegments(t,e,n[l],n[c])&&(r=l)}return this.protect(a),this.delaunify(!0),this.findEdge(t,e)}delaunify(t=!1){const{halfedges:e}=this.del,n=this.flips,i=this.consd,s=e.length;do{var r=0;for(let a=0;a<s;a++){if(i.has(a))continue;n.delete(a);const f=e[a];f!==-1&&(n.delete(f),this.isDelaunay(a)||(this.flipDiagonal(a),r++))}}while(t&&r>0);return this}constrainAll(t){const e=t.length;for(let n=0;n<e;n++){const i=t[n];this.constrainOne(i[0],i[1])}return this}isConstrained(t){return this.consd.has(t)}findEdge(t,e){const n=this.vertMap[e],{triangles:i,halfedges:s}=this.del;let r=n,a=-1;do{if(i[r]===t)return r;a=jt(r),r=s[a]}while(r!==-1&&r!==n);return i[jt(a)]===t?-a:1/0}protect(t){const e=this.del.halfedges[t],n=this.flips,i=this.consd;return n.delete(t),i.add(t),e!==-1?(n.delete(e),i.add(e),e):-t}markFlip(t){const e=this.del.halfedges,n=this.flips;if(this.consd.has(t))return!1;const i=e[t];return i!==-1&&(n.add(t),n.add(i)),!0}flipDiagonal(t){const{triangles:e,halfedges:n}=this.del,i=this.flips,s=this.consd,r=n[t],a=vt(t),f=jt(t),h=vt(r),u=jt(r),c=n[a],l=n[h];if(s.has(t))throw new Error("Trying to flip a constrained edge");return e[t]=e[h],n[t]=l,i.set(t,i.has(h))||s.set(t,s.has(h)),l!==-1&&(n[l]=t),n[a]=h,e[r]=e[a],n[r]=c,i.set(r,i.has(a))||s.set(r,s.has(a)),c!==-1&&(n[c]=r),n[h]=a,this.markFlip(t),this.markFlip(f),this.markFlip(r),this.markFlip(u),i.add(a),s.delete(a),i.add(h),s.delete(h),this.updateVert(t),this.updateVert(f),this.updateVert(r),this.updateVert(u),a}isCollinear(t,e,n){const i=this.del.coords;return qt(i[t*2],i[t*2+1],i[e*2],i[e*2+1],i[n*2],i[n*2+1])===0}inCircle(t,e,n,i){const s=this.del.coords;return In(s[t*2],s[t*2+1],s[e*2],s[e*2+1],s[n*2],s[n*2+1],s[i*2],s[i*2+1])<0}isDelaunay(t){const{triangles:e,halfedges:n}=this.del,i=n[t];if(i===-1)return!0;const s=e[vt(t)],r=e[t],a=e[jt(t)],f=e[vt(i)];return!this.inCircle(s,r,a,f)}updateVert(t){const{triangles:e,halfedges:n}=this.del,i=this.vertMap,s=e[t];let r=vt(t),a=n[r];for(;a!==-1&&a!==t;)r=vt(a),a=n[r];return i[s]=r,r}intersectSegments(t,e,n,i){const s=this.del.coords;return t===n||t===i||e===n||e===i?!1:We(s[t*2],s[t*2+1],s[e*2],s[e*2+1],s[n*2],s[n*2+1],s[i*2],s[i*2+1])}};ze.intersectSegments=We;let Rn=ze;function Yt(o,t,e){if(t||(t=[]),typeof o!="object"||o.type!=="FeatureCollection")throw"Argument points must be FeatureCollection";if(!Array.isArray(t))throw"Argument points must be Array of Array";const n=o.features.map(f=>f.geometry.coordinates),i=en.from(n);let s;const r=[];i.triangles.length!==0&&t.length!==0&&(s=new Rn(i),s.constrainAll(t));for(let f=0;f<i.triangles.length;f+=3)r.push([i.triangles[f],i.triangles[f+1],i.triangles[f+2]]);const a=["a","b","c"];return ft.featureCollection(r.map(f=>{const h={},u=f.map((c,l)=>{const p=o.features[c],y=p.geometry.coordinates,g=[y[0],y[1]];return y.length===3?g[2]=y[2]:h[a[l]]=p.properties[e],g});return u[3]=u[0],ft.polygon([u],h)}))}function Xe(o){const e=new Nn(o).findSegmentIntersections();return Je(e).reduce((n,i,s,r)=>Array.isArray(n)||(n||(n={}),n[`${i.x}:${i.y}`]=i,s!=r.length-1)?n:Object.keys(n).map(a=>ft.point([n[a].x,n[a].y])),{})}class Nn{constructor(t){rt(this,"_xx");rt(this,"_yy");rt(this,"_ii");rt(this,"_nn");rt(this,"_zz");rt(this,"_zlimit",0);rt(this,"_bb");rt(this,"_allBounds");rt(this,"_arcIter");rt(this,"_filteredArcIter");rt(this,"buf");this.initArcs(t)}initArcs(t){const e=[],n=[],i=t.map(s=>{const r=s?s.length:0;for(let a=0;a<r;a++)e.push(s[a][0]),n.push(s[a][1]);return r});this.initXYData(i,e,n)}initXYData(t,e,n){const i=t.length;this._xx=new Float64Array(e),this._yy=new Float64Array(n),this._nn=new Uint32Array(t),this._zz=null,this._zlimit=0,this._filteredArcIter=null,this._ii=new Uint32Array(i);let s=0;for(let r=0;r<i;r++)this._ii[r]=s,s+=t[r];(s!=this._xx.length||this._xx.length!=this._yy.length)&&me("ArcCollection#initXYData() Counting error"),this.initBounds(),this._arcIter=new ts(this._xx,this._yy)}initBounds(){const t=this.calcArcBounds_(this._xx,this._yy,this._nn);this._bb=t.bb,this._allBounds=t.bounds}calcArcBounds_(t,e,n){const i=n.length,s=new Float64Array(i*4),r=new oe;let a=0,f,h,u;for(let c=0;c<i;c++)f=n[c],f>0&&(h=c*4,u=es(t,e,a,f),s[h++]=u[0],s[h++]=u[1],s[h++]=u[2],s[h]=u[3],a+=f,r.mergeBounds(u));return{bb:s,bounds:r}}getBounds(){return this._allBounds.clone()}forEachSegment(t){let e=0;for(let n=0,i=this.size();n<i;n++)e+=this.forEachArcSegment(n,t);return e}size(){return this._ii&&this._ii.length||0}forEachArcSegment(t,e){const n=t>=0,i=n?t:~t,s=this.getRetainedInterval(),r=this._nn[i],a=n?1:-1;let f=n?this._ii[i]:this._ii[i]+r-1,h=f,u=0;for(let c=1;c<r;c++)h+=a,(s===0||this._zz[h]>=s)&&(e(f,h,this._xx,this._yy),f=h,u++);return u}getRetainedInterval(){return this._zlimit}getVertexData(){return{xx:this._xx,yy:this._yy,zz:this._zz,bb:this._bb,nn:this._nn,ii:this._ii}}getUint32Array(t){const e=t*4;return(!this.buf||this.buf.byteLength<e)&&(this.buf=new ArrayBuffer(e)),new Uint32Array(this.buf,0,t)}getAvgSegment2(){let t=0,e=0;const n=this.forEachSegment((i,s,r,a)=>{t+=Math.abs(r[i]-r[s]),e+=Math.abs(a[i]-a[s])});return[t/n||0,e/n||0]}calcSegmentIntersectionStripeCount(){const t=this.getBounds().height(),e=this.getAvgSegment2()[1];let n=1;return e>0&&t>0&&(n=Math.ceil(t/e/20)),n||1}findSegmentIntersections(){const t=this.getBounds(),e=t.ymin,n=t.ymax-e,i=this.calcSegmentIntersectionStripeCount(),s=new Uint32Array(i),r=i>1?g=>Math.floor((i-1)*(g-e)/n):()=>0;let a,f;this.forEachSegment((g,b,w,M)=>{let _=r(M[g]);const v=r(M[b]);for(;s[_]=s[_]+2,_!=v;)_+=v>_?1:-1});const h=this.getUint32Array(Dn(s));let u=0;const c=[];Fn(s,g=>{const b=u;u+=g,c.push(h.subarray(b,u))}),jn(s,0),this.forEachSegment((g,b,w,M)=>{let _=r(M[g]);const v=r(M[b]);let T,I;for(;T=s[_],s[_]=T+2,I=c[_],I[T]=g,I[T+1]=b,_!=v;)_+=v>_?1:-1});const l=this.getVertexData(),p=[];let y;for(a=0;a<i;a++)for(y=Ln(c[a],l.xx,l.yy),f=0;f<y.length;f++)p.push(y[f]);return Je(p)}}function me(...o){const t=o.join(" ");throw new Error(t)}function be(o){return o?Bn(o)?!0:Un(o)?!1:o.length===0?!0:o.length>0:!1}function Un(o){return o!=null&&o.toString===String.prototype.toString}function Bn(o){return Array.isArray(o)}function Dn(o,t){be(o)||me("utils.sum() expects an array, received:",o);let e=0,n;for(let i=0,s=o.length;i<s;i++)n=o[i],n&&(e+=n);return e}function Fn(o,t,e){if(!be(o))throw new Error(`#forEach() takes an array-like argument. ${o}`);for(let n=0,i=o.length;n<i;n++)t.call(e,o[n],n)}function jn(o,t){for(let e=0,n=o.length;e<n;e++)o[e]=t;return o}function Ln(o,t,e){const n=o.length-2,i=[];let s,r,a,f,h,u,c,l,p,y,g,b,w,M,_,v,T;for(Gn(t,o),v=0;v<n;){for(s=o[v],r=o[v+1],h=t[s],u=t[r],p=e[s],y=e[r],T=v;T<n&&(T+=2,a=o[T],c=t[a],!(u<c));){if(g=e[a],f=o[T+1],l=t[f],b=e[f],p>=g){if(p>b&&y>g&&y>b)continue}else if(p<b&&y<g&&y<b)continue;s==a||s==f||r==a||r==f||(w=Vn(h,p,u,y,c,g,l,b),w&&(M=[s,r],_=[a,f],i.push(Re(w,M,_,t,e)),w.length==4&&i.push(Re(w.slice(2),M,_,t,e))))}v+=2}return i}function Vn(o,t,e,n,i,s,r,a){const f=Cn(o,t,e,n,i,s,r,a);let h=null;return f&&(h=Wn(o,t,e,n,i,s,r,a),h?Hn(o,t,e,n,i,s,r,a)&&(h=null):h=Jn(o,t,e,n,i,s,r,a)),h}function Cn(o,t,e,n,i,s,r,a){return Jt(o,t,e,n,i,s)*Jt(o,t,e,n,r,a)<=0&&Jt(i,s,r,a,o,t)*Jt(i,s,r,a,e,n)<=0}function Jt(o,t,e,n,i,s){return qe(o-i,t-s,e-i,n-s)}function qe(o,t,e,n){return o*n-t*e}function Wn(o,t,e,n,i,s,r,a){let f=se(o,t,e,n,i,s,r,a),h;return f&&(h=Xn(f[0],f[1],o,t,e,n,i,s,r,a),h==1?f=se(e,n,o,t,i,s,r,a):h==2?f=se(i,s,r,a,o,t,e,n):h==3&&(f=se(r,a,i,s,o,t,e,n))),f&&Yn(f,o,t,e,n,i,s,r,a),f}function se(o,t,e,n,i,s,r,a){const f=qe(e-o,n-t,r-i,a-s),h=1e-18;let u;if(f===0)return null;const c=Jt(i,s,r,a,o,t)/f;return f<=h&&f>=-h?u=zn(o,t,e,n,i,s,r,a):u=[o+c*(e-o),t+c*(n-t)],u}function zn(o,t,e,n,i,s,r,a){let f=null;return!Ot(o,i,r)&&!Ot(t,s,a)?f=[o,t]:!Ot(e,i,r)&&!Ot(n,s,a)?f=[e,n]:!Ot(i,o,e)&&!Ot(s,t,n)?f=[i,s]:!Ot(r,o,e)&&!Ot(a,t,n)&&(f=[r,a]),f}function Ot(o,t,e){let n;return t<e?n=o<t||o>e:t>e?n=o>t||o<e:n=o!=t,n}function Xn(o,t,...e){let n=-1,i=1/0,s;for(let r=0,a=0,f=e.length;a<f;r++,a+=2)s=qn(o,t,e[a],e[a+1]),s<i&&(i=s,n=r);return n}function qn(o,t,e,n){const i=o-e,s=t-n;return i*i+s*s}function Yn(o,t,e,n,i,s,r,a,f){let h=o[0],u=o[1];h=ie(h,t,n),h=ie(h,s,a),u=ie(u,e,i),u=ie(u,r,f),o[0]=h,o[1]=u}function ie(o,t,e){let n;return Ot(o,t,e)&&(n=Math.abs(o-t)<Math.abs(o-e)?t:e,o=n),o}function Jn(o,t,e,n,i,s,r,a){const f=Math.min(o,e,i,r),h=Math.max(o,e,i,r),u=Math.min(t,n,s,a),c=Math.max(t,n,s,a),l=c-u>h-f;let p=[];return(l?Nt(t,u,c):Nt(o,f,h))&&p.push(o,t),(l?Nt(n,u,c):Nt(e,f,h))&&p.push(e,n),(l?Nt(s,u,c):Nt(i,f,h))&&p.push(i,s),(l?Nt(a,u,c):Nt(r,f,h))&&p.push(r,a),(p.length!=2&&p.length!=4||p.length==4&&p[0]==p[2]&&p[1]==p[3])&&(p=null),p}function Hn(o,t,e,n,i,s,r,a){return o==i&&t==s||o==r&&t==a||e==i&&n==s||e==r&&n==a}function Nt(o,t,e){return o>t&&o<e}function Gn(o,t){Kn(o,t),Ye(o,t,0,t.length-2)}function Kn(o,t){for(let e=0,n=t.length;e<n;e+=2)o[t[e]]>o[t[e+1]]&&Qn(t,e,e+1)}function Qn(o,t,e){const n=o[t];o[t]=o[e],o[e]=n}function Ye(o,t,e,n){let i=e,s=n,r,a;for(;i<n;){for(r=o[t[e+n>>2<<1]];i<=s;){for(;o[t[i]]<r;)i+=2;for(;o[t[s]]>r;)s-=2;i<=s&&(a=t[i],t[i]=t[s],t[s]=a,a=t[i+1],t[i+1]=t[s+1],t[s+1]=a,i+=2,s-=2)}if(s-e<40?$e(o,t,e,s):Ye(o,t,e,s),n-i<40){$e(o,t,i,n);return}e=i,s=n}}function $e(o,t,e,n){let i,s;for(let r=e+2;r<=n;r+=2){i=t[r],s=t[r+1];let a;for(a=r-2;a>=e&&o[i]<o[t[a]];a-=2)t[a+2]=t[a],t[a+3]=t[a+1];t[a+2]=i,t[a+3]=s}}function Re(o,t,e,n,i){const s=o[0],r=o[1];t=Ne(s,r,t[0],t[1],n,i),e=Ne(s,r,e[0],e[1],n,i);const a=t[0]<e[0]?t:e,f=a==t?e:t;return{x:s,y:r,a,b:f}}function Ne(o,t,e,n,i,s){let r=e<n?e:n,a=r===e?n:e;return i[r]==o&&s[r]==t?a=r:i[a]==o&&s[a]==t&&(r=a),[r,a]}function Je(o){const t={};return o.filter(e=>{const n=Zn(e);return n in t?!1:(t[n]=!0,!0)})}function Zn(o){return`${o.a.join(",")};${o.b.join(",")}`}class ts{constructor(t,e){rt(this,"_i",0);rt(this,"_n",0);rt(this,"_inc",1);rt(this,"_xx");rt(this,"_yy");rt(this,"i",0);rt(this,"x",0);rt(this,"y",0);this._xx=t,this._yy=e}}function es(o,t,e,n){let i=e|0;const s=isNaN(n)?o.length-i:n+i;let r,a,f,h,u,c;if(s>0)f=u=o[i],h=c=t[i];else return[void 0,void 0,void 0,void 0];for(i++;i<s;i++)r=o[i],a=t[i],r<f&&(f=r),r>u&&(u=r),a<h&&(h=a),a>c&&(c=a);return[f,h,u,c]}class oe{constructor(...t){rt(this,"xmin");rt(this,"ymin");rt(this,"xmax");rt(this,"ymax");t.length>0&&this.setBounds(t)}cloneBounds(){return this.clone()}clone(){return new oe(this.xmin,this.ymin,this.xmax,this.ymax)}width(){return this.xmax-this.xmin||0}height(){return this.ymax-this.ymin||0}setBounds(t,e,n,i){return arguments.length==1&&(be(t)?(e=t[1],n=t[2],i=t[3],t=t[0]):(e=t.ymin,n=t.xmax,i=t.ymax,t=t.xmin)),this.xmin=t,this.ymin=e,this.xmax=n,this.ymax=i,(t>n||e>i)&&this.update(),this}update(){let t;this.xmin>this.xmax&&(t=this.xmin,this.xmin=this.xmax,this.xmax=t),this.ymin>this.ymax&&(t=this.ymin,this.ymin=this.ymax,this.ymax=t)}mergeBounds(t,...e){let n,i,s,r;return t instanceof oe?(n=t.xmin,i=t.ymin,s=t.xmax,r=t.ymax):e.length==3?(n=t,i=e[0],s=e[1],r=e[2]):t.length==4?(n=t[0],i=t[1],s=t[2],r=t[3]):me("Bounds#mergeBounds() invalid argument:",t),this.xmin===void 0?this.setBounds(n,i,s,r):(n<this.xmin&&(this.xmin=n),i<this.ymin&&(this.ymin=i),s>this.xmax&&(this.xmax=s),r>this.ymax&&(this.ymax=r)),this}}function Ue(o){const t=["a","b","c"].map(e=>o.properties[e].index);return[[0,1],[0,2],[1,2],[0,1,2]].map(e=>e.map(n=>t[n]).sort().join("-")).sort()}function He(o,t,e){const n=Ue(t.forw),i=Ue(t.bakw);if(JSON.stringify(n)!=JSON.stringify(i))throw`${JSON.stringify(t,null,2)}
2
+ ${JSON.stringify(n)}
3
+ ${JSON.stringify(i)}`;for(let s=0;s<n.length;s++){const r=n[s];o[r]||(o[r]=[]),o[r].push(t)}e&&(e.forw.features.push(t.forw),e.bakw.features.push(t.bakw))}function Ht(o,t,e){return ft.point(o,{target:{geom:t,index:e}})}function Gt(o){return ft.point(o.properties.target.geom,{target:{geom:o.geometry.coordinates,index:o.properties.target.index}})}function we(o,t){const e=t.geometry.coordinates;return[0,1,2,3].map(n=>{const i=(n+1)%4,s=o[n],r=o[i],a=s.geometry.coordinates,f=Math.atan2(a[0]-e[0],a[1]-e[1]),h=[t,s,r,t].map(l=>l.geometry.coordinates),u={a:{geom:t.properties.target.geom,index:t.properties.target.index},b:{geom:s.properties.target.geom,index:s.properties.target.index},c:{geom:r.properties.target.geom,index:r.properties.target.index}},c=ft.featureCollection([ft.polygon([h],u)]);return[f,c]}).reduce((n,i)=>(n[0].push(i[0]),n[1].push(i[1]),n),[[],[]])}class ot extends xn{constructor(e={}){super();rt(this,"importance");rt(this,"priority");rt(this,"pointsSet");e.bounds?this.setBounds(e.bounds):(this.setWh(e.wh),this.vertexMode=e.vertexMode||ot.VERTEX_PLAIN),this.strictMode=e.strictMode||ot.MODE_AUTO,this.yaxisMode=e.yaxisMode||ot.YAXIS_INVERT,this.importance=e.importance||0,this.priority=e.priority||0,this.stateFull=e.stateFull||!1,e.points&&this.setPoints(e.points),e.edges&&this.setEdges(e.edges)}getFormatVersion(){return Kt}setPoints(e){this.yaxisMode===ot.YAXIS_FOLLOW&&(e=e.map(n=>[n[0],[n[1][0],-1*n[1][1]]])),this.points=e,this.tins=void 0,this.indexedTins=void 0}setEdges(e=[]){this.edges=je(e),this.edgeNodes=void 0,this.tins=void 0,this.indexedTins=void 0}setBounds(e){this.bounds=e;let n=e[0][0],i=n,s=e[0][1],r=s;const a=[e[0]];for(let f=1;f<e.length;f++){const h=e[f];h[0]<n&&(n=h[0]),h[0]>i&&(i=h[0]),h[1]<s&&(s=h[1]),h[1]>r&&(r=h[1]),a.push(h)}a.push(e[0]),this.boundsPolygon=ft.polygon([a]),this.xy=[n,s],this.wh=[i-n,r-s],this.vertexMode=ot.VERTEX_PLAIN,this.tins=void 0,this.indexedTins=void 0}getCompiled(){var i;const e={};e.version=Kt,e.points=this.points,e.weight_buffer=this.pointsWeightBuffer,e.centroid_point=[this.centroid.forw.geometry.coordinates,this.centroid.forw.properties.target.geom],e.vertices_params=[this.vertices_params.forw[0],this.vertices_params.bakw[0]],e.vertices_points=[];const n=this.vertices_params.forw[1];return n&&[0,1,2,3].map(s=>{const r=n[s].features[0],a=r.geometry.coordinates[0][1],f=r.properties.b.geom;e.vertices_points[s]=[a,f]}),e.strict_status=this.strict_status,e.tins_points=[[]],this.tins.forw.features.map(s=>{e.tins_points[0].push(["a","b","c"].map(r=>s.properties[r].index))}),this.strict_status===ot.STATUS_LOOSE?(e.tins_points[1]=[],this.tins.bakw.features.map(s=>{e.tins_points[1].push(["a","b","c"].map(r=>s.properties[r].index))})):this.strict_status===ot.STATUS_ERROR&&((i=this.kinks)!=null&&i.bakw)&&(e.kinks_points=this.kinks.bakw.features.map(s=>s.geometry.coordinates)),e.yaxisMode=this.yaxisMode,e.vertexMode=this.vertexMode,e.strictMode=this.strictMode,this.bounds?(e.bounds=this.bounds,e.boundsPolygon=this.boundsPolygon,e.xy=this.xy,e.wh=this.wh):e.wh=this.wh,e.edges=this.edges,e.edgeNodes=this.edgeNodes,e}setWh(e){this.wh=e||[100,100],this.xy=[0,0],this.bounds=void 0,this.boundsPolygon=void 0,this.tins=void 0,this.indexedTins=void 0}setVertexMode(e){this.vertexMode=e,this.tins=void 0,this.indexedTins=void 0}setStrictMode(e){this.strictMode=e,this.tins=void 0,this.indexedTins=void 0}calcurateStrictTin(){const e=this.tins.forw.features.map(s=>mn(s));this.tins.bakw=ft.featureCollection(e);const n={};this.tins.forw.features.forEach((s,r)=>{const a=this.tins.bakw.features[r];He(n,{forw:s,bakw:a})});const i=["forw","bakw"].map(s=>{const r=this.tins[s].features.map(a=>a.geometry.coordinates[0]);return Xe(r)});i[0].length===0&&i[1].length===0?(this.strict_status=ot.STATUS_STRICT,delete this.kinks):(this.strict_status=ot.STATUS_ERROR,this.kinks={},i[0].length>0&&(this.kinks.forw=ft.featureCollection(i[0])),i[1].length>0&&(this.kinks.bakw=ft.featureCollection(i[1])))}generatePointsSet(){const e={forw:[],bakw:[]};for(let s=0;s<this.points.length;s++){const r=this.points[s][0],a=this.points[s][1],f=Ht(r,a,s);e.forw.push(f),e.bakw.push(Gt(f))}const n=[];let i=0;this.edgeNodes=[],this.edges||(this.edges=[]);for(let s=0;s<this.edges.length;s++){const r=this.edges[s][2],a=Object.assign([],this.edges[s][0]),f=Object.assign([],this.edges[s][1]);if(a.length===0&&f.length===0){n.push(r);continue}a.unshift(this.points[r[0]][0]),a.push(this.points[r[1]][0]),f.unshift(this.points[r[0]][1]),f.push(this.points[r[1]][1]);const h=[a,f].map(u=>{const c=u.map((p,y,g)=>{if(y===0)return 0;const b=g[y-1];return Math.sqrt(Math.pow(p[0]-b[0],2)+Math.pow(p[1]-b[1],2))}),l=c.reduce((p,y,g)=>g===0?[0]:(p.push(p[g-1]+y),p),[]);return l.map((p,y,g)=>{const b=p/g[g.length-1];return[u[y],c[y],l[y],b]})});h.map((u,c)=>{const l=h[c?0:1];return u.filter((p,y)=>!(y===0||y===u.length-1||p[4]==="handled")).map(p=>{const y=p[0],g=p[3],b=l.reduce((w,M,_,v)=>{if(w)return w;const T=v[_+1];if(M[3]===g)return M[4]="handled",[M];if(M[3]<g&&T&&T[3]>g)return[M,T]},void 0);if(b&&b.length===1)return c===0?[y,b[0][0],g]:[b[0][0],y,g];if(b&&b.length===2){const w=b[0],M=b[1],_=(g-w[3])/(M[3]-w[3]),v=[(M[0][0]-w[0][0])*_+w[0][0],(M[0][1]-w[0][1])*_+w[0][1]];return c===0?[y,v,g]:[v,y,g]}return[]})}).reduce((u,c)=>u.concat(c),[]).sort((u,c)=>u[2]<c[2]?-1:1).map((u,c,l)=>{this.edgeNodes[i]=[u[0],u[1]];const p=Ht(u[0],u[1],`e${i}`);i++,e.forw.push(p),e.bakw.push(Gt(p)),c===0?n.push([r[0],e.forw.length-1]):n.push([e.forw.length-2,e.forw.length-1]),c===l.length-1&&n.push([e.forw.length-1,r[1]])})}return{forw:e.forw,bakw:e.bakw,edges:n}}validateAndPrepareInputs(){const e=this.xy[0]-.05*this.wh[0],n=this.xy[0]+1.05*this.wh[0],i=this.xy[1]-.05*this.wh[1],s=this.xy[1]+1.05*this.wh[1];if(!this.points.reduce((f,h)=>f&&(this.bounds?Qe(h[0],this.boundsPolygon):h[0][0]>=e&&h[0][0]<=n&&h[0][1]>=i&&h[0][1]<=s),!0))throw"SOME POINTS OUTSIDE";let a=[];return this.wh&&(a=[[e,i],[n,i],[e,s],[n,s]]),{pointsSet:this.generatePointsSet(),bbox:a,minx:e,maxx:n,miny:i,maxy:s}}updateTin(){let e=this.strictMode;e!==ot.MODE_STRICT&&e!==ot.MODE_LOOSE&&(e=ot.MODE_AUTO);const{pointsSet:n,bbox:i,minx:s,maxx:r,miny:a,maxy:f}=this.validateAndPrepareInputs(),h={forw:ft.featureCollection(n.forw),bakw:ft.featureCollection(n.bakw)},u=Yt(h.forw,n.edges,"target"),c=Yt(h.bakw,n.edges,"target");if(u.features.length===0||c.features.length===0)throw"TOO LINEAR1";const l=Ze(h.forw),p=ye(h.forw);if(!p)throw"TOO LINEAR2";const y={},g=p.geometry.coordinates[0];let b;try{b=g.map(N=>({forw:N,bakw:re(ft.point(N),u)})),b.forEach(N=>{y[`${N.forw[0]}:${N.forw[1]}`]=N})}catch{throw"TOO LINEAR2"}const w=ye(h.bakw);if(!w)throw"TOO LINEAR2";const M=w.geometry.coordinates[0];try{b=M.map(N=>({bakw:N,forw:re(ft.point(N),c)})),b.forEach(N=>{y[`${N.forw[0]}:${N.forw[1]}`]=N})}catch{throw"TOO LINEAR2"}const _={forw:l.geometry.coordinates,bakw:re(l,u)},v=Ht(_.forw,_.bakw,"c");this.centroid={forw:v,bakw:Gt(v)};const T=this.vertexMode===ot.VERTEX_BIRDEYE?this.calculateBirdeyeVertices(y,_,i,s,r,a,f):this.calculatePlainVertices(y,_,i,s,r,a,f),I={forw:[],bakw:[]};for(let N=0;N<T.length;N++){const V=T[N].forw,W=T[N].bakw,G=Ht(V,W,`b${N}`),tt=Gt(G);n.forw.push(G),n.bakw.push(tt),I.forw.push(G),I.bakw.push(tt)}this.pointsSet={forw:ft.featureCollection(n.forw),bakw:ft.featureCollection(n.bakw),edges:[]},this.tins={forw:Ae(Yt(this.pointsSet.forw,n.edges,"target"))},(e===ot.MODE_STRICT||e===ot.MODE_AUTO)&&this.calcurateStrictTin(),(e===ot.MODE_LOOSE||e===ot.MODE_AUTO&&this.strict_status===ot.STATUS_ERROR)&&(this.tins.bakw=Ae(Yt(this.pointsSet.bakw,n.edges,"target")),delete this.kinks,this.strict_status=ot.STATUS_LOOSE),this.vertices_params={forw:we(I.forw,this.centroid.forw),bakw:we(I.bakw,this.centroid.bakw)},this.addIndexedTin(),this.calculatePointsWeight()}calculatePlainVertices(e,n,i,s,r,a,f){const h=Object.keys(e).reduce((y,g)=>{const b=e[g],w=b.forw,M=b.bakw,_={forw:[w[0]-n.forw[0],w[1]-n.forw[1]],bakw:[M[0]-n.bakw[0],M[1]-n.bakw[1]]},v=_.forw[0]===0?1/0:((_.forw[0]<0?s:r)-n.forw[0])/_.forw[0],T=_.forw[1]===0?1/0:((_.forw[1]<0?a:f)-n.forw[1])/_.forw[1];if(Math.abs(v)/Math.abs(T)<1.1){const I={forw:[_.forw[0]*v+n.forw[0],_.forw[1]*v+n.forw[1]],bakw:[_.bakw[0]*v+n.bakw[0],_.bakw[1]*v+n.bakw[1]]};_.forw[0]<0?y[3].push(I):y[1].push(I)}if(Math.abs(T)/Math.abs(v)<1.1){const I={forw:[_.forw[0]*T+n.forw[0],_.forw[1]*T+n.forw[1]],bakw:[_.bakw[0]*T+n.bakw[0],_.bakw[1]*T+n.bakw[1]]};_.forw[1]<0?y[0].push(I):y[2].push(I)}return y},[[],[],[],[]]);let c=Object.keys(e).reduce((y,g,b,w)=>{const M=e[g],_=M.forw,v=M.bakw,T={forw:[_[0]-n.forw[0],_[1]-n.forw[1]],bakw:[v[0]-n.bakw[0],n.bakw[1]-v[1]]};if(T.forw[0]===0||T.forw[1]===0)return y;let I=0;return T.forw[0]>0&&(I+=1),T.forw[1]>0&&(I+=2),y[I].push([T.forw,T.bakw]),b===w.length-1?y.map(N=>N.reduce((V,W,G,tt)=>{V||(V=[1/0,0,0]);let z=Math.sqrt(Math.pow(W[0][0],2)+Math.pow(W[0][1],2))/Math.sqrt(Math.pow(W[1][0],2)+Math.pow(W[1][1],2));z=z<V[0]?z:V[0];const it=Math.atan2(W[0][0],W[0][1])-Math.atan2(W[1][0],W[1][1]),d=V[1]+Math.cos(it),m=V[2]+Math.sin(it);return G===tt.length-1?[z,Math.atan2(m,d)]:[z,d,m]},null)):y},[[],[],[],[]]);c.length===1&&(c=[c[0],c[0],c[0],c[0]]);const l=c.map((y,g)=>{const b=i[g],w=[b[0]-n.forw[0],b[1]-n.forw[1]],_=Math.sqrt(Math.pow(w[0],2)+Math.pow(w[1],2))/y[0],v=Math.atan2(w[0],w[1])-y[1],T=[n.bakw[0]+_*Math.sin(v),n.bakw[1]-_*Math.cos(v)];return{forw:b,bakw:T}}),p=l[2];return l[2]=l[3],l[3]=p,this.checkAndAdjustVertices(l,h,n),l}calculateBirdeyeVertices(e,n,i,s,r,a,f){return this.calculatePlainVertices(e,n,i,s,r,a,f)}checkAndAdjustVertices(e,n,i){const s=[1,1,1,1];for(let r=0;r<4;r++){const a=(r+1)%4,f=ft.lineString([e[r].bakw,e[a].bakw]);n[r].map(h=>{const u=ft.lineString([i.bakw,h.bakw]),c=tn(f,u);if(c.features.length>0&&c.features[0].geometry){const l=c.features[0],p=Math.sqrt(Math.pow(h.bakw[0]-i.bakw[0],2)+Math.pow(h.bakw[1]-i.bakw[1],2)),y=Math.sqrt(Math.pow(l.geometry.coordinates[0]-i.bakw[0],2)+Math.pow(l.geometry.coordinates[1]-i.bakw[1],2)),g=p/y;g>s[r]&&(s[r]=g),g>s[a]&&(s[a]=g)}})}e.forEach((r,a)=>{const f=s[a],h=[(r.bakw[0]-i.bakw[0])*f+i.bakw[0],(r.bakw[1]-i.bakw[1])*f+i.bakw[1]];r.bakw=h})}calculatePointsWeight(){const e=["forw"];this.strict_status===ot.STATUS_LOOSE&&e.push("bakw");const n={};e.forEach(s=>{n[s]={};const r={};this.tins[s].features.map(a=>{const f=["a","b","c"];for(let h=0;h<3;h++){const u=(h+1)%3,c=f[h],l=f[u],p=a.properties[c].index,y=a.properties[l].index,g=[p,y].sort().join("-");if(!r[g]){const b=a.geometry.coordinates[0][h],w=a.geometry.coordinates[0][u],M=a.properties[c].geom,_=a.properties[l].geom;r[g]=1;const v=Math.sqrt(Math.pow(M[0]-_[0],2)+Math.pow(M[1]-_[1],2))/Math.sqrt(Math.pow(b[0]-w[0],2)+Math.pow(b[1]-w[1],2));n[s]||(n[s]={});const T=n[s];T[`${p}:${g}`]=v,T[`${y}:${g}`]=v}}})});const i={};e.map(s=>{i[s]={},this.strict_status===ot.STATUS_STRICT&&(i.bakw={});const r=n[s],a={};Object.keys(r).forEach(h=>{const[u]=h.split(":");a[u]||(a[u]=[]),a[u].push(r[h])}),Object.keys(a).forEach(h=>{const u=a[h],c=u.reduce((l,p)=>l+p,0)/u.length;i[s]||(i[s]={}),i[s][h]=c,this.strict_status===ot.STATUS_STRICT&&(i.bakw||(i.bakw={}),i.bakw[h]=1/c)});let f=0;for(let h=0;h<4;h++){const u=`b${h}`,c=i[s][u]||0;f+=c}i[s].c=f/4,this.strict_status===ot.STATUS_STRICT&&i.bakw&&(i.bakw.c=1/i[s].c)}),this.pointsWeightBuffer=i}}exports.Tin=ot;exports.constrainedTin=Yt;exports.counterPoint=Gt;exports.createPoint=Ht;exports.findIntersections=Xe;exports.format_version=Kt;exports.insertSearchIndex=He;exports.vertexCalc=we;
package/dist/tin.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import { Feature, Point, Position } from 'geojson';
2
+ import { Transform, Compiled, Edge, EdgeSet, EdgeSetLegacy, PointSet, StrictMode, VertexMode, YaxisMode } from '@maplat/transform';
3
+ import { PointsSetBD } from "./types/tin";
4
+ /**
5
+ * Tinクラスの初期化オプション
6
+ */
7
+ export interface Options {
8
+ bounds?: Position[];
9
+ wh?: number[];
10
+ vertexMode?: VertexMode;
11
+ strictMode?: StrictMode;
12
+ yaxisMode?: YaxisMode;
13
+ importance?: number;
14
+ priority?: number;
15
+ stateFull?: boolean;
16
+ points?: PointSet[];
17
+ edges?: EdgeSet[];
18
+ }
19
+ /**
20
+ * Tin (Triangulated Irregular Network) クラス
21
+ * Transformクラスを拡張し、TINネットワークの生成機能を追加
22
+ */
23
+ export declare class Tin extends Transform {
24
+ importance: number;
25
+ priority: number;
26
+ pointsSet: PointsSetBD | undefined;
27
+ /**
28
+ * Tinクラスのインスタンスを生成します
29
+ * @param options - 初期化オプション
30
+ */
31
+ constructor(options?: Options);
32
+ /**
33
+ * フォーマットバージョンを取得します
34
+ */
35
+ getFormatVersion(): number;
36
+ /**
37
+ * 制御点(GCP: Ground Control Points)を設定します
38
+ */
39
+ setPoints(points: PointSet[]): void;
40
+ /**
41
+ * エッジ(制約線)を設定します
42
+ */
43
+ setEdges(edges?: EdgeSet[] | EdgeSetLegacy[]): void;
44
+ /**
45
+ * 境界ポリゴンを設定します
46
+ */
47
+ setBounds(bounds: Position[]): void;
48
+ /**
49
+ * 現在の設定を永続化可能な形式にコンパイルします
50
+ */
51
+ getCompiled(): Compiled;
52
+ /**
53
+ * 幅と高さを設定します
54
+ */
55
+ setWh(wh?: number[]): void;
56
+ /**
57
+ * 頂点モードを設定します
58
+ */
59
+ setVertexMode(mode: VertexMode): void;
60
+ /**
61
+ * 厳密性モードを設定します
62
+ */
63
+ setStrictMode(mode: StrictMode): void;
64
+ /**
65
+ * 厳密なTINを計算します
66
+ */
67
+ calcurateStrictTin(): void;
68
+ /**
69
+ * 点群セットを生成します
70
+ */
71
+ generatePointsSet(): {
72
+ forw: Feature<Point>[];
73
+ bakw: Feature<Point>[];
74
+ edges: Edge[];
75
+ };
76
+ /**
77
+ * 入力データの検証と初期データの準備
78
+ */
79
+ private validateAndPrepareInputs;
80
+ /**
81
+ * TINネットワークを更新し、座標変換の準備を行います
82
+ */
83
+ updateTin(): void;
84
+ /**
85
+ * 通常の頂点を計算
86
+ */
87
+ private calculatePlainVertices;
88
+ /**
89
+ * 鳥瞰図モードの頂点を計算
90
+ */
91
+ private calculateBirdeyeVertices;
92
+ /**
93
+ * 頂点の位置を調整
94
+ */
95
+ private checkAndAdjustVertices;
96
+ /**
97
+ * 点の重み付けを計算します
98
+ */
99
+ calculatePointsWeight(): void;
100
+ }