cesium_dev_kit 1.0.50 → 1.0.51

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.
@@ -1,92 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CustomCesiumPlugin = CustomCesiumPlugin;
7
- var _cesiumPlugin = require("./cesium-plugin");
8
- let Cesium = null;
9
- /**
10
- * 自定义插件
11
- * @param {*} viewer
12
- */
13
- function CustomCesiumPlugin(viewer, cesiumGlobal) {
14
- if (viewer) {
15
- this._viewer = viewer;
16
- Cesium = cesiumGlobal;
17
- new _cesiumPlugin.CesiumPlugin(Window, Cesium);
18
- this._customPluginLayer = new Cesium.CustomDataSource('_customPluginLayer');
19
- viewer && viewer.dataSources.add(this._customPluginLayer);
20
- }
21
- }
22
- CustomCesiumPlugin.prototype = {
23
- createRectangularSensorGraphics: function (options) {
24
- if (this._customPluginLayer && options) {
25
- let r = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(options.heading || 90), Cesium.Math.toRadians(options.pitch || 0), Cesium.Math.toRadians(options.roll || 0));
26
- let l = options.position;
27
- return this._customPluginLayer.entities.add({
28
- position: l,
29
- orientation: Cesium.Transforms.headingPitchRollQuaternion(l, r),
30
- rectangularSensor: new Cesium.Scene.RectangularSensorGraphics({
31
- radius: options.radius || 100000,
32
- xHalfAngle: Cesium.Math.toRadians(options.xHalfAngle || 45),
33
- yHalfAngle: Cesium.Math.toRadians(options.yHalfAngle || 45),
34
- material: options.material || new Cesium.Color(1.0, 0.0, 1.0, 0.4),
35
- lineColor: options.lineColor || new Cesium.Color(1.0, 0.0, 1.0, 1.0),
36
- showScanPlane: options.showScanPlane || true,
37
- scanPlaneColor: options.scanPlaneColor || new Cesium.Color(1.0, 0.0, 1.0, 1.0),
38
- scanPlaneMode: options.scanPlaneMode || 'vertical',
39
- scanPlaneRate: options.scanPlaneRate || 3,
40
- showThroughEllipsoid: options.showThroughEllipsoid || !1
41
- })
42
- });
43
- }
44
- },
45
- createSatelliteCoverageSimulationGraphics: function (options) {
46
- if (options) {
47
- return new Cesium.Scene.SatelliteCoverageSimulation(this._viewer, {
48
- position: options.position,
49
- angle1: options.angle1 || 30,
50
- angle2: options.angle2 || 45,
51
- areaType: options.areaType || 2,
52
- rotation: {
53
- heading: Cesium.Math.toRadians(options.heading || 0),
54
- pitch: Cesium.Math.toRadians(options.pitch || 0),
55
- roll: Cesium.Math.toRadians(options.roll || 0)
56
- },
57
- color: options.color || {
58
- red: 0.43137254901960786,
59
- green: 0.9607843137254902,
60
- blue: 0,
61
- alpha: 0.8
62
- }
63
- });
64
- }
65
- },
66
- createRadarPrimitive: function (options) {
67
- if (options) {
68
- return new Cesium.Scene.RadarPrimitive(this._viewer, {
69
- position: options.position,
70
- angle: options.angle || 90 - 10,
71
- radius: options.radius || 700000,
72
- rotation: {
73
- heading: Cesium.Math.toRadians(options.heading || 0),
74
- pitch: Cesium.Math.toRadians(options.pitch || 40),
75
- roll: Cesium.Math.toRadians(options.roll || 0)
76
- },
77
- color: options.color || {
78
- red: 1,
79
- green: 0,
80
- blue: 0,
81
- alpha: 0.4
82
- },
83
- lineColor: options.lineColor || {
84
- red: 1,
85
- green: 1,
86
- blue: 1,
87
- alpha: 0.9
88
- }
89
- });
90
- }
91
- }
92
- };
@@ -1,105 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * dom 工具
5
- * @param {*} viewer
6
- */
7
- function DomUtil() {}
8
- DomUtil.prototype = {
9
- /**
10
- * 创建dom元素
11
- * @param {*} tagName
12
- * @param {*} className
13
- * @param {*} container
14
- */
15
- createDom: function (tagName, className, container) {
16
- var el = document.createElement(tagName);
17
- el.className = className || '';
18
- if (container) {
19
- container.appendChild(el);
20
- }
21
- return el;
22
- },
23
- //删除 element
24
- removeDom: function (el) {
25
- var parent = el.parentNode;
26
- if (parent) {
27
- parent.removeChild(el);
28
- }
29
- },
30
- //清空 element
31
- emptyDom: function (el) {
32
- while (el.firstChild) {
33
- el.removeChild(el.firstChild);
34
- }
35
- },
36
- //添加 class
37
- addDomClass: function (el, name) {
38
- if (el.classList !== undefined) {
39
- var classes = this.splitWords(name);
40
- for (var i = 0, len = classes.length; i < len; i++) {
41
- el.classList.add(classes[i]);
42
- }
43
- } else if (!this.hasClass(el, name)) {
44
- var className = this.getClass(el);
45
- this.setClass(el, (className ? className + ' ' : '') + name);
46
- }
47
- },
48
- //删除class
49
- removeDomClass: function (el, name) {
50
- if (el.classList !== undefined) {
51
- el.classList.remove(name);
52
- } else {
53
- this.setClass(el, this.trim((' ' + this.getClass(el) + ' ').replace(' ' + name + ' ', ' ')));
54
- }
55
- },
56
- //设置 class
57
- setDomClass: function (el, name) {
58
- if (el.className.baseVal === undefined) {
59
- el.className = name;
60
- } else {
61
- // in case of SVG element
62
- el.className.baseVal = name;
63
- }
64
- },
65
- //获取 el class
66
- getDomClass: function (el) {
67
- // Check if the element is an SVGElementInstance and use the correspondingElement instead
68
- // (Required for linked SVG elements in IE11.)
69
- if (el.correspondingElement) {
70
- el = el.correspondingElement;
71
- }
72
- return el.className.baseVal === undefined ? el.className : el.className.baseVal;
73
- },
74
- //创建 svg
75
- createDomSvg: function (width, height, path, container) {
76
- var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg:svg');
77
- svg.setAttribute('class', 'svg-path');
78
- svg.setAttribute('width', width);
79
- svg.setAttribute('height', height);
80
- svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
81
- var pathEl = document.createElementNS('http://www.w3.org/2000/svg', 'path');
82
- pathEl.setAttribute('d', path);
83
- svg.appendChild(pathEl);
84
- if (container) {
85
- container.appendChild(svg);
86
- }
87
- return svg;
88
- },
89
- //生成uuid
90
- createUUID: function (prefix) {
91
- prefix = prefix || 'D';
92
- const CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
93
- let uuid = [];
94
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
95
- uuid[14] = '4';
96
- let r;
97
- for (let i = 0; i < 36; i++) {
98
- if (!uuid[i]) {
99
- r = 0 | Math.random() * 16;
100
- uuid[i] = CHARS[i == 19 ? r & 0x3 | 0x8 : r];
101
- }
102
- }
103
- return prefix + '-' + uuid.join('');
104
- }
105
- };