deeptwins-engine-3d 0.1.69 → 0.1.71

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.
Files changed (41) hide show
  1. package/dist/assets/Build/DeepTwins/Image/fire.png +0 -0
  2. package/dist/assets/Build/DeepTwins/Image/fountain.png +0 -0
  3. package/dist/assets/Build/DeepTwins/Image/smoke.png +0 -0
  4. package/dist/esm/analyze/LineOfSightAnalysis.d.ts +44 -0
  5. package/dist/esm/analyze/LineOfSightAnalysis.js +326 -0
  6. package/dist/esm/analyze/TerrainExcavationAnalysis.d.ts +59 -0
  7. package/dist/esm/analyze/TerrainExcavationAnalysis.js +612 -0
  8. package/dist/esm/constant.d.ts +88 -0
  9. package/dist/esm/constant.js +132 -0
  10. package/dist/esm/drawCommand/viewShed/RectangularSensorPrimitive.d.ts +3 -0
  11. package/dist/esm/drawCommand/viewShed/RectangularSensorPrimitive.js +56 -21
  12. package/dist/esm/drawCommand/viewShed/config.d.ts +2 -2
  13. package/dist/esm/drawCommand/viewShed/config.js +2 -2
  14. package/dist/esm/drawer/index.d.ts +1 -1
  15. package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
  16. package/dist/esm/index.d.ts +15 -0
  17. package/dist/esm/index.js +24 -2
  18. package/dist/esm/map/Map.d.ts +1 -0
  19. package/dist/esm/map/Map.js +18 -0
  20. package/dist/esm/particle/BaseParticle.d.ts +61 -0
  21. package/dist/esm/particle/BaseParticle.js +196 -0
  22. package/dist/esm/particle/FireParticle.d.ts +8 -0
  23. package/dist/esm/particle/FireParticle.js +65 -0
  24. package/dist/esm/particle/FountainParticle.d.ts +10 -0
  25. package/dist/esm/particle/FountainParticle.js +80 -0
  26. package/dist/esm/particle/SmokeParticle.d.ts +8 -0
  27. package/dist/esm/particle/SmokeParticle.js +65 -0
  28. package/dist/esm/particle/common.d.ts +18 -0
  29. package/dist/esm/particle/common.js +23 -0
  30. package/dist/esm/particle/index.d.ts +5 -0
  31. package/dist/esm/particle/index.js +5 -0
  32. package/dist/esm/tileLayer/CustomRasterLayer.d.ts +188 -0
  33. package/dist/esm/tileLayer/CustomRasterLayer.js +776 -0
  34. package/dist/esm/visualization/DynamicWater.d.ts +39 -0
  35. package/dist/esm/visualization/DynamicWater.js +289 -0
  36. package/dist/esm/visualization/MigrationEffect.d.ts +36 -0
  37. package/dist/esm/visualization/MigrationEffect.js +397 -0
  38. package/dist/esm/visualization/RadarScan.d.ts +39 -0
  39. package/dist/esm/visualization/RadarScan.js +333 -0
  40. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  41. package/package.json +4 -2
@@ -0,0 +1,18 @@
1
+ /// <reference path="../typings.d.ts" />
2
+ import type { Matrix4 } from 'deeptwins-cesium';
3
+ import type { BaseParticleOptions } from './BaseParticle';
4
+ export interface BaseParticleInternalOptions {
5
+ modelMatrix?: Matrix4;
6
+ emitterModelMatrix?: Matrix4;
7
+ }
8
+ export declare const PARTICLE_INTERNAL_OPTIONS: unique symbol;
9
+ type MatrixExternalOptions = {
10
+ modelMatrix?: Matrix4;
11
+ emitterModelMatrix?: Matrix4;
12
+ };
13
+ export declare const createInternalParticleOptions: <T extends BaseParticleOptions>(options: T, internalOptions: BaseParticleInternalOptions) => T & BaseParticleOptions & {
14
+ [PARTICLE_INTERNAL_OPTIONS]?: BaseParticleInternalOptions | undefined;
15
+ };
16
+ export declare const getInternalParticleOptions: (options: BaseParticleOptions) => BaseParticleInternalOptions | undefined;
17
+ export declare const omitExternalMatrixOptions: <T extends BaseParticleOptions>(options: T) => T & MatrixExternalOptions;
18
+ export {};
@@ -0,0 +1,23 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ export var PARTICLE_INTERNAL_OPTIONS = Symbol('PARTICLE_INTERNAL_OPTIONS');
8
+ export var createInternalParticleOptions = function createInternalParticleOptions(options, internalOptions) {
9
+ var nextOptions = _objectSpread({}, options);
10
+ Object.defineProperty(nextOptions, PARTICLE_INTERNAL_OPTIONS, {
11
+ value: internalOptions
12
+ });
13
+ return nextOptions;
14
+ };
15
+ export var getInternalParticleOptions = function getInternalParticleOptions(options) {
16
+ return options[PARTICLE_INTERNAL_OPTIONS];
17
+ };
18
+ export var omitExternalMatrixOptions = function omitExternalMatrixOptions(options) {
19
+ var safeOptions = _objectSpread({}, options);
20
+ delete safeOptions.modelMatrix;
21
+ delete safeOptions.emitterModelMatrix;
22
+ return safeOptions;
23
+ };
@@ -0,0 +1,5 @@
1
+ import BaseParticle from './BaseParticle';
2
+ import FireParticle from './FireParticle';
3
+ import FountainParticle from './FountainParticle';
4
+ import SmokeParticle from './SmokeParticle';
5
+ export { BaseParticle, FireParticle, FountainParticle, SmokeParticle };
@@ -0,0 +1,5 @@
1
+ import BaseParticle from "./BaseParticle";
2
+ import FireParticle from "./FireParticle";
3
+ import FountainParticle from "./FountainParticle";
4
+ import SmokeParticle from "./SmokeParticle";
5
+ export { BaseParticle, FireParticle, FountainParticle, SmokeParticle };
@@ -0,0 +1,188 @@
1
+ /// <reference path="../typings.d.ts" />
2
+ import * as Cesium from 'deeptwins-cesium';
3
+ import ImageryLayer from './ImageryLayer';
4
+ /**
5
+ * CustomRasterLayer 是一个通用栅格瓦片图层:
6
+ * - 使用 Cesium.UrlTemplateImageryProvider 加载任意 URL 模板瓦片。
7
+ * - 使用 proj4 将瓦片范围和裁剪 GeoJSON 从 dataCrs 转到 renderCrs。
8
+ * - GCJ02 渲染时按 tileLayer/test 的瓦片坐标方案计算瓦片范围。
9
+ * - 可选按 GeoJSON 面要素裁剪瓦片。
10
+ * - 裁剪前先求瓦片 bbox 与裁剪面的交集,避免多面重叠时误裁。
11
+ * - 可选输出调试事件,便于排查范围、瓦片加载、裁剪和丢弃行为。
12
+ *
13
+ * @example 基础瓦片图层
14
+ * ```ts
15
+ * const layer = new DeepTwinsEngine3D.CustomRasterLayer({
16
+ * id: 'base-raster',
17
+ * source: {
18
+ * url: 'https://example.com/tiles/{z}/{x}/{y}.png',
19
+ * minimumLevel: 0,
20
+ * maximumLevel: 18,
21
+ * },
22
+ * debug: true,
23
+ * });
24
+ * map.imageryLayers.add(layer);
25
+ * ```
26
+ *
27
+ * @example 带范围、坐标转换和裁剪的图层
28
+ * ```ts
29
+ * const layer = new DeepTwinsEngine3D.CustomRasterLayer({
30
+ * id: 'project-raster',
31
+ * source: {
32
+ * url: 'https://example.com/project/{z}/{x}/{y}.png',
33
+ * maximumLevel: 20,
34
+ * },
35
+ * // bounds 格式:[minX, minY, maxX, maxY],这里表示 EPSG:3857 米制范围。
36
+ * bounds: [13210000, 3520000, 13230000, 3540000],
37
+ * dataCrs: 'EPSG:3857',
38
+ * renderCrs: 'EPSG:4326',
39
+ * clipFeature: geoJsonPolygon,
40
+ * debug: (event) => console.debug(event),
41
+ * });
42
+ * map.imageryLayers.add(layer);
43
+ * ```
44
+ *
45
+ * @remarks API 文档
46
+ * - `source`:必填,Cesium.UrlTemplateImageryProvider 原生配置。
47
+ * - `layerOptions`:可选,Cesium.ImageryLayer 原生配置。
48
+ * - `bounds`:可选,瓦片范围 `[minX, minY, maxX, maxY]`。
49
+ * - `dataCrs`:可选,bounds 与 clipFeature 的原始坐标系,默认 `EPSG:4326`。
50
+ * - `renderCrs`:可选,bounds、clipFeature 和瓦片范围转换后的目标坐标系,默认 `EPSG:4326`。
51
+ * - `projectionDefs`:可选,自定义 proj4 坐标系定义。
52
+ * - `clipFeature`:可选,GeoJSON Polygon/MultiPolygon/Feature/FeatureCollection。
53
+ * - `autoFitBounds`:可选,创建后自动将相机定位到最终范围,需同时传入 `map`。
54
+ * - `debug`:可选,`true` 使用 console.debug,函数则接收结构化调试事件。
55
+ */
56
+ /** 通用范围格式:[minX, minY, maxX, maxY]。 */
57
+ export type CustomRasterBounds = [number, number, number, number];
58
+ /** 调试事件类型,覆盖范围初始化、瓦片加载和裁剪决策。 */
59
+ export type CustomRasterLayerDebugEventType = 'range' | 'tile-loaded' | 'tile-kept' | 'tile-clipped' | 'tile-discarded' | 'tile-error';
60
+ /** debug 回调收到的结构化事件。 */
61
+ export type CustomRasterLayerDebugEvent = {
62
+ /** 事件类型。 */
63
+ type: CustomRasterLayerDebugEventType;
64
+ /** 图层 id。 */
65
+ layerId?: string;
66
+ /** 瓦片 x 坐标。 */
67
+ x?: number;
68
+ /** 瓦片 y 坐标。 */
69
+ y?: number;
70
+ /** 瓦片层级。 */
71
+ level?: number;
72
+ /** 当前瓦片范围,格式为 [west, south, east, north]。 */
73
+ bbox?: CustomRasterBounds;
74
+ /** 用户传入的原始瓦片范围。 */
75
+ bounds?: CustomRasterBounds;
76
+ /** bounds 转换到 renderCrs 后的瓦片范围。 */
77
+ tileBounds?: CustomRasterBounds;
78
+ /** clipFeature 转换到 renderCrs 后通过 turf.bbox 生成的裁剪范围。 */
79
+ clipBounds?: CustomRasterBounds;
80
+ /** 最终用于瓦片调度的渲染范围。 */
81
+ renderBounds?: CustomRasterBounds;
82
+ /** 原始数据坐标系。 */
83
+ dataCrs?: string;
84
+ /** bounds、clipFeature 和瓦片范围转换后的目标坐标系。 */
85
+ renderCrs?: string;
86
+ /** 裁剪或丢弃原因。 */
87
+ reason?: string;
88
+ /** 异常信息。 */
89
+ error?: unknown;
90
+ /** 瓦片图片尺寸。 */
91
+ imageSize?: {
92
+ width: number;
93
+ height: number;
94
+ };
95
+ };
96
+ /** debug 配置:关闭、console.debug 输出,或自定义事件处理函数。 */
97
+ export type CustomRasterLayerDebug = boolean | ((event: CustomRasterLayerDebugEvent) => void);
98
+ /** 内置切片方案名称,或 Cesium 原生 TilingScheme 实例。 */
99
+ export type CustomRasterTilingSchemeOption = 'webMercator' | 'geographic' | Cesium.TilingScheme;
100
+ /** CustomRasterLayer 数据源配置,扩展 tilingScheme 字符串默认选项。 */
101
+ export type CustomRasterSourceOptions = Omit<Cesium.UrlTemplateImageryProvider.ConstructorOptions, 'tilingScheme'> & {
102
+ /** 切片方案,默认 webMercator,可传 geographic 或 Cesium.TilingScheme 实例。 */
103
+ tilingScheme?: CustomRasterTilingSchemeOption;
104
+ };
105
+ /** CustomRasterLayer 构造配置。 */
106
+ export type CustomRasterLayerOptions = {
107
+ /** 图层 id,透传到实例,便于外部管理和 debug 标识。 */
108
+ id?: string;
109
+ /** 图层排序值,透传到实例,便于外部图层集合管理。 */
110
+ zIndex?: number;
111
+ /** Cesium.UrlTemplateImageryProvider 配置,tilingScheme 额外支持内置字符串名称。 */
112
+ source: CustomRasterSourceOptions;
113
+ /** Cesium.ImageryLayer 原生配置。 */
114
+ layerOptions?: Cesium.ImageryLayer.ConstructorOptions;
115
+ /** 瓦片范围,格式为 [minX, minY, maxX, maxY],坐标系跟随 dataCrs。 */
116
+ bounds?: CustomRasterBounds;
117
+ /** bounds 和 clipFeature 的原始坐标系,默认 EPSG:4326。 */
118
+ dataCrs?: string;
119
+ /** bounds、clipFeature 和瓦片范围转换后的目标坐标系,默认 EPSG:4326。 */
120
+ renderCrs?: string;
121
+ /** 自定义 proj4 坐标系定义,key 可为 EPSG:xxxx 或其他 proj4 名称。 */
122
+ projectionDefs?: Record<string, string>;
123
+ /** 用于裁剪瓦片的 GeoJSON 面要素。 */
124
+ clipFeature?: any;
125
+ /** 地图实例,autoFitBounds 或手动 fitToBounds 时用于控制相机。 */
126
+ map?: any;
127
+ /** 是否创建后自动将相机定位到最终渲染范围,默认 false。 */
128
+ autoFitBounds?: boolean;
129
+ /** 自动定位到范围时透传给相机 flyTo 的配置,默认 { duration: 0 }。 */
130
+ fitBoundsOptions?: any;
131
+ /** 调试开关或自定义调试事件处理函数。 */
132
+ debug?: CustomRasterLayerDebug;
133
+ };
134
+ type TileImage = HTMLImageElement | HTMLCanvasElement | ImageBitmap;
135
+ type RasterImagery = {
136
+ x: number;
137
+ y: number;
138
+ level: number;
139
+ rectangle: Cesium.Rectangle;
140
+ image: TileImage;
141
+ };
142
+ /**
143
+ * 通用自定义栅格图层。
144
+ *
145
+ * 继承项目现有 ImageryLayer 封装,内部使用 UrlTemplateImageryProvider。
146
+ * 若传入 clipFeature,会在 Cesium 创建纹理前用 canvas 对瓦片进行透明裁剪。
147
+ */
148
+ export default class CustomRasterLayer extends ImageryLayer {
149
+ /** 图层 id,方便业务图层集合按 id 管理。 */
150
+ id?: string;
151
+ /** 图层层级,方便业务图层集合排序。 */
152
+ zIndex?: number;
153
+ /** Cesium 瓦片数据源实例。 */
154
+ readonly source: Cesium.UrlTemplateImageryProvider;
155
+ private readonly _debug?;
156
+ private readonly _clipFeatures;
157
+ private readonly _fitBounds?;
158
+ private _mapContext;
159
+ /** 创建通用栅格图层。 */
160
+ constructor(options: CustomRasterLayerOptions);
161
+ getMap(): any;
162
+ /** 将相机定位到当前图层最终渲染范围。 */
163
+ fitToBounds(map?: any, options?: any): this;
164
+ /**
165
+ * Cesium 内部纹理创建钩子。
166
+ *
167
+ * 这里按 tileLayer/test 的 ClipLayer 逻辑处理裁剪:
168
+ * - 完全在裁剪面内:原图保留。
169
+ * - 完全不相交:替换为空透明 canvas。
170
+ * - 部分相交:按瓦片与裁剪面的交集裁剪 canvas。
171
+ */
172
+ _createTexture(context: any, imagery: RasterImagery): any;
173
+ /** 调用 Cesium 原始纹理创建逻辑。 */
174
+ private createTexture;
175
+ /** 获取当前瓦片与所有裁剪面的交集,用交集路径裁剪当前瓦片。 */
176
+ private getClipIntersections;
177
+ /** 创建与当前瓦片同尺寸的透明 canvas。 */
178
+ private createTileCanvas;
179
+ /** 将地理坐标转换为当前瓦片画布像素坐标。 */
180
+ private pointToPixel;
181
+ /** 将裁剪后的 geometry 转换为画布 path 坐标数组。 */
182
+ private geometryToPathArray;
183
+ /** 按 path 坐标裁剪当前瓦片画布。 */
184
+ private clip;
185
+ /** 输出结构化 debug 事件。 */
186
+ private logDebug;
187
+ }
188
+ export {};