deeptwins-engine-3d 0.1.47 → 0.1.49

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 (37) hide show
  1. package/dist/esm/analyze/ViewshedAnalysis.js +3 -2
  2. package/dist/esm/constant.d.ts +11 -0
  3. package/dist/esm/constant.js +26 -0
  4. package/dist/esm/graphicLayer/BaseLayer.js +6 -0
  5. package/dist/esm/graphicLayer/BasePrimitiveInstance.d.ts +2 -0
  6. package/dist/esm/graphicLayer/BasePrimitiveInstance.js +13 -5
  7. package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
  8. package/dist/esm/graphicLayer/BaseSource.js +6 -0
  9. package/dist/esm/graphicLayer/PolygonGroundPrimitiveImageMaterialInstance.d.ts +5 -0
  10. package/dist/esm/graphicLayer/PolygonGroundPrimitiveImageMaterialInstance.js +84 -0
  11. package/dist/esm/graphicLayer/PolygonPrimitive.js +6 -4
  12. package/dist/esm/graphicLayer/PolygonPrimitiveImageMaterialInstance.d.ts +5 -0
  13. package/dist/esm/graphicLayer/PolygonPrimitiveImageMaterialInstance.js +81 -0
  14. package/dist/esm/graphicLayer/PolygonPrimitiveInstance.d.ts +1 -1
  15. package/dist/esm/graphicLayer/PolygonPrimitiveInstance.js +8 -23
  16. package/dist/esm/graphicLayer/PolylineGroundPrimitiveInstance.js +1 -1
  17. package/dist/esm/index.d.ts +2 -1
  18. package/dist/esm/index.js +6 -4
  19. package/dist/esm/map/Map.js +1 -1
  20. package/dist/esm/material/primitive/BaseMaterialAppearance.d.ts +1 -0
  21. package/dist/esm/material/primitive/BaseMaterialAppearance.js +1 -0
  22. package/dist/esm/material/primitive/ImageMaterialAppearance.d.ts +10 -0
  23. package/dist/esm/material/primitive/ImageMaterialAppearance.js +77 -0
  24. package/dist/esm/material/shader/ImageShader.glsl +22 -0
  25. package/dist/esm/tool/BuildClampedPolygonGrid.d.ts +11 -0
  26. package/dist/esm/tool/BuildClampedPolygonGrid.js +151 -0
  27. package/dist/esm/tool/utils.d.ts +18 -1
  28. package/dist/esm/tool/utils.js +119 -44
  29. package/dist/esm/videoFusion/VideoProject.js +1 -1
  30. package/dist/esm/visualization/Frustum.d.ts +27 -2
  31. package/dist/esm/visualization/Frustum.js +158 -42
  32. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  33. package/package.json +8 -5
  34. package/dist/esm/visualization/BaseFrustum.d.ts +0 -14
  35. package/dist/esm/visualization/BaseFrustum.js +0 -96
  36. package/dist/esm/visualization/FrustumWithCamera.d.ts +0 -5
  37. package/dist/esm/visualization/FrustumWithCamera.js +0 -133
@@ -15,7 +15,7 @@ import * as Cesium from 'deeptwins-cesium';
15
15
  import { merge } from 'lodash';
16
16
  import { DEFAULT_VIEWSHED_ANALYSIS_OPTIONS } from "../constant";
17
17
  import * as utils from "../tool/utils";
18
- import FrustumWithCamera from "../visualization/FrustumWithCamera";
18
+ import Frustum from "../visualization/Frustum";
19
19
 
20
20
  // 可视域分析。
21
21
  var ViewshedAnalysis = /*#__PURE__*/function () {
@@ -204,10 +204,11 @@ var ViewshedAnalysis = /*#__PURE__*/function () {
204
204
  key: "_drawFrustumOutline",
205
205
  value: function _drawFrustumOutline() {
206
206
  if (!this._canOperate) return;
207
- this.frustumCamera = new FrustumWithCamera(this.getMap(), {
207
+ this.frustumCamera = new Frustum(this.getMap(), {
208
208
  position: this.options.position,
209
209
  fill: false,
210
210
  outlineColor: this.options.outlineColor,
211
+ isWithCamera: true,
211
212
  camera: this.lightCamera
212
213
  });
213
214
  }
@@ -183,6 +183,16 @@ export declare const DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS: () => {
183
183
  color: string;
184
184
  }[];
185
185
  };
186
+ export declare const DEFAULT_FRUSTUM_OPTIONS: () => {
187
+ show: boolean;
188
+ heading: number;
189
+ pitch: number;
190
+ roll: number;
191
+ color: string;
192
+ outline: boolean;
193
+ outlineColor: string;
194
+ isWithCamera: boolean;
195
+ };
186
196
  export declare const DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS: () => {
187
197
  startHeight: number;
188
198
  targetHeight: number;
@@ -221,6 +231,7 @@ export declare const DEFAULT_MATERIAL_APPEARANCE: any;
221
231
  export declare const DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE: any;
222
232
  export declare const DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE: any;
223
233
  export declare const DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE: any;
234
+ export declare const DEFAULT_IMAGE_MATERIAL_STYLE: any;
224
235
  export declare const DEFAULT_GLOW_MATERIAL_STYLE: any;
225
236
  export declare const GRAPHIC_LAYER_TYPE_TO_CLASS: any;
226
237
  export declare const DEFAULT_YJ_LAYER: any;
@@ -15,6 +15,8 @@ import ModelPrimitiveInstance from "./graphicLayer/ModelPrimitiveInstance";
15
15
  import PointEntity from "./graphicLayer/PointEntity";
16
16
  import PointPrimitive from "./graphicLayer/PointPrimitive";
17
17
  import PolygonEntity from "./graphicLayer/PolygonEntity";
18
+ import PolygonGroundPrimitiveImageMaterialInstance from "./graphicLayer/PolygonGroundPrimitiveImageMaterialInstance";
19
+ import PolygonPrimitiveImageMaterialInstance from "./graphicLayer/PolygonPrimitiveImageMaterialInstance";
18
20
  import PolygonPrimitiveInstance from "./graphicLayer/PolygonPrimitiveInstance";
19
21
  import PolylineEntity from "./graphicLayer/PolylineEntity";
20
22
  import PolylineGroundPrimitiveInstance from "./graphicLayer/PolylineGroundPrimitiveInstance";
@@ -310,6 +312,20 @@ export var DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS = function DEFAULT_FLIGHT_RISK
310
312
  };
311
313
  };
312
314
 
315
+ // 默认视锥体配置选项
316
+ export var DEFAULT_FRUSTUM_OPTIONS = function DEFAULT_FRUSTUM_OPTIONS() {
317
+ return {
318
+ show: true,
319
+ heading: 0,
320
+ pitch: 0,
321
+ roll: 0,
322
+ color: 'rgba(255,0,0,0.3)',
323
+ outline: true,
324
+ outlineColor: '#ffffff',
325
+ isWithCamera: false
326
+ };
327
+ };
328
+
313
329
  // 默认淹没分析配置选项 SubmergenceAnalysis
314
330
  export var DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS = function DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS() {
315
331
  return {
@@ -586,6 +602,14 @@ export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MAT
586
602
  };
587
603
  };
588
604
 
605
+ // 贴图材质默认的配置
606
+ export var DEFAULT_IMAGE_MATERIAL_STYLE = function DEFAULT_IMAGE_MATERIAL_STYLE() {
607
+ return {
608
+ color: Cesium.Color.WHITE,
609
+ mixRatio: 0.5
610
+ };
611
+ };
612
+
589
613
  // 发光材质默认的配置
590
614
  export var DEFAULT_GLOW_MATERIAL_STYLE = function DEFAULT_GLOW_MATERIAL_STYLE() {
591
615
  return {
@@ -614,7 +638,9 @@ export var GRAPHIC_LAYER_TYPE_TO_CLASS = {
614
638
  polylineP: PolylinePrimitiveInstance,
615
639
  polylineGroundP: PolylineGroundPrimitiveInstance,
616
640
  polygonP: PolygonPrimitiveInstance,
641
+ polygonImageP: PolygonPrimitiveImageMaterialInstance,
617
642
  polygonGroundP: PolygonPrimitiveInstance,
643
+ polygonGroundImageP: PolygonGroundPrimitiveImageMaterialInstance,
618
644
  boxP: BoxPrimitiveInstance,
619
645
  modelP: ModelPrimitiveInstance,
620
646
  labelP: LabelPrimitive,
@@ -112,6 +112,12 @@ var BaseLayer = /*#__PURE__*/function () {
112
112
  polygonP: function polygonP() {
113
113
  _this2.primitiveCollection = new PolygonPrimitive(_this2._mapContext);
114
114
  },
115
+ polygonImageP: function polygonImageP() {
116
+ _this2.primitiveCollection = new PolygonPrimitive(_this2._mapContext);
117
+ },
118
+ polygonGroundImageP: function polygonGroundImageP() {
119
+ _this2.primitiveCollection = new PolygonPrimitive(_this2._mapContext);
120
+ },
115
121
  polygonGroundP: function polygonGroundP() {
116
122
  _this2.primitiveCollection = new PolygonGroundPrimitive(_this2._mapContext);
117
123
  },
@@ -1,9 +1,11 @@
1
1
  export default class BasePrimitiveInstance {
2
+ private readonly _mapContext;
2
3
  id: any;
3
4
  source: any;
4
5
  style: any;
5
6
  type: string;
6
7
  readonly isPrimitive: boolean;
7
8
  constructor(options: any);
9
+ getMap(): any;
8
10
  updateStyle(): void;
9
11
  }
@@ -6,11 +6,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  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); }
8
8
  import { v4 as uuidv4 } from 'uuid';
9
-
10
9
  // 基础PrimitiveInstance图层
11
10
  var BasePrimitiveInstance = /*#__PURE__*/function () {
12
11
  function BasePrimitiveInstance(options) {
13
12
  _classCallCheck(this, BasePrimitiveInstance);
13
+ _defineProperty(this, "_mapContext", void 0);
14
14
  _defineProperty(this, "id", void 0);
15
15
  _defineProperty(this, "source", void 0);
16
16
  _defineProperty(this, "style", void 0);
@@ -18,14 +18,22 @@ var BasePrimitiveInstance = /*#__PURE__*/function () {
18
18
  _defineProperty(this, "isPrimitive", true);
19
19
  this.id = uuidv4();
20
20
  var style = options.style,
21
- source = options.source;
22
- this.type = options.type;
21
+ source = options.source,
22
+ type = options.type,
23
+ mapContext = options.mapContext;
24
+ this._mapContext = mapContext;
25
+ this.type = type;
23
26
  this.source = source;
24
27
  this.style = style || {};
25
28
  }
26
-
27
- // 更新样式
28
29
  _createClass(BasePrimitiveInstance, [{
30
+ key: "getMap",
31
+ value: function getMap() {
32
+ return this._mapContext && this._mapContext.getMap();
33
+ }
34
+
35
+ // 更新样式
36
+ }, {
29
37
  key: "updateStyle",
30
38
  value: function updateStyle() {
31
39
  console.warn("".concat(this.type, "\u7C7B\u578B\u4E0D\u652F\u6301\u66F4\u65B0\u6837\u5F0F"));
@@ -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" | "other";
18
+ static analysisSourceType(data: any): "clampedPolygonGrid" | "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "other";
19
19
  static wktToGeoJon(wkt: string): any;
20
20
  static geoJsonToGeoCartesian3Array(geoJson: any): any[];
21
21
  static handleFeaturePoint(feature: any): any;
@@ -100,6 +100,9 @@ var BaseSource = /*#__PURE__*/function () {
100
100
  this._handleGeoJson(source);
101
101
  } else if (sourceType === 'wkt') {
102
102
  this._handleGeoJson(BaseSource.wktToGeoJon(source));
103
+ } else if (sourceType === 'clampedPolygonGrid') {
104
+ // 贴地网格
105
+ this.source = source.source;
103
106
  } else {
104
107
  throw new Error('数据格式错误');
105
108
  }
@@ -152,6 +155,9 @@ var BaseSource = /*#__PURE__*/function () {
152
155
  return 'sourceInstance';
153
156
  } else if (data.type === 'Feature' || data.type === 'FeatureCollection') {
154
157
  return 'geoJson';
158
+ } else if (data.type === 'clampedPolygonGrid') {
159
+ // 贴地网格
160
+ return 'clampedPolygonGrid';
155
161
  } else {
156
162
  return 'other';
157
163
  }
@@ -0,0 +1,5 @@
1
+ import PolygonPrimitiveInstance from './PolygonPrimitiveInstance';
2
+ export default class PolygonGroundPrimitiveImageMaterialInstance extends PolygonPrimitiveInstance {
3
+ constructor(options: any);
4
+ _init(options: any): void;
5
+ }
@@ -0,0 +1,84 @@
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 = ["color", "stRotation"];
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ import * as Cesium from 'deeptwins-cesium';
18
+ import * as utils from "../tool/utils";
19
+ import PolygonPrimitiveInstance from "./PolygonPrimitiveInstance";
20
+
21
+ // polygon ground Primitive 图片材质贴图
22
+ var PolygonGroundPrimitiveImageMaterialInstance = /*#__PURE__*/function (_PolygonPrimitiveInst) {
23
+ _inherits(PolygonGroundPrimitiveImageMaterialInstance, _PolygonPrimitiveInst);
24
+ var _super = _createSuper(PolygonGroundPrimitiveImageMaterialInstance);
25
+ function PolygonGroundPrimitiveImageMaterialInstance(options) {
26
+ _classCallCheck(this, PolygonGroundPrimitiveImageMaterialInstance);
27
+ return _super.call(this, options);
28
+ }
29
+
30
+ // 初始化
31
+ _createClass(PolygonGroundPrimitiveImageMaterialInstance, [{
32
+ key: "_init",
33
+ value: function _init(options) {
34
+ var _options$style = options.style,
35
+ color = _options$style.color,
36
+ stRotation = _options$style.stRotation,
37
+ style = _objectWithoutProperties(_options$style, _excluded),
38
+ positions = options.positions,
39
+ indices = options.indices,
40
+ primitiveInstance = options.primitiveInstance;
41
+ if (!indices || indices.length < 3) return;
42
+ if (!positions || positions.length < 3) return;
43
+ var geometry = new Cesium.Geometry({
44
+ // @ts-ignore
45
+ attributes: {
46
+ position: new Cesium.GeometryAttribute({
47
+ componentDatatype: Cesium.ComponentDatatype.DOUBLE,
48
+ componentsPerAttribute: 3,
49
+ values: Cesium.Cartesian3.packArray(positions)
50
+ })
51
+ },
52
+ indices: new Uint32Array(indices),
53
+ primitiveType: Cesium.PrimitiveType.TRIANGLES,
54
+ boundingSphere: Cesium.BoundingSphere.fromPoints(positions)
55
+ });
56
+ if (!style.extrudedHeight) {
57
+ var posAttr = geometry.attributes.position;
58
+ var vertexCount = posAttr.values.length / 3;
59
+ var finalPositions = [];
60
+ for (var i = 0; i < vertexCount; i++) {
61
+ finalPositions.push(new Cesium.Cartesian3(posAttr.values[i * 3], posAttr.values[i * 3 + 1], posAttr.values[i * 3 + 2]));
62
+ }
63
+ geometry.attributes.st = new Cesium.GeometryAttribute({
64
+ componentDatatype: Cesium.ComponentDatatype.FLOAT,
65
+ componentsPerAttribute: 2,
66
+ values: utils.computeSTAlongPlane(finalPositions, stRotation)
67
+ });
68
+ } else {
69
+ utils.error('不支持extrudedHeight');
70
+ return;
71
+ }
72
+ var instance = new Cesium.GeometryInstance({
73
+ id: this.id,
74
+ geometry: geometry,
75
+ attributes: {
76
+ color: color
77
+ }
78
+ });
79
+ primitiveInstance.push(instance);
80
+ }
81
+ }]);
82
+ return PolygonGroundPrimitiveImageMaterialInstance;
83
+ }(PolygonPrimitiveInstance);
84
+ export { PolygonGroundPrimitiveImageMaterialInstance as default };
@@ -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 = ["materialAppearance"];
2
+ var _excluded = ["material"];
3
3
  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; }
4
4
  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; }
5
5
  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; }
@@ -34,13 +34,15 @@ var PolygonPrimitive = /*#__PURE__*/function (_BasePrimitive) {
34
34
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35
35
  var primitiveInstance = arguments.length > 1 ? arguments[1] : undefined;
36
36
  var _ref = options.style || {},
37
- materialAppearance = _ref.materialAppearance,
37
+ material = _ref.material,
38
38
  otherStyle = _objectWithoutProperties(_ref, _excluded);
39
39
  var style = merge(DEFAULT_POLYGON_PRIMITIVE_OPTIONS(), cloneDeep(otherStyle || {}));
40
40
  var primitiveOptions = merge(DEFAULT_PRIMITIVE_OPTIONS(), cloneDeep(options.primitive || {}));
41
41
  var appearance = {};
42
- if (materialAppearance) {
43
- appearance = materialAppearance.appearance;
42
+
43
+ // 自定义材质
44
+ if (material !== null && material !== void 0 && material.customMaterial) {
45
+ appearance = material.appearance;
44
46
  } else {
45
47
  appearance = new Cesium.PerInstanceColorAppearance({
46
48
  translucent: !!(style !== null && style !== void 0 && style.translucent)
@@ -0,0 +1,5 @@
1
+ import PolygonPrimitiveInstance from './PolygonPrimitiveInstance';
2
+ export default class PolygonPrimitiveImageMaterialInstance extends PolygonPrimitiveInstance {
3
+ constructor(options: any);
4
+ _init(options: any): void;
5
+ }
@@ -0,0 +1,81 @@
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 = ["color", "stRotation"];
3
+ 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; }
4
+ 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; }
5
+ 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; }
6
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ 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); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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); }
13
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
+ import * as Cesium from 'deeptwins-cesium';
21
+ import * as utils from "../tool/utils";
22
+ import PolygonPrimitiveInstance from "./PolygonPrimitiveInstance";
23
+
24
+ // polygon Primitive 图片材质贴图
25
+ var PolygonPrimitiveImageMaterialInstance = /*#__PURE__*/function (_PolygonPrimitiveInst) {
26
+ _inherits(PolygonPrimitiveImageMaterialInstance, _PolygonPrimitiveInst);
27
+ var _super = _createSuper(PolygonPrimitiveImageMaterialInstance);
28
+ function PolygonPrimitiveImageMaterialInstance(options) {
29
+ _classCallCheck(this, PolygonPrimitiveImageMaterialInstance);
30
+ return _super.call(this, options);
31
+ }
32
+
33
+ // 初始化
34
+ _createClass(PolygonPrimitiveImageMaterialInstance, [{
35
+ key: "_init",
36
+ value: function _init(options) {
37
+ var _options$style = options.style,
38
+ color = _options$style.color,
39
+ stRotation = _options$style.stRotation,
40
+ style = _objectWithoutProperties(_options$style, _excluded),
41
+ positions = options.positions,
42
+ holes = options.holes,
43
+ primitiveInstance = options.primitiveInstance;
44
+ var geometry = null;
45
+ var polygonGeometry = new Cesium.PolygonGeometry(_objectSpread({
46
+ polygonHierarchy: new Cesium.PolygonHierarchy(positions, holes.map(function (t) {
47
+ return new Cesium.PolygonHierarchy(t);
48
+ })),
49
+ vertexFormat: Cesium.VertexFormat.POSITION_AND_ST,
50
+ stRotation: stRotation
51
+ }, style));
52
+ if (!style.extrudedHeight) {
53
+ geometry = Cesium.PolygonGeometry.createGeometry(polygonGeometry);
54
+ var posAttr = geometry.attributes.position;
55
+ var vertexCount = posAttr.values.length / 3;
56
+ var finalPositions = [];
57
+ for (var i = 0; i < vertexCount; i++) {
58
+ finalPositions.push(new Cesium.Cartesian3(posAttr.values[i * 3], posAttr.values[i * 3 + 1], posAttr.values[i * 3 + 2]));
59
+ }
60
+ geometry.attributes.st = new Cesium.GeometryAttribute({
61
+ componentDatatype: Cesium.ComponentDatatype.FLOAT,
62
+ componentsPerAttribute: 2,
63
+ values: utils.computeSTAlongPlane(finalPositions, stRotation)
64
+ });
65
+ } else {
66
+ utils.error('不支持extrudedHeight');
67
+ return;
68
+ }
69
+ var instance = new Cesium.GeometryInstance({
70
+ id: this.id,
71
+ geometry: geometry,
72
+ attributes: {
73
+ color: color
74
+ }
75
+ });
76
+ primitiveInstance.push(instance);
77
+ }
78
+ }]);
79
+ return PolygonPrimitiveImageMaterialInstance;
80
+ }(PolygonPrimitiveInstance);
81
+ export { PolygonPrimitiveImageMaterialInstance as default };
@@ -2,6 +2,6 @@ import BasePrimitiveInstance from './BasePrimitiveInstance';
2
2
  export default class PolygonPrimitiveInstance extends BasePrimitiveInstance {
3
3
  constructor(options: any);
4
4
  static handleOptions(style: any): any;
5
- private _init;
5
+ _init(options: any): void;
6
6
  updateData(): void;
7
7
  }
@@ -1,6 +1,6 @@
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
2
  var _excluded = ["style"],
3
- _excluded2 = ["color", "stRotation", "materialAppearance", "vertexFormat"],
3
+ _excluded2 = ["color", "stRotation"],
4
4
  _excluded3 = ["color", "height", "stRotation"];
5
5
  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; }
6
6
  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; }
@@ -52,34 +52,19 @@ var PolygonPrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
52
52
  var _options$style = options.style,
53
53
  color = _options$style.color,
54
54
  stRotation = _options$style.stRotation,
55
- materialAppearance = _options$style.materialAppearance,
56
- vertexFormat = _options$style.vertexFormat,
57
55
  style = _objectWithoutProperties(_options$style, _excluded2),
58
56
  positions = options.positions,
59
57
  holes = options.holes,
60
58
  primitiveInstance = options.primitiveInstance;
61
- var currVertexFormat = vertexFormat || materialAppearance ? Cesium.VertexFormat.POSITION_AND_ST : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT;
62
- var geometry = null;
63
- var polygonGeometry = new Cesium.PolygonGeometry(_objectSpread({
64
- polygonHierarchy: new Cesium.PolygonHierarchy(positions, holes.map(function (t) {
65
- return new Cesium.PolygonHierarchy(t);
66
- })),
67
- vertexFormat: currVertexFormat,
68
- stRotation: stRotation
69
- }, style));
70
- if (materialAppearance && !style.extrudedHeight) {
71
- geometry = Cesium.PolygonGeometry.createGeometry(polygonGeometry);
72
- geometry.attributes.st = new Cesium.GeometryAttribute({
73
- componentDatatype: Cesium.ComponentDatatype.FLOAT,
74
- componentsPerAttribute: 2,
75
- values: utils.computeSTAlongPlane(positions, stRotation)
76
- });
77
- } else {
78
- geometry = polygonGeometry;
79
- }
80
59
  var instance = new Cesium.GeometryInstance({
81
60
  id: this.id,
82
- geometry: geometry,
61
+ geometry: new Cesium.PolygonGeometry(_objectSpread({
62
+ polygonHierarchy: new Cesium.PolygonHierarchy(positions, holes.map(function (t) {
63
+ return new Cesium.PolygonHierarchy(t);
64
+ })),
65
+ vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
66
+ stRotation: stRotation
67
+ }, style)),
83
68
  attributes: {
84
69
  color: color
85
70
  }
@@ -24,7 +24,7 @@ import { DEFAULT_POLYLINE_PRIMITIVE_OPTIONS } from "../constant";
24
24
  import * as utils from "../tool/utils";
25
25
  import BasePrimitiveInstance from "./BasePrimitiveInstance";
26
26
 
27
- // 线实体图层
27
+ // 线 primitive 实体图层
28
28
  var PolylineGroundPrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
29
29
  _inherits(PolylineGroundPrimitiveInstance, _BasePrimitiveInstanc);
30
30
  var _super = _createSuper(PolylineGroundPrimitiveInstance);
@@ -24,6 +24,7 @@ export declare class DeepTwinsEngine3D {
24
24
  static CircleWaveMaterialProperty: any;
25
25
  static PolylineTrailLinkMaterialProperty: any;
26
26
  static ImageMaterialProperty: any;
27
+ static ImageMaterialAppearance: any;
27
28
  static ImageGlowingMaterialAppearance: any;
28
29
  static VolumeCloud: any;
29
30
  static Heatmap2d: any;
@@ -31,7 +32,6 @@ export declare class DeepTwinsEngine3D {
31
32
  static PointCluster: any;
32
33
  static PositionProperty: any;
33
34
  static Frustum: any;
34
- static FrustumWithCamera: any;
35
35
  static GridDraw: any;
36
36
  static VideoTexture: any;
37
37
  static VideoProject: any;
@@ -70,5 +70,6 @@ export declare class DeepTwinsEngine3D {
70
70
  static PoiLayer: any;
71
71
  static FlightPlanning: any;
72
72
  static FlightRiskEvaluation: any;
73
+ static BuildClampedPolygonGrid: any;
73
74
  }
74
75
  export default DeepTwinsEngine3D;
package/dist/esm/index.js CHANGED
@@ -35,12 +35,14 @@ import ImageGlowingMaterialProperty from "./material/entity/ImageGlowingMaterial
35
35
  import ImageMaterialProperty from "./material/entity/ImageMaterialProperty";
36
36
  import PolylineTrailLinkMaterialProperty from "./material/entity/PolylineTrailLinkMaterialProperty";
37
37
  import ImageGlowingMaterialAppearance from "./material/primitive/ImageGlowingMaterialAppearance";
38
+ import ImageMaterialAppearance from "./material/primitive/ImageMaterialAppearance";
38
39
  import Measure from "./measure";
39
40
  import PositionProperty from "./property/PositionProperty";
40
41
  import ArcGisLayer from "./tileLayer/ArcGisLayer";
41
42
  import RasterLayer from "./tileLayer/RasterLayer";
42
43
  import WmsLayer from "./tileLayer/WmsLayer";
43
44
  import WmtsLayer from "./tileLayer/WmtsLayer";
45
+ import BuildClampedPolygonGrid from "./tool/BuildClampedPolygonGrid";
44
46
  import Compass from "./tool/Compass";
45
47
  import TimerInterval from "./tool/TimerInterval";
46
48
  import { ClampToGround, ShapeSection } from "./tool/common";
@@ -48,7 +50,6 @@ import { loadCss } from "./tool/utils";
48
50
  import VideoProject from "./videoFusion/VideoProject";
49
51
  import VideoTexture from "./videoFusion/VideoTexture";
50
52
  import Frustum from "./visualization/Frustum";
51
- import FrustumWithCamera from "./visualization/FrustumWithCamera";
52
53
  import Heatmap2d from "./visualization/Heatmap2d";
53
54
  import Heatmap3d from "./visualization/Heatmap3d";
54
55
  import PointCluster from "./visualization/PointCluster";
@@ -58,11 +59,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
58
59
  // 全局加载css
59
60
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
60
61
  // 打印版本信息
61
- console.log('DeepTwinsEngine3D Version:', "0.1.47");
62
+ console.log('DeepTwinsEngine3D Version:', "0.1.49");
62
63
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
63
64
  _classCallCheck(this, DeepTwinsEngine3D);
64
65
  });
65
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.47");
66
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.49");
66
67
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
67
68
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
68
69
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -86,6 +87,7 @@ _defineProperty(DeepTwinsEngine3D, "DynamicWallMaterialProperty", DynamicWallMat
86
87
  _defineProperty(DeepTwinsEngine3D, "CircleWaveMaterialProperty", CircleWaveMaterialProperty);
87
88
  _defineProperty(DeepTwinsEngine3D, "PolylineTrailLinkMaterialProperty", PolylineTrailLinkMaterialProperty);
88
89
  _defineProperty(DeepTwinsEngine3D, "ImageMaterialProperty", ImageMaterialProperty);
90
+ _defineProperty(DeepTwinsEngine3D, "ImageMaterialAppearance", ImageMaterialAppearance);
89
91
  _defineProperty(DeepTwinsEngine3D, "ImageGlowingMaterialAppearance", ImageGlowingMaterialAppearance);
90
92
  _defineProperty(DeepTwinsEngine3D, "VolumeCloud", VolumeCloud);
91
93
  _defineProperty(DeepTwinsEngine3D, "Heatmap2d", Heatmap2d);
@@ -93,7 +95,6 @@ _defineProperty(DeepTwinsEngine3D, "Heatmap3d", Heatmap3d);
93
95
  _defineProperty(DeepTwinsEngine3D, "PointCluster", PointCluster);
94
96
  _defineProperty(DeepTwinsEngine3D, "PositionProperty", PositionProperty);
95
97
  _defineProperty(DeepTwinsEngine3D, "Frustum", Frustum);
96
- _defineProperty(DeepTwinsEngine3D, "FrustumWithCamera", FrustumWithCamera);
97
98
  _defineProperty(DeepTwinsEngine3D, "GridDraw", GridDraw);
98
99
  _defineProperty(DeepTwinsEngine3D, "VideoTexture", VideoTexture);
99
100
  _defineProperty(DeepTwinsEngine3D, "VideoProject", VideoProject);
@@ -132,4 +133,5 @@ _defineProperty(DeepTwinsEngine3D, "VisitLayer", VisitLayer);
132
133
  _defineProperty(DeepTwinsEngine3D, "PoiLayer", PoiLayer);
133
134
  _defineProperty(DeepTwinsEngine3D, "FlightPlanning", FlightPlanning);
134
135
  _defineProperty(DeepTwinsEngine3D, "FlightRiskEvaluation", FlightRiskEvaluation);
136
+ _defineProperty(DeepTwinsEngine3D, "BuildClampedPolygonGrid", BuildClampedPolygonGrid);
135
137
  export default DeepTwinsEngine3D;
@@ -270,10 +270,10 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
270
270
  if (!deepTwins && !this._yunjing) {
271
271
  !isNil(show) && (this.scene.globe.show = show);
272
272
  !isNil(showGroundAtmosphere) && (this.scene.globe.showGroundAtmosphere = showGroundAtmosphere);
273
- !isNil(depthTestAgainstTerrain) && (this.scene.globe.depthTestAgainstTerrain = depthTestAgainstTerrain);
274
273
  !isNil(baseColor) && (this.scene.globe.baseColor = utils.colorString(baseColor));
275
274
  !isNil(enableLighting) && (this.scene.globe.enableLighting = enableLighting);
276
275
  }
276
+ !isNil(depthTestAgainstTerrain) && (this.scene.globe.depthTestAgainstTerrain = depthTestAgainstTerrain);
277
277
  }
278
278
 
279
279
  // 添加默认近地天空盒
@@ -1,4 +1,5 @@
1
1
  export default class BaseMaterialAppearance {
2
+ customMaterial: boolean;
2
3
  type: string;
3
4
  style: any;
4
5
  material: any;
@@ -9,6 +9,7 @@ import { v4 as uuidv4 } from 'uuid';
9
9
  var BaseMaterialAppearance = /*#__PURE__*/function () {
10
10
  function BaseMaterialAppearance(type, style) {
11
11
  _classCallCheck(this, BaseMaterialAppearance);
12
+ _defineProperty(this, "customMaterial", true);
12
13
  _defineProperty(this, "type", void 0);
13
14
  _defineProperty(this, "style", void 0);
14
15
  _defineProperty(this, "material", void 0);
@@ -0,0 +1,10 @@
1
+ import BaseMaterialAppearance from './BaseMaterialAppearance';
2
+ declare class ImageMaterialAppearance extends BaseMaterialAppearance {
3
+ private readonly currMaterial;
4
+ private readonly currAppearance;
5
+ constructor(material: any, appearance: any);
6
+ static handleMaterial(style: any): any;
7
+ private _createMaterial;
8
+ private _createAppearance;
9
+ }
10
+ export default ImageMaterialAppearance;