deeptwins-engine-3d 0.1.56 → 0.1.59

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.
@@ -405,7 +405,9 @@ export var DEFAULT_VIEWSHED_ANALYSIS_OPTIONS = function DEFAULT_VIEWSHED_ANALYSI
405
405
  // 默认的底图类型
406
406
  export var DEFAULT_BASE_LAYER_TYPE = {
407
407
  GAO_DE_IMG: 'gd_img',
408
+ GAO_DE_IMG_ZJ: 'gd_img_zj',
408
409
  GAO_DE_VEC: 'gd_vec',
410
+ GAO_DE_VEC_ZJ: 'gd_vec_zj',
409
411
  TENCENT_IMG: 'tx_img',
410
412
  TENCENT_VEC: 'tx_vec',
411
413
  TENCENT_VEC_DARK: 'tx_vec_dark',
@@ -424,24 +426,39 @@ export var DEFAULT_BASE_LAYER = {
424
426
  url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
425
427
  minimumLevel: 1,
426
428
  maximumLevel: 18,
427
- credit: 'gd_img_d'
428
- }, {
429
- url: 'http://webst02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8',
429
+ credit: 'gd_img'
430
+ }]
431
+ },
432
+ gd_img_zj: {
433
+ name: '高德影像注记',
434
+ type: 'raster',
435
+ layers: [{
436
+ url: 'https://webst02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8',
430
437
  minimumLevel: 1,
431
438
  maximumLevel: 18,
432
- credit: 'gd_img_z'
439
+ credit: 'gd_img_zj'
433
440
  }]
434
441
  },
435
442
  gd_vec: {
436
443
  name: '高德电子',
437
444
  type: 'raster',
438
445
  layers: [{
439
- url: 'http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',
446
+ url: 'https://wprd02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=2&style=7',
440
447
  minimumLevel: 1,
441
448
  maximumLevel: 18,
442
449
  credit: 'gd_vec'
443
450
  }]
444
451
  },
452
+ gd_vec_zj: {
453
+ name: '高德电子+注记',
454
+ type: 'raster',
455
+ layers: [{
456
+ url: 'https://wprd02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7',
457
+ minimumLevel: 1,
458
+ maximumLevel: 18,
459
+ credit: 'gd_vec_zj'
460
+ }]
461
+ },
445
462
  tx_img: {
446
463
  name: '腾讯影像',
447
464
  type: 'raster',
@@ -344,6 +344,7 @@ var Drawer = /*#__PURE__*/function () {
344
344
  key: "endEdit",
345
345
  value: function endEdit() {
346
346
  if (!this._canOperate()) return;
347
+ this.getMap().canvas.style.cursor = 'default';
347
348
  this._changeStatus(STATUS.END_EDIT);
348
349
  this._updateTooltip();
349
350
  if (!this._instance) return;
@@ -276,6 +276,8 @@ var Point = /*#__PURE__*/function (_BaseShape) {
276
276
  value: function mouseDragChange(position) {
277
277
  if (this.dragging) {
278
278
  var _this$_drawContext$op, _this$_drawContext$op2;
279
+ // 根据edges重新生成新的点位
280
+ this.positions = [position.lng, position.lat, position.alt];
279
281
  // 调用点位改变事件
280
282
  ((_this$_drawContext$op = this._drawContext.options) === null || _this$_drawContext$op === void 0 ? void 0 : _this$_drawContext$op.onPointsChange) && ((_this$_drawContext$op2 = this._drawContext.options) === null || _this$_drawContext$op2 === void 0 ? void 0 : _this$_drawContext$op2.onPointsChange({
281
283
  layer: this,
@@ -15,7 +15,7 @@ export default class BaseSource {
15
15
  remove(): void;
16
16
  setData(data: any): this | undefined;
17
17
  _toDestroy(): void;
18
- static analysisSourceType(data: any): "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "clampedPolygonGrid" | "other";
18
+ static analysisSourceType(data: any): "other" | "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "clampedPolygonGrid";
19
19
  static wktToGeoJon(wkt: string): any;
20
20
  static geoJsonToGeoCartesian3Array(geoJson: any): any[];
21
21
  static handleFeaturePoint(feature: any): any;
@@ -73,5 +73,6 @@ export declare class DeepTwinsEngine3D {
73
73
  static BuildClampedPolygonGridUnified: any;
74
74
  static ViewShedAnalyserLayer: any;
75
75
  static VolumeClouds: any;
76
+ static ToolTip: any;
76
77
  }
77
78
  export default DeepTwinsEngine3D;
package/dist/esm/index.js CHANGED
@@ -47,6 +47,7 @@ import Compass from "./tool/Compass";
47
47
  import TimerInterval from "./tool/TimerInterval";
48
48
  import { ClampToGround, ShapeSection } from "./tool/common";
49
49
  import { loadCss } from "./tool/utils";
50
+ import ToolTip from "./toolTip";
50
51
  import VideoProject from "./videoFusion/VideoProject";
51
52
  import VideoTexture from "./videoFusion/VideoTexture";
52
53
  import Frustum from "./visualization/Frustum";
@@ -61,11 +62,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
61
62
  // 全局加载css
62
63
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
63
64
  // 打印版本信息
64
- console.log('DeepTwinsEngine3D Version:', "0.1.56");
65
+ console.log('DeepTwinsEngine3D Version:', "0.1.59");
65
66
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
66
67
  _classCallCheck(this, DeepTwinsEngine3D);
67
68
  });
68
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.56");
69
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.59");
69
70
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
70
71
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
71
72
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -138,4 +139,5 @@ _defineProperty(DeepTwinsEngine3D, "FlightRiskEvaluation", FlightRiskEvaluation)
138
139
  _defineProperty(DeepTwinsEngine3D, "BuildClampedPolygonGridUnified", BuildClampedPolygonGridUnified);
139
140
  _defineProperty(DeepTwinsEngine3D, "ViewShedAnalyserLayer", ViewShedAnalyserLayer);
140
141
  _defineProperty(DeepTwinsEngine3D, "VolumeClouds", VolumeClouds);
142
+ _defineProperty(DeepTwinsEngine3D, "ToolTip", ToolTip);
141
143
  export default DeepTwinsEngine3D;
@@ -0,0 +1,117 @@
1
+ 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; }
2
+ 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; }
3
+ 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; }
4
+ 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); }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ var AtmosphericDispersion = /*#__PURE__*/function () {
11
+ function AtmosphericDispersion(viewer) {
12
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13
+ _classCallCheck(this, AtmosphericDispersion);
14
+ this.viewer = viewer.viewer;
15
+ if (!this.viewer || _typeof(this.viewer) !== 'object') {
16
+ throw new Error('Invalid Cesium Viewer instance provided');
17
+ }
18
+ if (!this.viewer.scene || !this.viewer.scene.postProcessStages) {
19
+ throw new Error('Viewer instance must have valid scene and postProcessStages');
20
+ }
21
+ this.params = {
22
+ u_threshold: options.u_threshold !== undefined ? options.u_threshold : 1.1,
23
+ u_blendFactor: options.u_blendFactor !== undefined ? options.u_blendFactor : 0.5,
24
+ u_lightIntensity: options.u_lightIntensity !== undefined ? options.u_lightIntensity : 1.6
25
+ };
26
+ this.originalOptions = _objectSpread({}, options);
27
+ this.atmosphericDispersion = null;
28
+ this.initialize();
29
+ }
30
+ _createClass(AtmosphericDispersion, [{
31
+ key: "initialize",
32
+ value: function initialize() {
33
+ var _this = this;
34
+ var atmosphereFs = this._createFragmentShader();
35
+ this.atmosphericDispersion = new Cesium.PostProcessStage({
36
+ fragmentShader: atmosphereFs,
37
+ uniforms: {
38
+ u_threshold: function u_threshold() {
39
+ return _this.params.u_threshold;
40
+ },
41
+ u_blendFactor: function u_blendFactor() {
42
+ return _this.params.u_blendFactor;
43
+ },
44
+ u_lightIntensity: function u_lightIntensity() {
45
+ return _this.params.u_lightIntensity;
46
+ }
47
+ }
48
+ });
49
+ this.viewer.scene.postProcessStages.add(this.atmosphericDispersion);
50
+ }
51
+ }, {
52
+ key: "_createFragmentShader",
53
+ value: function _createFragmentShader() {
54
+ return "\n precision highp float;\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float u_threshold;\n uniform float u_blendFactor;\n uniform float u_lightIntensity;\n in vec2 v_textureCoordinates;\n const float PI = 3.14159265359;\n const float TWO_PI = PI * 2.0;\n const float FOUR_PI = PI * 4.0;\n\n const vec3 betaR = vec3(5.5e-6, 13.0e-6, 22.4e-6);\n\n const vec3 betaM = vec3(21e-6);\n\n const float hR = 10e3;\n const float hM = 3.8e3;\n const int num_samples = 16;\n const int num_samples_light = 4;\n #ifdef GL_ES\n #define _in(T) const in T\n #define _inout(T) inout T\n #define _out(T) out T\n #define _begin(type) type (\n #define _end )\n #define mul(a, b) (a) * (b)\n #endif\n\n struct ray_t {\n vec3 origin;\n vec3 direction;\n };\n struct sphere_t {\n vec3 origin;\n float radius;\n int material;\n };\n struct plane_t {\n vec3 direction;\n float distance;\n int material;\n };\n plane_t plane;\n mat3 rotate_around_x(_in(float) angle_degrees) {\n float angle = radians(angle_degrees);\n float _sin = sin(angle);\n float _cos = cos(angle);\n return mat3(1, 0, 0, 0, _cos, -_sin, 0, _sin, _cos);\n }\n\n bool isect_sphere(_in(ray_t) ray, _in(sphere_t) sphere, _inout(float) t0, _inout(float) t1) {\n vec3 rc = sphere.origin - ray.origin;\n float radius2 = sphere.radius * sphere.radius;\n float tca = dot(rc, ray.direction);\n float d2 = dot(rc, rc) - tca * tca;\n if (d2 > radius2) return false;\n float thc = sqrt(radius2 - d2);\n t0 = tca - thc;\n t1 = tca + thc;\n return true;\n }\n float rayleigh_phase_func(float mu) {\n return\n 3. * (1. + mu*mu)\n /\n (16. * PI);\n }\n const float g = 0.76;\n float henyey_greenstein_phase_func(float mu) {\n return\n (1. - g*g)\n /\n ((4. * PI) * pow(1. + g*g - 2.*g*mu, 1.5));\n }\n const float k = 1.55*g - 0.55 * (g*g*g);\n float schlick_phase_func(float mu) {\n return\n (1. - k*k)\n /\n (4. * PI * (1. + k*mu) * (1. + k*mu));\n }\n const sphere_t atmosphere = _begin(sphere_t)\n vec3(0, 0, 0), 6420e3, 0\n _end;\n\n bool get_sun_light(\n _in(ray_t) ray, _inout(float) optical_depthR, _inout(float) optical_depthM\n ) {\n float t0, t1;\n isect_sphere(ray, atmosphere, t0, t1);\n float march_pos = 0.;\n float march_step = t1 / float(num_samples_light);\n for (int i = 0; i < num_samples_light; i++) {\n vec3 s = ray.origin +\n ray.direction * (march_pos + 0.5 * march_step);\n float height = length(s) - 6360e3;\n if (height < 0.)\n return false;\n optical_depthR += exp(-height / hR) * march_step;\n optical_depthM += exp(-height / hM) * march_step;\n march_pos += march_step;\n }\n return true;\n }\n vec4 get_incident_light(_in(ray_t) ray) {\n vec3 dir = ray.direction;\n vec3 start = ray.origin;\n float a = dot( dir, dir);\n float b = 2.0 * dot(dir, start);\n float radius2 = atmosphere.radius * atmosphere.radius;\n float c = dot(start, start) - radius2;\n float d = (b * b) - 4.0 * a * c;\n if (d < 0.0) return vec4(0.0);\n float squaredD = sqrt(d);\n vec2 ray_length = vec2(\n max((-b - squaredD) / (2.0 * a), 0.0), min((-b + squaredD) / (2.0 * a), plane.distance)\n );\n if (ray_length.x > ray_length.y) return vec4(0.0);\n float march_step = (ray_length.y - ray_length.x) / float(num_samples);\n float mu = dot(ray.direction, normalize(czm_sunPositionWC));\n float phaseR = rayleigh_phase_func(mu);\n float phaseM =\n #if 1\n henyey_greenstein_phase_func(mu);\n #else\n schlick_phase_func(mu);\n #endif\n\n float optical_depthR = 0.;\n float optical_depthM = 0.;\n vec3 sumR = vec3(0);\n vec3 sumM = vec3(0);\n float march_pos = 0.;\n for (int i = 0; i < num_samples; i++) {\n vec3 s = ray.origin +\n ray.direction * (march_pos + 0.5 * march_step);\n float height = length(s) - 6360e3;\n\n float hr = exp(-height / hR) * march_step;\n float hm = exp(-height / hM) * march_step;\n optical_depthR += hr;\n optical_depthM += hm;\n\n ray_t light_ray = _begin(ray_t)\n s, normalize(czm_sunPositionWC)\n _end;\n float optical_depth_lightR = 0.;\n float optical_depth_lightM = 0.;\n bool overground = get_sun_light(\n light_ray,\n optical_depth_lightR,\n optical_depth_lightM);\n\n if (overground) {\n\n vec3 tau =\n betaR * (optical_depthR + optical_depth_lightR) +\n betaM * 1.1 * (optical_depthM + optical_depth_lightM);\n vec3 attenuation = exp(-tau);\n sumR += hr * attenuation;\n sumM += hm * attenuation;\n }\n\n march_pos += march_step;\n }\n float attenuation = length(exp(-((betaM * optical_depthM)\n + (betaR * optical_depthR)) * 4.));\n\n return vec4(\n 23. *\n (sumR * phaseR * betaR +\n sumM * phaseM * betaM), 1.0-attenuation);\n }\n\n void main() {\n vec4 rawColor = texture(colorTexture, v_textureCoordinates);\n float depth = czm_unpackDepth(texture(depthTexture, v_textureCoordinates));\n\n vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n vec4 positionWC = czm_inverseView * positionEC;\n positionWC.xyz = positionWC.xyz / positionWC.w;\n\n vec3 lVector = positionWC.xyz - czm_viewerPositionWC;\n ray_t ray;\n ray.origin = czm_viewerPositionWC;\n ray.direction = normalize(lVector);\n plane.distance = length(lVector);\n\n vec4 atmosphereColor = get_incident_light(ray);\n atmosphereColor.rgb *= u_lightIntensity;\n float brightness = dot(atmosphereColor.rgb, vec3(0.299, 0.587, 0.114));\n if (brightness < u_threshold) {\n atmosphereColor.rgb *= brightness / u_threshold;\n }\n rawColor = mix(rawColor, atmosphereColor + rawColor * (1.0 - atmosphereColor.a), u_blendFactor);\n rawColor = vec4(1.0 - exp(-2.2 * rawColor));\n\n out_FragColor = rawColor;\n }\n ";
55
+ }
56
+ }, {
57
+ key: "updateParameters",
58
+ value: function updateParameters(params) {
59
+ if (params && _typeof(params) === 'object') {
60
+ if (typeof params.u_threshold === 'number') {
61
+ this.params.u_threshold = params.u_threshold;
62
+ }
63
+ if (typeof params.u_blendFactor === 'number') {
64
+ this.params.u_blendFactor = params.u_blendFactor;
65
+ }
66
+ if (typeof params.u_lightIntensity === 'number') {
67
+ this.params.u_lightIntensity = params.u_lightIntensity;
68
+ }
69
+ }
70
+ return this;
71
+ }
72
+ }, {
73
+ key: "resetParameters",
74
+ value: function resetParameters() {
75
+ this.params = {
76
+ u_threshold: this.originalOptions.u_threshold !== undefined ? this.originalOptions.u_threshold : 1.1,
77
+ u_blendFactor: this.originalOptions.u_blendFactor !== undefined ? this.originalOptions.u_blendFactor : 0.5,
78
+ u_lightIntensity: this.originalOptions.u_lightIntensity !== undefined ? this.originalOptions.u_lightIntensity : 1.6
79
+ };
80
+ return this;
81
+ }
82
+ }, {
83
+ key: "show",
84
+ value: function show() {
85
+ if (this.atmosphericDispersion) {
86
+ this.atmosphericDispersion.enabled = true;
87
+ }
88
+ return this;
89
+ }
90
+ }, {
91
+ key: "hide",
92
+ value: function hide() {
93
+ if (this.atmosphericDispersion) {
94
+ this.atmosphericDispersion.enabled = false;
95
+ }
96
+ return this;
97
+ }
98
+ }, {
99
+ key: "isEnabled",
100
+ value: function isEnabled() {
101
+ return this.atmosphericDispersion ? this.atmosphericDispersion.enabled : false;
102
+ }
103
+ }, {
104
+ key: "destroy",
105
+ value: function destroy() {
106
+ if (this.atmosphericDispersion) {
107
+ this.viewer.scene.postProcessStages.remove(this.atmosphericDispersion);
108
+ this.atmosphericDispersion = null;
109
+ this.viewer = null;
110
+ this.params = null;
111
+ this.originalOptions = null;
112
+ }
113
+ }
114
+ }]);
115
+ return AtmosphericDispersion;
116
+ }();
117
+ export default AtmosphericDispersion;