@terra.gl/core 0.0.1-alpha.52 → 0.0.1-alpha.54
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 +42 -146
- package/dist/index.js +34 -67
- package/dist/index.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -274,19 +274,10 @@ export declare type AttributesType = {
|
|
|
274
274
|
|
|
275
275
|
export declare const author: any;
|
|
276
276
|
|
|
277
|
-
/**
|
|
278
|
-
* @category DrawTool
|
|
279
|
-
*/
|
|
280
277
|
declare type BaseDrawToolOptions = MapToolOptions & {
|
|
281
|
-
/**
|
|
282
|
-
* Mode name, e.g. 'line' / 'polygon' / 'point'
|
|
283
|
-
* 模式名称,例如 'line' / 'polygon' / 'point'
|
|
284
|
-
*/
|
|
278
|
+
/** 模式名称,例如 'line' / 'polygon' / 'point' */
|
|
285
279
|
mode: string;
|
|
286
|
-
/**
|
|
287
|
-
* Whether to automatically disable tool after one drawing finishes
|
|
288
|
-
* 是否在一次绘制结束后自动禁用工具
|
|
289
|
-
*/
|
|
280
|
+
/** 是否在一次绘制结束后自动禁用工具 */
|
|
290
281
|
once?: boolean;
|
|
291
282
|
};
|
|
292
283
|
|
|
@@ -1160,15 +1151,12 @@ declare interface DomEventMap extends BaseEventMap<Map_2> {
|
|
|
1160
1151
|
}
|
|
1161
1152
|
|
|
1162
1153
|
/**
|
|
1163
|
-
* Single draw mode definition:
|
|
1164
1154
|
* 单个绘制模式定义:
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
* @property clickLimit - Minimum click count (can finish when reached, usually with dblclick) 最少点击次数(达到就可以结束,通常配合 dblclick)
|
|
1171
|
-
* @category DrawTool
|
|
1155
|
+
* - actions: 参与的事件序列(目前主要是 click / mousemove / dblclick)
|
|
1156
|
+
* - create: 第一次点击时创建几何对象
|
|
1157
|
+
* - update: 每次新增顶点或移动时更新几何
|
|
1158
|
+
* - generate: 结束时生成最终结果(可以是 Feature,也可以是原几何)
|
|
1159
|
+
* - clickLimit: 最少点击次数(达到就可以结束,通常配合 dblclick)
|
|
1172
1160
|
*/
|
|
1173
1161
|
declare type DrawModeDefinition = {
|
|
1174
1162
|
actions: Array<"click" | "mousemove" | "dblclick">;
|
|
@@ -1179,86 +1167,51 @@ declare type DrawModeDefinition = {
|
|
|
1179
1167
|
};
|
|
1180
1168
|
|
|
1181
1169
|
/**
|
|
1182
|
-
* DrawTool: Universal Drawing Tool
|
|
1183
1170
|
* DrawTool:通用绘图工具
|
|
1184
1171
|
*
|
|
1185
|
-
* @description
|
|
1186
|
-
* Responsible for:
|
|
1187
|
-
* - Handling Map DOM events (click/mousemove/dblclick)
|
|
1188
|
-
* - Maintaining vertex sequence _clickCoords
|
|
1189
|
-
* - Calling mode definitions create/update/generate
|
|
1190
|
-
* - Triggering events: drawstart / drawvertex / drawend / drawing, etc.
|
|
1191
|
-
*
|
|
1192
1172
|
* 负责:
|
|
1193
1173
|
* - 处理 Map 的 DOM 事件(click/mousemove/dblclick)
|
|
1194
1174
|
* - 维护顶点序列 _clickCoords
|
|
1195
1175
|
* - 调用模式定义的 create/update/generate
|
|
1196
|
-
* - 向外触发:drawstart / drawend / drawing 等事件
|
|
1197
|
-
* @category DrawTool
|
|
1176
|
+
* - 向外触发:drawstart / drawvertex / drawend / drawing 等事件
|
|
1198
1177
|
*/
|
|
1199
1178
|
export declare class DrawTool extends MapTool {
|
|
1200
|
-
/**
|
|
1201
|
-
* Configuration options
|
|
1202
|
-
* 配置
|
|
1203
|
-
*/
|
|
1179
|
+
/** 配置 */
|
|
1204
1180
|
options: DrawToolOptions;
|
|
1205
|
-
/**
|
|
1206
|
-
* Current mode definition
|
|
1207
|
-
* 当前模式定义
|
|
1208
|
-
*/
|
|
1181
|
+
/** 当前模式定义 */
|
|
1209
1182
|
private _modeDef?;
|
|
1210
|
-
/**
|
|
1211
|
-
* Current drawing vertex sequence
|
|
1212
|
-
* 当前绘制中的顶点序列
|
|
1213
|
-
*/
|
|
1183
|
+
/** 当前绘制中的顶点序列 */
|
|
1214
1184
|
private _clickCoords;
|
|
1215
|
-
/**
|
|
1216
|
-
* Whether drawing is in progress
|
|
1217
|
-
* 是否正在绘制中
|
|
1218
|
-
*/
|
|
1185
|
+
/** 是否正在绘制中 */
|
|
1219
1186
|
private _isDrawing;
|
|
1220
|
-
/**
|
|
1221
|
-
* Current drawing geometry object (returned by mode.create/create)
|
|
1222
|
-
* 当前绘制中的几何对象(由 mode.create/create 返回)
|
|
1223
|
-
*/
|
|
1187
|
+
/** 当前绘制中的几何对象(由 mode.create/create 返回) */
|
|
1224
1188
|
private _geometry;
|
|
1225
|
-
/**
|
|
1226
|
-
* Internal unified draft layer
|
|
1227
|
-
* 内部统一草图图层
|
|
1228
|
-
*/
|
|
1189
|
+
/** 内部统一草图图层 */
|
|
1229
1190
|
private _draftLayer?;
|
|
1230
1191
|
/**
|
|
1231
|
-
* Register a drawing mode
|
|
1232
1192
|
* 注册一个绘制模式
|
|
1233
1193
|
*/
|
|
1234
1194
|
static registerMode(name: string, def: DrawModeDefinition): void;
|
|
1235
1195
|
/**
|
|
1236
|
-
* Get registered mode definition
|
|
1237
1196
|
* 获取已注册的模式
|
|
1238
1197
|
*/
|
|
1239
1198
|
static getModeDefinition(name: string): DrawModeDefinition | undefined;
|
|
1240
1199
|
constructor(options: DrawToolOptions);
|
|
1241
1200
|
/**
|
|
1242
|
-
* Get current mode name (unified to lowercase)
|
|
1243
1201
|
* 获取当前模式名称(统一转为小写)
|
|
1244
1202
|
*/
|
|
1245
1203
|
getMode(): string;
|
|
1246
1204
|
/**
|
|
1247
|
-
* Set drawing mode: will clear current drawing state
|
|
1248
1205
|
* 设置绘制模式:会清空当前绘制状态
|
|
1249
1206
|
*/
|
|
1250
1207
|
setMode(mode: string): this;
|
|
1251
1208
|
/**
|
|
1252
|
-
* Set drawing style (only affects subsequent new drawings)
|
|
1253
1209
|
* 设置绘制样式(仅影响后续新开始的绘制)
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
* @param style.geometryStyle - Main geometry style (point/line/polygon) 主几何样式(点/线/面)
|
|
1257
|
-
* @param style.vertexStyle - Vertex style, pass null to disable anchor display 顶点样式,传 null 可关闭锚点显示
|
|
1210
|
+
* - geometryStyle:主几何样式(点/线/面)
|
|
1211
|
+
* - vertexStyle:顶点样式,传 null 可关闭锚点显示
|
|
1258
1212
|
*/
|
|
1259
1213
|
setStyle(style: DrawToolStyleOptions): this;
|
|
1260
1214
|
/**
|
|
1261
|
-
* Subclass implementation: Return event mapping to bind to Map
|
|
1262
1215
|
* 子类实现:返回需要绑定到 Map 的事件映射
|
|
1263
1216
|
*/
|
|
1264
1217
|
protected getEvents(): {
|
|
@@ -1267,67 +1220,44 @@ export declare class DrawTool extends MapTool {
|
|
|
1267
1220
|
dblclick: (evt: DomEventMap) => void;
|
|
1268
1221
|
};
|
|
1269
1222
|
/**
|
|
1270
|
-
* Sync mode definition when enabled
|
|
1271
1223
|
* 启用时同步一下模式定义
|
|
1272
1224
|
*/
|
|
1273
1225
|
protected onEnable(): void;
|
|
1274
1226
|
/**
|
|
1275
|
-
* Finish current drawing and clean up draft layer when disabled
|
|
1276
1227
|
* 禁用时结束当前绘制,并清理草图图层
|
|
1277
1228
|
*/
|
|
1278
1229
|
protected onDisable(): void;
|
|
1279
1230
|
/**
|
|
1280
|
-
* Ensure current mode has corresponding definition
|
|
1281
1231
|
* 确保当前 mode 有对应的定义
|
|
1282
1232
|
*/
|
|
1283
1233
|
private _ensureMode;
|
|
1284
1234
|
/**
|
|
1285
|
-
* Handle click event:
|
|
1286
1235
|
* 处理 click 事件:
|
|
1287
|
-
*
|
|
1288
|
-
* @description
|
|
1289
|
-
* - First click: Start drawing, call mode.create, trigger drawstart
|
|
1290
|
-
* - Subsequent click: Append vertex, call mode.update, trigger drawvertex
|
|
1291
|
-
* - If clickLimit reached: Finish drawing
|
|
1292
|
-
*
|
|
1293
1236
|
* - 第一次 click:开始绘制,调用 mode.create,触发 drawstart
|
|
1294
1237
|
* - 后续 click:追加顶点,调用 mode.update,触发 drawvertex
|
|
1295
1238
|
* - 若达到 clickLimit,则结束绘制
|
|
1296
1239
|
*/
|
|
1297
1240
|
private _handleClick;
|
|
1298
1241
|
/**
|
|
1299
|
-
* Handle mousemove event:
|
|
1300
1242
|
* 处理 mousemove 事件:
|
|
1301
|
-
*
|
|
1302
|
-
* @description
|
|
1303
|
-
* - Only update geometry when drawing
|
|
1304
|
-
* - Do not modify _clickCoords, use temporary coords for update
|
|
1305
|
-
*
|
|
1306
1243
|
* - 仅在绘制中才更新几何
|
|
1307
1244
|
* - 不修改 _clickCoords,只用临时 coords 传给 update
|
|
1308
1245
|
*/
|
|
1309
1246
|
private _handleMouseMove;
|
|
1310
1247
|
/**
|
|
1311
|
-
* Handle dblclick:
|
|
1312
1248
|
* 处理 dblclick:
|
|
1313
|
-
*
|
|
1314
|
-
* @description
|
|
1315
|
-
* - If drawing, finish directly
|
|
1316
1249
|
* - 如果正在绘制,则直接结束
|
|
1317
1250
|
*/
|
|
1318
1251
|
private _handleDblClick;
|
|
1319
1252
|
/**
|
|
1320
|
-
* Normally finish a drawing: Call mode.generate and trigger drawend
|
|
1321
1253
|
* 正常结束一次绘制:调用 mode.generate 并触发 drawend
|
|
1322
1254
|
*/
|
|
1323
1255
|
private _finishDrawing;
|
|
1324
1256
|
/**
|
|
1325
|
-
* Silently finish (no drawend trigger), used for mode switching / tool disabling
|
|
1326
1257
|
* 静默结束(不触发 drawend),用于切换模式 / 禁用工具
|
|
1327
1258
|
*/
|
|
1328
1259
|
private _finishDrawingSilently;
|
|
1329
1260
|
/**
|
|
1330
|
-
* Internal: Get or create unified draft layer
|
|
1331
1261
|
* 内部:获取或创建统一草图图层
|
|
1332
1262
|
*/
|
|
1333
1263
|
_getOrCreateDraftLayer(): OverlayLayer<Feature>;
|
|
@@ -1340,23 +1270,13 @@ export declare class DrawTool extends MapTool {
|
|
|
1340
1270
|
export declare type DrawToolOptions = BaseDrawToolOptions & DrawToolStyleOptions;
|
|
1341
1271
|
|
|
1342
1272
|
/**
|
|
1343
|
-
* Style configuration type
|
|
1344
1273
|
* 样式配置类型
|
|
1345
|
-
* @category DrawTool
|
|
1346
1274
|
*/
|
|
1347
1275
|
export declare type DrawToolStyleOptions = {
|
|
1348
|
-
/**
|
|
1349
|
-
* Main geometry style (point / line / polygon)
|
|
1350
|
-
* 主几何样式(点 / 线 / 面)
|
|
1351
|
-
*/
|
|
1276
|
+
/** 主几何样式(点 / 线 / 面) */
|
|
1352
1277
|
geometryStyle?: StyleInput;
|
|
1353
1278
|
/**
|
|
1354
|
-
* Vertex (anchor) style
|
|
1355
1279
|
* 顶点(锚点)样式
|
|
1356
|
-
*
|
|
1357
|
-
* @description
|
|
1358
|
-
* - Pass null to not draw anchors
|
|
1359
|
-
* - Pass undefined to keep current setting
|
|
1360
1280
|
* - 传 null 表示不绘制锚点
|
|
1361
1281
|
* - 不传该字段则保持当前设置
|
|
1362
1282
|
*/
|
|
@@ -2602,7 +2522,7 @@ export declare class InfoWindow extends UIComponent {
|
|
|
2602
2522
|
* InfoWindow 配置项
|
|
2603
2523
|
* @category UI
|
|
2604
2524
|
*/
|
|
2605
|
-
declare type InfoWindowOptions = UIComponentOptions & {
|
|
2525
|
+
export declare type InfoWindowOptions = UIComponentOptions & {
|
|
2606
2526
|
/**
|
|
2607
2527
|
* Title text.
|
|
2608
2528
|
* 标题文本
|
|
@@ -4268,100 +4188,78 @@ export declare type MapOptionsType = {
|
|
|
4268
4188
|
};
|
|
4269
4189
|
|
|
4270
4190
|
/**
|
|
4271
|
-
* Map Tool Base Class.
|
|
4272
4191
|
* 地图工具基类
|
|
4273
4192
|
*
|
|
4274
|
-
* - Manage tool lifecycle (addTo / enable / disable / remove)
|
|
4275
|
-
* - Integrate with Map event system (Unified internal event registration/unregistration)
|
|
4276
|
-
* - Ensure only one active tool exists on the same map
|
|
4277
|
-
*
|
|
4278
4193
|
* - 管理工具的生命周期(addTo / enable / disable / remove)
|
|
4279
4194
|
* - 与 Map 的事件系统对接(内部统一注册/注销事件)
|
|
4280
4195
|
* - 保证同一张地图同时只存在一个激活工具
|
|
4281
|
-
* @category Map
|
|
4282
4196
|
*/
|
|
4283
4197
|
export declare abstract class MapTool extends MapTool_base {
|
|
4284
|
-
/**
|
|
4285
|
-
* Bound map instance
|
|
4286
|
-
* 绑定的地图实例
|
|
4287
|
-
*/
|
|
4198
|
+
/** 绑定的地图实例 */
|
|
4288
4199
|
protected _map?: Map_2;
|
|
4289
|
-
/**
|
|
4290
|
-
* Whether enabled
|
|
4291
|
-
* 是否启用中
|
|
4292
|
-
*/
|
|
4200
|
+
/** 是否启用中 */
|
|
4293
4201
|
protected _enabled: boolean;
|
|
4294
|
-
/**
|
|
4295
|
-
* Cache event handlers bound to Map for removal on off
|
|
4296
|
-
* 缓存绑定到 Map 上的事件处理函数,便于 off 时移除
|
|
4297
|
-
*/
|
|
4202
|
+
/** 缓存绑定到 Map 上的事件处理函数,便于 off 时移除 */
|
|
4298
4203
|
private _boundHandlers;
|
|
4299
4204
|
/**
|
|
4300
|
-
* @param options
|
|
4205
|
+
* @param options 工具配置
|
|
4301
4206
|
*/
|
|
4302
4207
|
constructor(options?: MapToolOptions);
|
|
4303
4208
|
/**
|
|
4304
|
-
* Add tool to map and automatically enable.
|
|
4305
|
-
* Ensures only one active MapTool on the same Map.
|
|
4306
4209
|
* 将工具添加到地图上,并自动启用。
|
|
4307
4210
|
* 同一张 Map 上会保证只有一个激活的 MapTool。
|
|
4308
4211
|
*/
|
|
4309
4212
|
addTo(map: Map_2): this;
|
|
4310
4213
|
/**
|
|
4311
|
-
* Get currently bound map instance.
|
|
4312
4214
|
* 获取当前绑定的地图实例
|
|
4313
4215
|
*/
|
|
4314
4216
|
getMap(): Map_2 | undefined;
|
|
4315
4217
|
/**
|
|
4316
|
-
* Enable tool: Bind events + Call onEnable hook.
|
|
4317
4218
|
* 启用工具:绑定事件 + 调用 onEnable 钩子
|
|
4318
4219
|
*/
|
|
4319
4220
|
enable(): this;
|
|
4320
4221
|
/**
|
|
4321
|
-
* Disable tool: Unbind events + Call onDisable hook.
|
|
4322
4222
|
* 禁用工具:解绑事件 + 调用 onDisable 钩子
|
|
4323
4223
|
*/
|
|
4324
4224
|
disable(): this;
|
|
4325
4225
|
/**
|
|
4326
|
-
*
|
|
4327
|
-
|
|
4226
|
+
* 工具是否处于启用状态
|
|
4227
|
+
*/
|
|
4228
|
+
isEnabled(): boolean;
|
|
4229
|
+
/**
|
|
4230
|
+
* 从地图上移除工具
|
|
4328
4231
|
*/
|
|
4329
4232
|
remove(): this;
|
|
4330
4233
|
/**
|
|
4331
|
-
*
|
|
4332
|
-
*
|
|
4234
|
+
* 子类实现:返回需要绑定到 Map 上的事件映射
|
|
4235
|
+
*
|
|
4236
|
+
* key: 事件名(如 'click', 'mousemove')
|
|
4237
|
+
* value: 事件处理函数(参数为 Map 的事件数据)
|
|
4238
|
+
*
|
|
4239
|
+
* 注意:
|
|
4240
|
+
* - 不要求提前 bind(this),MapTool 内部会统一绑定 this
|
|
4241
|
+
*/
|
|
4242
|
+
protected abstract getEvents(): Record<string, (e: any) => void>;
|
|
4243
|
+
/**
|
|
4244
|
+
* 生命周期钩子:工具刚 addTo(map) 时调用
|
|
4333
4245
|
*/
|
|
4334
4246
|
protected onAdd?(): void;
|
|
4335
4247
|
/**
|
|
4336
|
-
*
|
|
4337
|
-
* 抽象方法:子类可实现启用逻辑。
|
|
4248
|
+
* 生命周期钩子:工具 enable() 时调用
|
|
4338
4249
|
*/
|
|
4339
4250
|
protected onEnable?(): void;
|
|
4340
4251
|
/**
|
|
4341
|
-
*
|
|
4342
|
-
* 抽象方法:子类可实现禁用逻辑。
|
|
4252
|
+
* 生命周期钩子:工具 disable() 时调用
|
|
4343
4253
|
*/
|
|
4344
4254
|
protected onDisable?(): void;
|
|
4345
4255
|
/**
|
|
4346
|
-
*
|
|
4347
|
-
* 抽象方法:子类可实现移除逻辑。
|
|
4348
|
-
*/
|
|
4349
|
-
protected onRemove?(): void;
|
|
4350
|
-
/**
|
|
4351
|
-
* Bind events.
|
|
4352
|
-
* 绑定事件。
|
|
4256
|
+
* 内部:绑定 Map 事件
|
|
4353
4257
|
*/
|
|
4354
4258
|
private _bindEvents;
|
|
4355
4259
|
/**
|
|
4356
|
-
*
|
|
4357
|
-
* 解绑事件。
|
|
4260
|
+
* 内部:解绑 Map 事件
|
|
4358
4261
|
*/
|
|
4359
4262
|
private _unbindEvents;
|
|
4360
|
-
/**
|
|
4361
|
-
* Helper method: Register map event listener (Automatically managed, auto-removed on disable).
|
|
4362
|
-
* 辅助方法:注册地图事件监听(自动管理,disable 时自动移除)。
|
|
4363
|
-
*/
|
|
4364
|
-
protected addMapEvent(type: string, fn: (e: any) => void, context?: any): void;
|
|
4365
4263
|
}
|
|
4366
4264
|
|
|
4367
4265
|
declare const MapTool_base: {
|
|
@@ -4393,9 +4291,7 @@ declare const MapTool_base: {
|
|
|
4393
4291
|
} & typeof EmptyBase;
|
|
4394
4292
|
|
|
4395
4293
|
/**
|
|
4396
|
-
* MapTool configuration (Reserved for future extension)
|
|
4397
4294
|
* MapTool 配置项(预留,将来可以扩展)
|
|
4398
|
-
* @category Map
|
|
4399
4295
|
*/
|
|
4400
4296
|
declare type MapToolOptions = ClassOptions_2 & {};
|
|
4401
4297
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as pt from "three";
|
|
2
2
|
import { REVISION as of, TrianglesDrawMode as Yw, TriangleFanDrawMode as Jl, TriangleStripDrawMode as af, Mesh as Ie, Vector3 as z, Color as ue, FrontSide as na, Plane as lf, Matrix4 as Le, Vector4 as bn, PerspectiveCamera as nr, WebGLRenderTarget as Gr, UniformsUtils as sr, UniformsLib as $o, ShaderMaterial as Rn, MOUSE as pi, TOUCH as mi, Spherical as td, Quaternion as yn, OrthographicCamera as Wr, Vector2 as ce, Ray as Bw, PlaneGeometry as ir, HalfFloatType as Qi, AdditiveBlending as fc, MeshBasicMaterial as _n, RGBAFormat as cf, LinearFilter as Ti, NoBlending as jw, Clock as ia, Loader as pc, LoaderUtils as Rr, FileLoader as Si, MeshPhysicalMaterial as An, SpotLight as uf, PointLight as Ql, DirectionalLight as qo, InstancedMesh as mc, InstancedBufferAttribute as $l, Object3D as vn, TextureLoader as ra, ImageBitmapLoader as Jw, BufferAttribute as Tt, InterleavedBuffer as Qw, InterleavedBufferAttribute as $i, LinearMipmapLinearFilter as Rs, NearestMipmapLinearFilter as $w, LinearMipmapNearestFilter as qw, NearestMipmapNearestFilter as eb, NearestFilter as hf, RepeatWrapping as xn, MirroredRepeatWrapping as tb, ClampToEdgeWrapping as ql, PointsMaterial as sa, Material as Sl, LineBasicMaterial as df, MeshStandardMaterial as Is, DoubleSide as Fr, PropertyBinding as Cs, BufferGeometry as rn, SkinnedMesh as ff, LineSegments as nb, Line as pf, LineLoop as ib, Points as Or, Group as wn, MathUtils as _t, Skeleton as mf, AnimationClip as gf, Bone as ec, InterpolateDiscrete as rb, InterpolateLinear as yf, Texture as Ar, VectorKeyframeTrack as tc, NumberKeyframeTrack as nc, QuaternionKeyframeTrack as ic, Interpolant as sb, Box3 as or, Sphere as gc, Curve as ob, MeshPhongMaterial as Ms, MeshLambertMaterial as _f, EquirectangularReflectionMapping as ab, AmbientLight as vf, Float32BufferAttribute as gi, Uint16BufferAttribute as lb, Matrix3 as cb, Euler as vs, DataTextureLoader as ub, FloatType as Jo, DataUtils as Co, InstancedBufferGeometry as wf, InstancedInterleavedBuffer as rc, WireframeGeometry as hb, Line3 as db, EventDispatcher as bf, Scene as fb, FogExp2 as nd, CubeTextureLoader as pb, WebGLRenderer as mb, PCFSoftShadowMap as gb, ACESFilmicToneMapping as yb, SRGBColorSpace as oa, CameraHelper as _b, CubicBezierCurve3 as vb, Frustum as wb, Raycaster as Zs, CanvasTexture as zr, SpriteMaterial as Dr, Sprite as Pi, DynamicDrawUsage as id, NormalBlending as xf, CurvePath as Tf, LineCurve3 as Ir, QuadraticBezierCurve3 as Sf, TubeGeometry as bb, BackSide as xb, Shape as Tb, ShapeGeometry as Sb, CylinderGeometry as Mb, AnimationMixer as Lb, LoopRepeat as Pb, LoopOnce as Cb, LoadingManager as Zb, Box2 as Gb, ImageLoader as Mf } from "three";
|
|
3
|
-
const Wb = "0.0.1-alpha.
|
|
3
|
+
const Wb = "0.0.1-alpha.54", Ml = {
|
|
4
4
|
name: "Criska"
|
|
5
5
|
};
|
|
6
6
|
var Ls = function() {
|
|
@@ -19052,7 +19052,7 @@ function bL(r, e) {
|
|
|
19052
19052
|
}
|
|
19053
19053
|
const xL = `{
|
|
19054
19054
|
"name": "@terra.gl/core",
|
|
19055
|
-
"version": "0.0.1-alpha.
|
|
19055
|
+
"version": "0.0.1-alpha.54",
|
|
19056
19056
|
"type": "module",
|
|
19057
19057
|
"files": [
|
|
19058
19058
|
"dist"
|
|
@@ -23144,14 +23144,12 @@ class J2 extends Ci(
|
|
|
23144
23144
|
ar(j2)
|
|
23145
23145
|
) {
|
|
23146
23146
|
/**
|
|
23147
|
-
* @param options
|
|
23147
|
+
* @param options 工具配置
|
|
23148
23148
|
*/
|
|
23149
23149
|
constructor(e = {}) {
|
|
23150
23150
|
super(e), jl(this, "_map"), jl(this, "_enabled", !1), jl(this, "_boundHandlers", /* @__PURE__ */ new Map());
|
|
23151
23151
|
}
|
|
23152
23152
|
/**
|
|
23153
|
-
* Add tool to map and automatically enable.
|
|
23154
|
-
* Ensures only one active MapTool on the same Map.
|
|
23155
23153
|
* 将工具添加到地图上,并自动启用。
|
|
23156
23154
|
* 同一张 Map 上会保证只有一个激活的 MapTool。
|
|
23157
23155
|
*/
|
|
@@ -23161,61 +23159,61 @@ class J2 extends Ci(
|
|
|
23161
23159
|
return t._activeMapTool && t._activeMapTool !== this && t._activeMapTool.disable(), t._activeMapTool = this, this._map = e, this.onAdd && this.onAdd(), this.enable(), this.trigger("add", { map: e }), this;
|
|
23162
23160
|
}
|
|
23163
23161
|
/**
|
|
23164
|
-
* Get currently bound map instance.
|
|
23165
23162
|
* 获取当前绑定的地图实例
|
|
23166
23163
|
*/
|
|
23167
23164
|
getMap() {
|
|
23168
23165
|
return this._map;
|
|
23169
23166
|
}
|
|
23170
23167
|
/**
|
|
23171
|
-
* Enable tool: Bind events + Call onEnable hook.
|
|
23172
23168
|
* 启用工具:绑定事件 + 调用 onEnable 钩子
|
|
23173
23169
|
*/
|
|
23174
23170
|
enable() {
|
|
23175
23171
|
return !this._map || this._enabled ? this : (this._enabled = !0, this._bindEvents(), this.onEnable && this.onEnable(), this.trigger("enable", { map: this._map }), this);
|
|
23176
23172
|
}
|
|
23177
23173
|
/**
|
|
23178
|
-
* Disable tool: Unbind events + Call onDisable hook.
|
|
23179
23174
|
* 禁用工具:解绑事件 + 调用 onDisable 钩子
|
|
23180
23175
|
*/
|
|
23181
23176
|
disable() {
|
|
23182
23177
|
return !this._map || !this._enabled ? this : (this._enabled = !1, this._unbindEvents(), this.onDisable && this.onDisable(), this.trigger("disable", { map: this._map }), this);
|
|
23183
23178
|
}
|
|
23184
23179
|
/**
|
|
23185
|
-
*
|
|
23186
|
-
|
|
23180
|
+
* 工具是否处于启用状态
|
|
23181
|
+
*/
|
|
23182
|
+
isEnabled() {
|
|
23183
|
+
return !!this._enabled;
|
|
23184
|
+
}
|
|
23185
|
+
/**
|
|
23186
|
+
* 从地图上移除工具
|
|
23187
23187
|
*/
|
|
23188
23188
|
remove() {
|
|
23189
23189
|
if (!this._map) return this;
|
|
23190
|
-
this.disable()
|
|
23190
|
+
this.disable();
|
|
23191
23191
|
const e = this._map;
|
|
23192
|
-
return e._activeMapTool === this &&
|
|
23192
|
+
return e._activeMapTool === this && delete e._activeMapTool, this._map = void 0, this.trigger("remove"), this;
|
|
23193
23193
|
}
|
|
23194
23194
|
/**
|
|
23195
|
-
*
|
|
23196
|
-
* 绑定事件。
|
|
23195
|
+
* 内部:绑定 Map 事件
|
|
23197
23196
|
*/
|
|
23198
23197
|
_bindEvents() {
|
|
23199
|
-
this._map;
|
|
23198
|
+
const e = this._map;
|
|
23199
|
+
if (!e) return;
|
|
23200
|
+
const t = this.getEvents() || {};
|
|
23201
|
+
Object.keys(t).forEach((n) => {
|
|
23202
|
+
const i = t[n];
|
|
23203
|
+
if (!i) return;
|
|
23204
|
+
const o = (a) => i.call(this, a);
|
|
23205
|
+
this._boundHandlers.set(n, o), e.on(n, o);
|
|
23206
|
+
});
|
|
23200
23207
|
}
|
|
23201
23208
|
/**
|
|
23202
|
-
*
|
|
23203
|
-
* 解绑事件。
|
|
23209
|
+
* 内部:解绑 Map 事件
|
|
23204
23210
|
*/
|
|
23205
23211
|
_unbindEvents() {
|
|
23206
|
-
|
|
23207
|
-
|
|
23212
|
+
const e = this._map;
|
|
23213
|
+
e && (this._boundHandlers.forEach((t, n) => {
|
|
23214
|
+
e.off(n, t);
|
|
23208
23215
|
}), this._boundHandlers.clear());
|
|
23209
23216
|
}
|
|
23210
|
-
/**
|
|
23211
|
-
* Helper method: Register map event listener (Automatically managed, auto-removed on disable).
|
|
23212
|
-
* 辅助方法:注册地图事件监听(自动管理,disable 时自动移除)。
|
|
23213
|
-
*/
|
|
23214
|
-
addMapEvent(e, t, n) {
|
|
23215
|
-
if (!this._map) return;
|
|
23216
|
-
const i = n ? t.bind(n) : t;
|
|
23217
|
-
this._boundHandlers.set(e, i), this._map.on(e, i);
|
|
23218
|
-
}
|
|
23219
23217
|
}
|
|
23220
23218
|
var Q2 = Object.defineProperty, $2 = (r, e, t) => e in r ? Q2(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ys = (r, e, t) => $2(r, typeof e != "symbol" ? e + "" : e, t);
|
|
23221
23219
|
class q2 extends Mi {
|
|
@@ -23232,46 +23230,38 @@ class Fs extends J2 {
|
|
|
23232
23230
|
super(e), ys(this, "_modeDef"), ys(this, "_clickCoords", []), ys(this, "_isDrawing", !1), ys(this, "_geometry"), ys(this, "_draftLayer"), this.options.once = this.options.once ?? !1, this._ensureMode();
|
|
23233
23231
|
}
|
|
23234
23232
|
/**
|
|
23235
|
-
* Register a drawing mode
|
|
23236
23233
|
* 注册一个绘制模式
|
|
23237
23234
|
*/
|
|
23238
23235
|
static registerMode(e, t) {
|
|
23239
23236
|
nf[e.toLowerCase()] = t;
|
|
23240
23237
|
}
|
|
23241
23238
|
/**
|
|
23242
|
-
* Get registered mode definition
|
|
23243
23239
|
* 获取已注册的模式
|
|
23244
23240
|
*/
|
|
23245
23241
|
static getModeDefinition(e) {
|
|
23246
23242
|
return nf[e.toLowerCase()];
|
|
23247
23243
|
}
|
|
23248
23244
|
/**
|
|
23249
|
-
* Get current mode name (unified to lowercase)
|
|
23250
23245
|
* 获取当前模式名称(统一转为小写)
|
|
23251
23246
|
*/
|
|
23252
23247
|
getMode() {
|
|
23253
23248
|
return (this.options.mode || "").toLowerCase();
|
|
23254
23249
|
}
|
|
23255
23250
|
/**
|
|
23256
|
-
* Set drawing mode: will clear current drawing state
|
|
23257
23251
|
* 设置绘制模式:会清空当前绘制状态
|
|
23258
23252
|
*/
|
|
23259
23253
|
setMode(e) {
|
|
23260
23254
|
return this._finishDrawingSilently(), this.options.mode = e, this._ensureMode(), this;
|
|
23261
23255
|
}
|
|
23262
23256
|
/**
|
|
23263
|
-
|
|
23264
|
-
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
* @param style.geometryStyle - Main geometry style (point/line/polygon) 主几何样式(点/线/面)
|
|
23268
|
-
* @param style.vertexStyle - Vertex style, pass null to disable anchor display 顶点样式,传 null 可关闭锚点显示
|
|
23269
|
-
*/
|
|
23257
|
+
* 设置绘制样式(仅影响后续新开始的绘制)
|
|
23258
|
+
* - geometryStyle:主几何样式(点/线/面)
|
|
23259
|
+
* - vertexStyle:顶点样式,传 null 可关闭锚点显示
|
|
23260
|
+
*/
|
|
23270
23261
|
setStyle(e) {
|
|
23271
23262
|
return e.geometryStyle !== void 0 && (this.options.geometryStyle = e.geometryStyle), Object.prototype.hasOwnProperty.call(e, "vertexStyle") && (this.options.vertexStyle = e.vertexStyle ?? null), this;
|
|
23272
23263
|
}
|
|
23273
23264
|
/**
|
|
23274
|
-
* Subclass implementation: Return event mapping to bind to Map
|
|
23275
23265
|
* 子类实现:返回需要绑定到 Map 的事件映射
|
|
23276
23266
|
*/
|
|
23277
23267
|
getEvents() {
|
|
@@ -23282,38 +23272,28 @@ class Fs extends J2 {
|
|
|
23282
23272
|
};
|
|
23283
23273
|
}
|
|
23284
23274
|
/**
|
|
23285
|
-
* Sync mode definition when enabled
|
|
23286
23275
|
* 启用时同步一下模式定义
|
|
23287
23276
|
*/
|
|
23288
23277
|
onEnable() {
|
|
23289
23278
|
this._ensureMode();
|
|
23290
23279
|
}
|
|
23291
23280
|
/**
|
|
23292
|
-
* Finish current drawing and clean up draft layer when disabled
|
|
23293
23281
|
* 禁用时结束当前绘制,并清理草图图层
|
|
23294
23282
|
*/
|
|
23295
23283
|
onDisable() {
|
|
23296
23284
|
this._finishDrawingSilently(), this._destroyDraftLayer();
|
|
23297
23285
|
}
|
|
23298
23286
|
/**
|
|
23299
|
-
* Ensure current mode has corresponding definition
|
|
23300
23287
|
* 确保当前 mode 有对应的定义
|
|
23301
23288
|
*/
|
|
23302
23289
|
_ensureMode() {
|
|
23303
23290
|
const e = this.getMode(), t = Fs.getModeDefinition(e);
|
|
23304
23291
|
if (!t)
|
|
23305
|
-
throw new Error(`DrawTool: mode "${e}"
|
|
23292
|
+
throw new Error(`DrawTool: mode "${e}" 未注册,请先调用 DrawTool.registerMode`);
|
|
23306
23293
|
this._modeDef = t;
|
|
23307
23294
|
}
|
|
23308
23295
|
/**
|
|
23309
|
-
* Handle click event:
|
|
23310
23296
|
* 处理 click 事件:
|
|
23311
|
-
*
|
|
23312
|
-
* @description
|
|
23313
|
-
* - First click: Start drawing, call mode.create, trigger drawstart
|
|
23314
|
-
* - Subsequent click: Append vertex, call mode.update, trigger drawvertex
|
|
23315
|
-
* - If clickLimit reached: Finish drawing
|
|
23316
|
-
*
|
|
23317
23297
|
* - 第一次 click:开始绘制,调用 mode.create,触发 drawstart
|
|
23318
23298
|
* - 后续 click:追加顶点,调用 mode.update,触发 drawvertex
|
|
23319
23299
|
* - 若达到 clickLimit,则结束绘制
|
|
@@ -23334,13 +23314,7 @@ class Fs extends J2 {
|
|
|
23334
23314
|
})), n.clickLimit && this._clickCoords.length >= n.clickLimit && this._finishDrawing(i);
|
|
23335
23315
|
}
|
|
23336
23316
|
/**
|
|
23337
|
-
* Handle mousemove event:
|
|
23338
23317
|
* 处理 mousemove 事件:
|
|
23339
|
-
*
|
|
23340
|
-
* @description
|
|
23341
|
-
* - Only update geometry when drawing
|
|
23342
|
-
* - Do not modify _clickCoords, use temporary coords for update
|
|
23343
|
-
*
|
|
23344
23318
|
* - 仅在绘制中才更新几何
|
|
23345
23319
|
* - 不修改 _clickCoords,只用临时 coords 传给 update
|
|
23346
23320
|
*/
|
|
@@ -23355,11 +23329,7 @@ class Fs extends J2 {
|
|
|
23355
23329
|
});
|
|
23356
23330
|
}
|
|
23357
23331
|
/**
|
|
23358
|
-
* Handle dblclick:
|
|
23359
23332
|
* 处理 dblclick:
|
|
23360
|
-
*
|
|
23361
|
-
* @description
|
|
23362
|
-
* - If drawing, finish directly
|
|
23363
23333
|
* - 如果正在绘制,则直接结束
|
|
23364
23334
|
*/
|
|
23365
23335
|
_handleDblClick(e) {
|
|
@@ -23368,7 +23338,6 @@ class Fs extends J2 {
|
|
|
23368
23338
|
this._finishDrawing(t);
|
|
23369
23339
|
}
|
|
23370
23340
|
/**
|
|
23371
|
-
* Normally finish a drawing: Call mode.generate and trigger drawend
|
|
23372
23341
|
* 正常结束一次绘制:调用 mode.generate 并触发 drawend
|
|
23373
23342
|
*/
|
|
23374
23343
|
_finishDrawing(e) {
|
|
@@ -23381,21 +23350,19 @@ class Fs extends J2 {
|
|
|
23381
23350
|
}), this._isDrawing = !1, this._clickCoords = [], this._geometry = void 0, this.options.once && this.disable();
|
|
23382
23351
|
}
|
|
23383
23352
|
/**
|
|
23384
|
-
* Silently finish (no drawend trigger), used for mode switching / tool disabling
|
|
23385
23353
|
* 静默结束(不触发 drawend),用于切换模式 / 禁用工具
|
|
23386
23354
|
*/
|
|
23387
23355
|
_finishDrawingSilently() {
|
|
23388
23356
|
this._isDrawing = !1, this._clickCoords = [], this._geometry = void 0;
|
|
23389
23357
|
}
|
|
23390
23358
|
/**
|
|
23391
|
-
* Internal: Get or create unified draft layer
|
|
23392
23359
|
* 内部:获取或创建统一草图图层
|
|
23393
23360
|
*/
|
|
23394
23361
|
_getOrCreateDraftLayer() {
|
|
23395
23362
|
if (this._draftLayer) return this._draftLayer;
|
|
23396
23363
|
const e = this.getMap();
|
|
23397
23364
|
if (!e)
|
|
23398
|
-
throw new Error("DrawTool:
|
|
23365
|
+
throw new Error("DrawTool: 尚未绑定地图,请先调用 addTo(map)");
|
|
23399
23366
|
const t = `__draw_draft_${Date.now().toString(36)}`, n = new q2(t);
|
|
23400
23367
|
return e.addLayer(n), this._draftLayer = n, n;
|
|
23401
23368
|
}
|
|
@@ -23557,9 +23524,9 @@ const eP = {
|
|
|
23557
23524
|
tool: t,
|
|
23558
23525
|
draftLayer: n,
|
|
23559
23526
|
draftPolygon: null,
|
|
23560
|
-
//
|
|
23527
|
+
// 草图面
|
|
23561
23528
|
draftEdgeLine: null,
|
|
23562
|
-
//
|
|
23529
|
+
// 点数<3时的草图边线
|
|
23563
23530
|
draftAnchors: a,
|
|
23564
23531
|
polygonStyle: i,
|
|
23565
23532
|
vertexStyle: o
|