deeptwins-engine-3d 0.0.43 → 0.0.45

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.
@@ -36,6 +36,9 @@ export declare const DEFAULT_VIEW_CONFIG: () => {
36
36
  fog: boolean;
37
37
  skyAtmosphere: boolean;
38
38
  requestRenderMode: boolean;
39
+ postProcessStages: {
40
+ fxaa: boolean;
41
+ };
39
42
  };
40
43
  globe: {
41
44
  show: boolean;
@@ -116,7 +119,6 @@ export declare const DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE: any;
116
119
  export declare const DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE: any;
117
120
  export declare const GRAPHIC_LAYER_TYPE_TO_CLASS: any;
118
121
  export declare const DEFAULT_YJ_LAYER: any;
119
- export declare const DEFAULT_YJ_PICK: any;
120
122
  export declare const DEFAULT_SNOW: () => {
121
123
  size: number;
122
124
  speed: number;
package/dist/constant.js CHANGED
@@ -66,7 +66,10 @@ export var DEFAULT_VIEW_CONFIG = function DEFAULT_VIEW_CONFIG() {
66
66
  showSkyBox: true,
67
67
  fog: true,
68
68
  skyAtmosphere: true,
69
- requestRenderMode: false
69
+ requestRenderMode: false,
70
+ postProcessStages: {
71
+ fxaa: false
72
+ }
70
73
  },
71
74
  globe: {
72
75
  show: true,
@@ -409,7 +412,6 @@ export var DEFAULT_YJ_LAYER = function DEFAULT_YJ_LAYER() {
409
412
  return {
410
413
  url: 'https://deepinnet-public-qz.oss-cn-hangzhou.aliyuncs.com/quzhou/tileset02.json',
411
414
  depthTest: true,
412
- // needSegment: true,
413
415
  filter: {
414
416
  saturate: 1,
415
417
  brightness: 1
@@ -417,24 +419,6 @@ export var DEFAULT_YJ_LAYER = function DEFAULT_YJ_LAYER() {
417
419
  };
418
420
  };
419
421
 
420
- // 默认的yunjing图层配置
421
- export var DEFAULT_YJ_PICK = function DEFAULT_YJ_PICK() {
422
- return {
423
- inPointStyle: {
424
- borderWidth: 4
425
- },
426
- polygonStyle: {
427
- color: 'rgba(255, 0, 0, 0.4)'
428
- },
429
- model: {
430
- wasmPaths: 'https://amappc.oss-cn-zhangjiakou.aliyuncs.com/gis/static/yunjing/static/onnx/',
431
- encoderUrl: 'https://amappc.oss-cn-zhangjiakou.aliyuncs.com/gis/static/yunjing/static/onnx/sam_vit_b_01ec64.encoder-fp16.onnx',
432
- decoderUrl: 'https://amappc.oss-cn-zhangjiakou.aliyuncs.com/gis/static/yunjing/static/onnx/sam_vit_b_01ec64.decoder.onnx',
433
- name: 'test'
434
- }
435
- };
436
- };
437
-
438
422
  // 默认雪天配置
439
423
  export var DEFAULT_SNOW = function DEFAULT_SNOW() {
440
424
  return {
@@ -11,7 +11,4 @@ export default class DeepTwins {
11
11
  _getModuleLayer(options: any): {
12
12
  addToMap: (map: any) => any;
13
13
  };
14
- _getSinglePick(options: any): {
15
- addToMap: (map: any, layer: any) => any;
16
- };
17
14
  }
@@ -9,7 +9,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
9
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
10
  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); }
11
11
  import { merge } from 'lodash';
12
- import { DEFAULT_YJ_LAYER, DEFAULT_YJ_PICK } from "../constant";
12
+ import { DEFAULT_YJ_LAYER } from "../constant";
13
13
  import * as utils from "../tool/utils";
14
14
  var DeepTwins = /*#__PURE__*/function () {
15
15
  function DeepTwins() {
@@ -39,8 +39,7 @@ var DeepTwins = /*#__PURE__*/function () {
39
39
  terrain: this._getTerrain.bind(this),
40
40
  moduleLayer: this._getModuleLayer.bind(this),
41
41
  trafficHistoryLayer: this._YunJing.TrafficHistoryLayer,
42
- trafficLayer: this._YunJing.TrafficLayer,
43
- singlePick: this._getSinglePick.bind(this)
42
+ trafficLayer: this._YunJing.TrafficLayer
44
43
  });
45
44
  }
46
45
  case 5:
@@ -97,21 +96,6 @@ var DeepTwins = /*#__PURE__*/function () {
97
96
  }
98
97
  };
99
98
  }
100
-
101
- // 单体拾取
102
- }, {
103
- key: "_getSinglePick",
104
- value: function _getSinglePick(options) {
105
- var _this2 = this;
106
- var mergeOptions = merge(DEFAULT_YJ_PICK(), options);
107
- return {
108
- addToMap: function addToMap(map, layer) {
109
- mergeOptions.viewer = map;
110
- mergeOptions.layer = layer;
111
- return new _this2._YunJing.SinglePick(mergeOptions);
112
- }
113
- };
114
- }
115
99
  }]);
116
100
  return DeepTwins;
117
101
  }();
@@ -105,7 +105,7 @@ var BasicGraphics = /*#__PURE__*/function () {
105
105
  data = this.result.position;
106
106
  break;
107
107
  }
108
- this.result = this.painter._viewer.addGraphicEntityToLayer(data, {
108
+ this.result = this.painter._viewer.addCustomSourceToGraphicLayer(data, {
109
109
  type: this.painter._type,
110
110
  id: this.result.id,
111
111
  entity: this.result
@@ -244,7 +244,7 @@ var Drawer = /*#__PURE__*/function () {
244
244
  // 如果是点,则此时执行点的结束绘制操作
245
245
  if (_this._type === 'point') {
246
246
  var _this$$Instance;
247
- _this._typeClass.result = _this._viewer.addGraphicEntityToLayer(_this._typeClass.result.position, {
247
+ _this._typeClass.result = _this._viewer.addCustomSourceToGraphicLayer(_this._typeClass.result.position, {
248
248
  type: _this._type,
249
249
  id: _this._typeClass.result.id,
250
250
  entity: _this._typeClass.result
@@ -9,7 +9,7 @@ export default class BaseLayer {
9
9
  isEntity: boolean;
10
10
  isPrimitive: boolean;
11
11
  private _isCompleteInfo;
12
- private _renderClass;
12
+ private readonly _renderClass;
13
13
  private _graphicLayerCollection;
14
14
  constructor({ id, source, options, entity, graphicLayerCollection }: any);
15
15
  private _createPrimitiveCollection;
@@ -13,6 +13,7 @@ import { v4 as uuidv4 } from 'uuid';
13
13
  import * as constant from "../constant";
14
14
  import BaseSource from "../graphicLayer/BaseSource";
15
15
  import * as utils from "../tool/utils";
16
+ import { cameraFlyToPositions } from "../tool/utils";
16
17
  import BoxPrimitive from "./BoxPrimitive";
17
18
  import EllipsePrimitive from "./EllipsePrimitive";
18
19
  import EllipsoidPrimitive from "./EllipsoidPrimitive";
@@ -21,7 +22,6 @@ import PolygonPrimitive from "./PolygonPrimitive";
21
22
  import PolylinePrimitive from "./PolylinePrimitive";
22
23
  import PolylineVolumePrimitive from "./PolylineVolumePrimitive";
23
24
  import WallPrimitive from "./WallPrimitive";
24
- import { cameraFlyToPositions } from "../tool/utils";
25
25
  var BaseLayer = /*#__PURE__*/function () {
26
26
  function BaseLayer(_ref) {
27
27
  var _this = this;
@@ -7,7 +7,7 @@ export default class BaseSource {
7
7
  private _graphicLayerCollection;
8
8
  static HANDLE_FEATURE_TYPE_FUN: any;
9
9
  static HANDLE_FEATURE_CLAMP_TYPE_FUN: any;
10
- constructor({ id, source, entitySource, graphicLayerCollection }: any);
10
+ constructor({ id, source, customSource, graphicLayerCollection }: any);
11
11
  private _canOperate;
12
12
  private _handleGeoJson;
13
13
  translateSource(source: any): void;
@@ -30,7 +30,7 @@ var BaseSource = /*#__PURE__*/function () {
30
30
  function BaseSource(_ref) {
31
31
  var id = _ref.id,
32
32
  source = _ref.source,
33
- entitySource = _ref.entitySource,
33
+ customSource = _ref.customSource,
34
34
  graphicLayerCollection = _ref.graphicLayerCollection;
35
35
  _classCallCheck(this, BaseSource);
36
36
  _defineProperty(this, "id", void 0);
@@ -43,11 +43,9 @@ var BaseSource = /*#__PURE__*/function () {
43
43
  this.id = id;
44
44
  this._graphicLayerCollection = graphicLayerCollection;
45
45
  // 直接添加实体数据
46
- if (entitySource) {
46
+ if (customSource) {
47
47
  this._isCompleteInfo = false;
48
- this.source.push({
49
- positions: entitySource
50
- });
48
+ this.source.push(customSource);
51
49
  } else {
52
50
  this.translateSource(source);
53
51
  }
@@ -236,7 +234,7 @@ var BaseSource = /*#__PURE__*/function () {
236
234
  return features;
237
235
  }
238
236
 
239
- // 对geoJson数据进行处理 返回带Cartesian3坐标数据的数组
237
+ // 对geoJson数据进行贴地处理 返回带Cartesian3坐标数据的数组
240
238
  }, {
241
239
  key: "geoJsonToClampCartesian3Array",
242
240
  value: function () {
@@ -8,9 +8,10 @@ export default class GraphicLayerCollection {
8
8
  constructor(map: any);
9
9
  private _canOperate;
10
10
  addSource(id: string, geoJson: any): BaseSource;
11
- addEntitySource(id: string, positions: any): BaseSource;
11
+ addCustomSource(id: string, positions: any): BaseSource;
12
12
  addLayer(data: any, options: any): BaseLayer;
13
- addEntityToLayer(positions: any, options: any): BaseLayer;
13
+ addCustomSourceToLayer(positions: any, options: any): BaseLayer;
14
+ private _addLayerToMap;
14
15
  private _removeGraphicMapLayer;
15
16
  private _removeGraphicMapSource;
16
17
  private _clearGraphicMapLayer;
@@ -11,7 +11,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
11
11
  import { flattenDeep } from 'lodash';
12
12
  import { v4 as uuidv4 } from 'uuid';
13
13
  import * as utils from "../tool/utils";
14
- import { isArray, cameraFlyToPositions } from "../tool/utils";
14
+ import { cameraFlyToPositions, isArray } from "../tool/utils";
15
15
  import BaseLayer from "./BaseLayer";
16
16
  import BaseSource from "./BaseSource";
17
17
  var GraphicLayerCollection = /*#__PURE__*/function () {
@@ -54,10 +54,10 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
54
54
  return source;
55
55
  }
56
56
 
57
- // 直接添加entity数据
57
+ // 直接添加自定义数据
58
58
  }, {
59
- key: "addEntitySource",
60
- value: function addEntitySource(id, positions) {
59
+ key: "addCustomSource",
60
+ value: function addCustomSource(id, positions) {
61
61
  this._canOperate();
62
62
  var uuid = id;
63
63
  if (this.graphicSources.get(uuid)) {
@@ -66,7 +66,7 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
66
66
  }
67
67
  var source = new BaseSource({
68
68
  id: uuid,
69
- entitySource: positions,
69
+ customSource: positions,
70
70
  graphicLayerCollection: this
71
71
  });
72
72
  this.graphicSources.set(source.id, source);
@@ -77,7 +77,6 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
77
77
  }, {
78
78
  key: "addLayer",
79
79
  value: function addLayer(data, options) {
80
- var _this = this;
81
80
  this._canOperate();
82
81
  var _ref = options || {},
83
82
  id = _ref.id;
@@ -103,39 +102,17 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
103
102
  graphicLayerCollection: this
104
103
  });
105
104
  // 添加到地图上
106
- if (layer.isEntity) {
107
- layer.layers.forEach(function (t) {
108
- if (t.entity) {
109
- _this._map.entities.add(t.entity);
110
- }
111
- });
112
- } else {
113
- if (['pointP', 'billboardP', 'labelP'].includes(options.type)) {
114
- this._map.scene.primitives.add(layer.primitiveCollection);
115
- } else {
116
- this._map.scene.primitives.add(layer.primitiveCollection.primitive);
117
- }
118
- }
119
- this.graphicLayers.set(layer.id, layer);
105
+ this._addLayerToMap(layer, options);
120
106
  return layer;
121
107
  }
122
108
 
123
- // 直接添加entity到图层
109
+ // 添加图层自定义数据
124
110
  }, {
125
- key: "addEntityToLayer",
126
- value: function addEntityToLayer(positions, options) {
127
- var _this2 = this;
111
+ key: "addCustomSourceToLayer",
112
+ value: function addCustomSourceToLayer(positions, options) {
128
113
  this._canOperate();
129
114
  var uuid = uuidv4();
130
- var source = null;
131
- var sourceType = BaseSource.analysisSourceType(positions);
132
- if (sourceType === 'sourceInstance') {
133
- source = positions;
134
- } else if (sourceType === 'sourceId') {
135
- source = this.graphicSources.get(positions);
136
- } else {
137
- source = this.addEntitySource(uuid, positions);
138
- }
115
+ var source = this.addCustomSource(uuid, positions);
139
116
  // 生成graphicLayer
140
117
  var layer = new BaseLayer({
141
118
  id: uuid,
@@ -144,13 +121,29 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
144
121
  graphicLayerCollection: this
145
122
  });
146
123
  // 添加到地图上
147
- layer.layers.forEach(function (t) {
148
- if (t.entity) {
149
- _this2._map.entities.add(t.entity);
124
+ this._addLayerToMap(layer, options);
125
+ return layer;
126
+ }
127
+
128
+ // 将layer添加到地图上
129
+ }, {
130
+ key: "_addLayerToMap",
131
+ value: function _addLayerToMap(layer, options) {
132
+ var _this = this;
133
+ if (layer.isEntity) {
134
+ layer.layers.forEach(function (t) {
135
+ if (t.entity) {
136
+ _this._map.entities.add(t.entity);
137
+ }
138
+ });
139
+ } else {
140
+ if (['pointP', 'billboardP', 'labelP'].includes(options.type)) {
141
+ this._map.scene.primitives.add(layer.primitiveCollection);
142
+ } else {
143
+ this._map.scene.primitives.add(layer.primitiveCollection.primitive);
150
144
  }
151
- });
145
+ }
152
146
  this.graphicLayers.set(layer.id, layer);
153
- return layer;
154
147
  }
155
148
 
156
149
  // 删除graphicLayers上的数据
@@ -359,11 +352,11 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
359
352
  }, {
360
353
  key: "flyToLayers",
361
354
  value: function flyToLayers(layers, options) {
362
- var _this3 = this;
355
+ var _this2 = this;
363
356
  this._canOperate();
364
357
  if (isArray(layers)) {
365
358
  var graphicLayers = layers.map(function (layer) {
366
- return _this3.getLayer(layer);
359
+ return _this2.getLayer(layer);
367
360
  });
368
361
  var positions = flattenDeep(graphicLayers.map(function (t) {
369
362
  return t.layers.map(function (p) {
@@ -1,5 +1,5 @@
1
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
- var _excluded = ["style", "source", "entity"],
2
+ var _excluded = ["style"],
3
3
  _excluded2 = ["color"];
4
4
  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; }
5
5
  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; }
@@ -32,10 +32,7 @@ var PolylinePrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
32
32
  var _this;
33
33
  _classCallCheck(this, PolylinePrimitiveInstance);
34
34
  _this = _super.call(this, options);
35
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
36
35
  var style = options.style,
37
- source = options.source,
38
- entity = options.entity,
39
36
  currOptions = _objectWithoutProperties(options, _excluded);
40
37
  var mergeStyle = merge(DEFAULT_POLYLINE_PRIMITIVE_OPTIONS(), cloneDeep(style || {}));
41
38
  var currStyle = PolylinePrimitiveInstance.handleOptions(mergeStyle);
@@ -54,12 +51,11 @@ var PolylinePrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
54
51
  var _options$style = options.style,
55
52
  color = _options$style.color,
56
53
  width = _options$style.width,
57
- positions = options.positions,
58
54
  primitiveCollection = options.primitiveCollection;
59
55
  this.instance = new Cesium.GeometryInstance({
60
56
  id: this.id,
61
57
  geometry: new Cesium.PolylineGeometry({
62
- positions: positions,
58
+ positions: this.source.positions,
63
59
  width: width,
64
60
  vertexFormat: Cesium.PolylineMaterialAppearance.VERTEX_FORMAT
65
61
  }),
package/dist/index.d.ts CHANGED
@@ -16,7 +16,6 @@ declare class DeepTwinsEngine3D {
16
16
  static Roam: any;
17
17
  static RotateInPlace: any;
18
18
  static ModelRoamHistory: any;
19
- static ModelRoamRunTime: any;
20
19
  static ModelRoamRealTime: any;
21
20
  static TimerInterval: any;
22
21
  static ShapeSection: any;
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ import * as Cesium from 'deeptwins-cesium';
10
10
  import "./assets/Build/Map3d/Widgets/widgets.css";
11
11
  import ModelRoamHistory from "./cameraControl/ModelRoamHistory";
12
12
  import ModelRoamRealTime from "./cameraControl/ModelRoamRealTime";
13
- import ModelRoamRunTime from "./cameraControl/ModelRoamRunTime";
14
13
  import Roam from "./cameraControl/Roam";
15
14
  import Rotate from "./cameraControl/Rotate";
16
15
  import RotateInPlace from "./cameraControl/RotateInPlace";
@@ -45,7 +44,7 @@ window.Cesium = Cesium;
45
44
  var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
46
45
  _classCallCheck(this, DeepTwinsEngine3D);
47
46
  });
48
- _defineProperty(DeepTwinsEngine3D, "Version", '0.0.43');
47
+ _defineProperty(DeepTwinsEngine3D, "Version", '0.0.45');
49
48
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
50
49
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
51
50
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -60,7 +59,6 @@ _defineProperty(DeepTwinsEngine3D, "Rotate", Rotate);
60
59
  _defineProperty(DeepTwinsEngine3D, "Roam", Roam);
61
60
  _defineProperty(DeepTwinsEngine3D, "RotateInPlace", RotateInPlace);
62
61
  _defineProperty(DeepTwinsEngine3D, "ModelRoamHistory", ModelRoamHistory);
63
- _defineProperty(DeepTwinsEngine3D, "ModelRoamRunTime", ModelRoamRunTime);
64
62
  _defineProperty(DeepTwinsEngine3D, "ModelRoamRealTime", ModelRoamRealTime);
65
63
  _defineProperty(DeepTwinsEngine3D, "TimerInterval", TimerInterval);
66
64
  _defineProperty(DeepTwinsEngine3D, "ShapeSection", ShapeSection);
package/dist/map/Map.d.ts CHANGED
@@ -40,7 +40,7 @@ export default class Map extends Cesium.Viewer {
40
40
  addGraphicSource(id: string, data: any): any;
41
41
  addGraphicEntityToSource(id: string, data: any): any;
42
42
  addGraphicLayer(data: any, options: any): any;
43
- addGraphicEntityToLayer(data: any, options: any): any;
43
+ addCustomSourceToGraphicLayer(data: any, options: any): any;
44
44
  getGraphicSource(id: any): any;
45
45
  getGraphicLayer(id: any): any;
46
46
  showGraphicLayer(layer: any, isShow: boolean): void;
package/dist/map/Map.js CHANGED
@@ -201,6 +201,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
201
201
  fog = _options$scene2.fog,
202
202
  skyAtmosphere = _options$scene2.skyAtmosphere,
203
203
  requestRenderMode = _options$scene2.requestRenderMode,
204
+ postProcessStages = _options$scene2.postProcessStages,
204
205
  _options$clock = options.clock,
205
206
  _options$clock2 = _options$clock === void 0 ? {} : _options$clock,
206
207
  currentTime = _options$clock2.currentTime,
@@ -231,6 +232,11 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
231
232
  !isNil(fog) && (this.scene.fog.enabled = fog);
232
233
  !isNil(skyAtmosphere) && (this.scene.skyAtmosphere.show = skyAtmosphere);
233
234
  !isNil(requestRenderMode) && (this.scene.requestRenderMode = requestRenderMode);
235
+ if (!isNil(postProcessStages)) {
236
+ for (var key in postProcessStages) {
237
+ this.scene.postProcessStages[key].enabled = postProcessStages[key];
238
+ }
239
+ }
234
240
 
235
241
  // clock
236
242
  !isNil(currentTime) && (this.clock.currentTime = utils.dateToJulianDate(currentTime));
@@ -238,8 +244,8 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
238
244
  !isNil(shouldAnimate) && (this.clock.shouldAnimate = shouldAnimate);
239
245
 
240
246
  // cameraController
241
- for (var key in cameraController) {
242
- this.scene.screenSpaceCameraController[key] = cameraController[key];
247
+ for (var _key in cameraController) {
248
+ this.scene.screenSpaceCameraController[_key] = cameraController[_key];
243
249
  }
244
250
 
245
251
  // globe
@@ -458,14 +464,14 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
458
464
  return this.graphicLayerCollection.addLayer(data, options);
459
465
  }
460
466
 
461
- // 直接添加entity对象到图层
467
+ // 直接自定义数据到图层
462
468
  }, {
463
- key: "addGraphicEntityToLayer",
464
- value: function addGraphicEntityToLayer(data, options) {
469
+ key: "addCustomSourceToGraphicLayer",
470
+ value: function addCustomSourceToGraphicLayer(data, options) {
465
471
  if (!this.graphicLayerCollection) {
466
472
  this.graphicLayerCollection = new GraphicLayerCollection(this);
467
473
  }
468
- return this.graphicLayerCollection.addEntityToLayer(data, options);
474
+ return this.graphicLayerCollection.addCustomSourceToLayer(data, options);
469
475
  }
470
476
 
471
477
  // 获取矢量数据
@@ -23,9 +23,8 @@ import { cloneDeep, isEqual, merge } from 'lodash';
23
23
  import { DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE } from "../constant";
24
24
  import * as utils from "../tool/utils";
25
25
  import BaseMaterialProperty from "./BaseMaterialProperty";
26
- import CircleWaveShader from "./shader/CircleWaveShader.glsl";
27
-
28
- // 水波纹材质
26
+ /* babel-plugin-inline-import './shader/CircleWaveShader.glsl' */
27
+ var CircleWaveShader = "czm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001) {\n discard;\n }\n if (dis > 0.5) {\n discard;\n } else {\n float perDis = 0.5 / count;\n float disNum;\n float bl = .0;\n for (int i = 0; i <= 9; i++) {\n if (float(i) <= count) {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0) {\n if (disNum < perDis) {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl, gradient);\n }\n }\n }\n }\n return material;\n}\n"; // 水波纹材质
29
28
  var CircleWaveMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
30
29
  _inherits(CircleWaveMaterialProperty, _BaseMaterialProperty);
31
30
  var _super = _createSuper(CircleWaveMaterialProperty);
@@ -23,9 +23,8 @@ import { cloneDeep, isEqual, merge } from 'lodash';
23
23
  import { DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE } from "../constant";
24
24
  import * as utils from "../tool/utils";
25
25
  import BaseMaterialProperty from "./BaseMaterialProperty";
26
- import DynamicWallShader from "./shader/DynamicWallShader.glsl";
27
-
28
- // 动态墙材质
26
+ /* babel-plugin-inline-import './shader/DynamicWallShader.glsl' */
27
+ var DynamicWallShader = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float vertical = 1.0;\n float directionAdd = 1.0;\n vec2 uv = vec2(0, 0);\n // \u5224\u65AD\u6392\u5217\u65B9\u5411\n if (freely == vertical) {\n // \u5224\u65AD\u8FD0\u52A8\u65B9\u5411\n if (direction == directionAdd) {\n uv = vec2(fract(st.s), fract(count * st.t + time));\n } else {\n uv = vec2(fract(st.s), fract(count * st.t - time));\n }\n } else {\n // \u5224\u65AD\u8FD0\u52A8\u65B9\u5411\n if (direction == directionAdd) {\n uv = vec2(fract(count * st.s + time), fract(st.t));\n } else {\n uv = vec2(fract(count * st.s - time), fract(st.t));\n }\n }\n vec4 colorImage = texture(image, uv);\n vec3 mixedColor = mix(colorImage.rgb, color.rgb, mixRatio);\n vec4 fragColor;\n fragColor.rgb = mixedColor;\n fragColor = czm_gammaCorrect(fragColor);\n\n material.diffuse = mixedColor;\n material.alpha = colorImage.a * color.a; // \u53EF\u6839\u636E\u9700\u8981\u51B3\u5B9A\u662F\u5426\u76F8\u4E58\n material.emission = fragColor.rgb;\n\n return material;\n}\n"; // 动态墙材质
29
28
  var DynamicWallMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
30
29
  _inherits(DynamicWallMaterialProperty, _BaseMaterialProperty);
31
30
  var _super = _createSuper(DynamicWallMaterialProperty);
@@ -23,9 +23,8 @@ import { cloneDeep, isEqual, merge } from 'lodash';
23
23
  import { DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE } from "../constant";
24
24
  import * as utils from "../tool/utils";
25
25
  import BaseMaterialProperty from "./BaseMaterialProperty";
26
- import PolylineTrailLinkShader from "./shader/PolylineTrailLinkShader.glsl";
27
-
28
- // 流动线材质
26
+ /* babel-plugin-inline-import './shader/PolylineTrailLinkShader.glsl' */
27
+ var PolylineTrailLinkShader = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = vec2(fract(materialInput.st.s * count - time), materialInput.st.t * 1.0);\n vec4 colorImage = texture(image, vec2(fract(st.s - time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = mix(colorImage.rgb, color.rgb, mixRatio);\n return material;\n}\n"; // 流动线材质
29
28
  var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
30
29
  _inherits(PolylineTrailLinkMaterialProperty, _BaseMaterialProperty);
31
30
  var _super = _createSuper(PolylineTrailLinkMaterialProperty);
@@ -9,9 +9,12 @@ import * as Cesium from 'deeptwins-cesium';
9
9
  import { merge } from 'lodash';
10
10
  import { DEFAULT_FOG, DEFAULT_RAIN, DEFAULT_SNOW } from "../constant";
11
11
  import { colorString, toRadians } from "../tool/utils";
12
- import FogShader from "./shader/FogShader.glsl";
13
- import RainShader from "./shader/RainShader.glsl";
14
- import SnowShader from "./shader/SnowShader.glsl";
12
+ /* babel-plugin-inline-import './shader/FogShader.glsl' */
13
+ var FogShader = "float getDistance(sampler2D depthTexture, vec2 texCoords)\n{\n float depth = czm_unpackDepth(texture(depthTexture, texCoords));\n if (depth == 0.0) {\n return czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n return -eyeCoordinate.z / eyeCoordinate.w;\n}\n//\u6839\u636E\u8DDD\u79BB\uFF0C\u5728\u4E2D\u95F4\u8FDB\u884C\u63D2\u503C\nfloat interpolateByDistance(vec4 nearFarScalar, float distance)\n{\n //\u6839\u636E\u5E38\u8BC6\uFF0C\u96FE\u5E94\u8BE5\u662F\u8DDD\u79BB\u8FDC\uFF0C\u8D8A\u770B\u4E0D\u6E05\uFF0C\u8FD1\u8DDD\u79BB\u5185\u7684\u7269\u4F53\u53EF\u4EE5\u770B\u6E05\n //\u56E0\u6B64\u8FD1\u8DDD\u79BBalpha=0\uFF0C\u8FDC\u8DDD\u79BB\u7684alpha=1.0\n //\u672C\u4F8B\u4E2D\u8BBE\u7F6E\u53EF\u89C1\u5EA6\u4E3A200\u7C73\n //\u96FE\u7279\u6548\u7684\u8D77\u59CB\u8DDD\u79BB\n float startDistance = nearFarScalar.x;\n //\u96FE\u7279\u6548\u7684\u8D77\u59CBalpha\u503C\n float startValue = nearFarScalar.y;\n //\u96FE\u7279\u6548\u7684\u7ED3\u675F\u8DDD\u79BB\n float endDistance = nearFarScalar.z;\n //\u96FE\u7279\u6548\u7684\u7ED3\u675Falpha\u503C\n float endValue = nearFarScalar.w;\n //\u6839\u636E\u6BCF\u6BB5\u8DDD\u79BB\u5360\u603B\u957F\u5EA6\u7684\u5360\u6BD4\uFF0C\u63D2\u503Calpha\uFF0C\u8DDD\u79BB\u8D8A\u8FDC\uFF0Calpha\u503C\u8D8A\u5927\u3002\u63D2\u503C\u8303\u56F40,1\u3002\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)\n{\n return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform vec4 fogByDistance;\nuniform vec4 fogColor;\nin vec2 v_textureCoordinates;\nvoid main(void)\n{\n //\u83B7\u53D6\u5730\u7269\u8DDD\u76F8\u673A\u7684\u8DDD\u79BB\n float distance = getDistance(depthTexture, v_textureCoordinates);\n //\u83B7\u53D6\u573A\u666F\u539F\u672C\u7684\u7EB9\u7406\u989C\u8272\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n //\u6839\u636E\u8DDD\u79BB\uFF0C\u5BF9alpha\u8FDB\u884C\u63D2\u503C\n float blendAmount = interpolateByDistance(fogByDistance, distance);\n //\u5C06alpha\u53D8\u5316\u503C\u4EE3\u5165\u96FE\u7684\u539F\u59CB\u989C\u8272\u4E2D\uFF0C\u5E76\u5C06\u96FE\u4E0E\u573A\u666F\u539F\u59CB\u7EB9\u7406\u8FDB\u884C\u878D\u5408\n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);\n out_FragColor = alphaBlend(finalFogColor, sceneColor);\n}\n";
14
+ /* babel-plugin-inline-import './shader/RainShader.glsl' */
15
+ var RainShader = "precision highp float;\n\nuniform sampler2D colorTexture;\nuniform float direction;\nuniform float size;\nuniform float speed;\nin vec2 v_textureCoordinates;\nout vec4 fragColor;\n\nfloat hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n}\n\nvoid main() {\n float time = czm_frameNumber / speed;\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);\n vec3 c = vec3(0.6, 0.7, 0.8);\n float a = direction;\n float si = sin(a), co = cos(a);\n uv *= mat2(co, -si, si, co);\n uv *= length(uv + vec2(0.0, 4.9)) * size + 1.0;\n float v = 1.0 - sin(hash(floor(uv.x * 100.0)) * 2.0);\n float b = clamp(abs(sin(20.0 * time * v + uv.y * (5.0 / (2.0 + v)))) - 0.95, 0.0, 1.0) * 20.0;\n c *= v * b;\n\n fragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1.0), 0.5);\n}\n";
16
+ /* babel-plugin-inline-import './shader/SnowShader.glsl' */
17
+ var SnowShader = "precision highp float;\n\nuniform sampler2D colorTexture;\nuniform float speed;\nuniform float size;\nin vec2 v_textureCoordinates;\nout vec4 fragColor;\n\nfloat snow(vec2 uv, float sc) {\n float scale = sc * size;\n float time = float(czm_frameNumber) / speed;\n float w = smoothstep(1.0, 0.0, -uv.y * (scale / 10.0));\n if (w < 0.1) return 0.0;\n uv += time / scale;\n uv.y += time * 2.0 / scale;\n uv.x += sin(uv.y + time * 0.5) / scale;\n uv *= scale;\n vec2 s = floor(uv), f = fract(uv), p;\n float k = 3.0, d;\n p = 0.5 + 0.35 * sin(11.0 * fract(sin((s + p + scale) * mat2(7, 3, 6, 5)) * 5.0)) - f;\n d = length(p);\n k = min(d, k);\n k = smoothstep(0.0, k, sin(f.x + f.y) * 0.01);\n return k * w;\n}\n\nvoid main() {\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2.0 - resolution.xy) / min(resolution.x, resolution.y);\n vec3 finalColor = vec3(0.0);\n float c = 0.0;\n c += snow(uv, 10.);\n c += snow(uv, 8.);\n c += snow(uv, 7.);\n c += snow(uv, 6.);\n c += snow(uv, 5.);\n c += snow(uv, 4.);\n c += snow(uv, 3.);\n c += snow(uv, 2.);\n c += snow(uv, 1.);\n c += snow(uv, .6);\n finalColor = vec3(c);\n\n // \u8C03\u6574\u4EAE\u5EA6\n finalColor = finalColor * 2.2;\n\n fragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.2);\n}\n";
15
18
  var WeatherEffects = /*#__PURE__*/function () {
16
19
  function WeatherEffects(type) {
17
20
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeptwins-engine-3d",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "description": "map for 3d",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,6 +66,7 @@
66
66
  "@typescript-eslint/parser": "^6.0.0",
67
67
  "@umijs/lint": "^4.0.0",
68
68
  "babel-loader": "^9.2.1",
69
+ "babel-plugin-inline-import": "^3.0.0",
69
70
  "copy-webpack-plugin": "^12.0.2",
70
71
  "dumi": "^2.4.13",
71
72
  "eslint": "^8.57.1",
@@ -1,32 +0,0 @@
1
- export default class ModelRoamRunTime {
2
- polylineLayer: any;
3
- polylineEntity: any;
4
- polylineOptions: any;
5
- modelLayer: any;
6
- modelEntity: any;
7
- modelOptions: any;
8
- startPosition: any;
9
- positionProperty: any;
10
- isFlyTo: any;
11
- clampToGround: boolean;
12
- timeDiff: number;
13
- status: string;
14
- private _map;
15
- private readonly _eventRunning;
16
- private _startTime;
17
- private _positions;
18
- private _positionsCartesian3;
19
- private _path;
20
- private _listenScene;
21
- private _listenRunning;
22
- constructor(map: any, options?: any);
23
- private _init;
24
- updatePosition(position: any): void;
25
- setFollowFirst(distance?: number): void;
26
- setFollowThird(): void;
27
- cancelFollow(): void;
28
- on(type: any, event: any): any;
29
- updatePolyline(style: any): void;
30
- updateModel(style: any): void;
31
- destroy(): void;
32
- }