cesium_dev_kit 1.0.48 → 1.0.50
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.
- package/.babelrc +13 -0
- package/dist/ColorDeal.js +59 -0
- package/dist/common.js +40 -0
- package/dist/index.js +23 -13561
- package/dist/initConf.js +188 -0
- package/dist/libs/Analysis.js +779 -0
- package/dist/libs/Base.js +950 -0
- package/dist/libs/ChartLayer.js +24 -0
- package/dist/libs/Control.js +947 -0
- package/dist/libs/CustomCesiumPlugin.js +92 -0
- package/dist/libs/DomUtil.js +105 -0
- package/dist/libs/Draw.js +704 -0
- package/dist/libs/Graphics.js +734 -0
- package/dist/libs/MapvLayer.js +26 -0
- package/dist/libs/Material.js +590 -0
- package/dist/libs/Math2d.js +559 -0
- package/dist/libs/Math3d.js +646 -0
- package/dist/libs/PassEffect.js +154 -0
- package/dist/libs/Plugin.js +751 -0
- package/dist/libs/Primitive.js +1559 -0
- package/dist/libs/Shaders.js +298 -0
- package/dist/libs/ThreeJs.js +190 -0
- package/dist/libs/cesium-plugin.js +3387 -0
- package/dist/libs/index.js +117 -0
- package/dist/libs/plot/AttackArrow.js +266 -0
- package/dist/libs/plot/BasePlot.js +41 -0
- package/dist/libs/plot/PincerArrow.js +278 -0
- package/dist/libs/plot/StraightArrow.js +244 -0
- package/dist/libs/plot/algorithm.js +315 -0
- package/dist/libs/plot/index.js +19 -0
- package/dist/libs/plot/plotUtil.js +242 -0
- package/index.js +1 -1
- package/package.json +5 -12
- package/dist/index.min.js +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PassEffect = PassEffect;
|
|
7
|
+
let Cesium = null;
|
|
8
|
+
/**
|
|
9
|
+
* 后期效果模块
|
|
10
|
+
* @param {*} viewer
|
|
11
|
+
*/
|
|
12
|
+
function PassEffect(viewer, cesiumGlobal) {
|
|
13
|
+
if (viewer) {
|
|
14
|
+
this._viewer = viewer;
|
|
15
|
+
Cesium = cesiumGlobal;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
PassEffect.prototype = {
|
|
19
|
+
// 圆形扩散效果 自定义
|
|
20
|
+
setCircleScanEffect: function (options) {
|
|
21
|
+
if (options && options.position) {
|
|
22
|
+
var id = options.id || 'CircleScan' + parseInt(Math.random() * 1000),
|
|
23
|
+
cartesian = options.position,
|
|
24
|
+
radius = options.radius,
|
|
25
|
+
color = options.color || Cesium.Color.RED,
|
|
26
|
+
duration = options.duration || 1500,
|
|
27
|
+
$this = this,
|
|
28
|
+
circleMode = options.circleMode || 'CircleScan',
|
|
29
|
+
border = options.border || 4.0;
|
|
30
|
+
var cartesian3Center = cartesian;
|
|
31
|
+
var cartesian4Center = new Cesium.Cartesian4(cartesian3Center.x, cartesian3Center.y, cartesian3Center.z, 1);
|
|
32
|
+
var position = this.transformCartesianToWGS84(cartesian);
|
|
33
|
+
var cartesian3Center1 = this.transformWGS84ToCartesian({
|
|
34
|
+
lng: position.lng,
|
|
35
|
+
lat: position.lat,
|
|
36
|
+
alt: position.alt + 500
|
|
37
|
+
});
|
|
38
|
+
var cartesian4Center1 = new Cesium.Cartesian4(cartesian3Center1.x, cartesian3Center1.y, cartesian3Center1.z, 1);
|
|
39
|
+
var _time = new Date().getTime();
|
|
40
|
+
var _delegate = new Cesium.PostProcessStage({
|
|
41
|
+
name: id,
|
|
42
|
+
fragmentShader: this._getCircleScanShader({
|
|
43
|
+
get: true,
|
|
44
|
+
border: border
|
|
45
|
+
}),
|
|
46
|
+
uniforms: {
|
|
47
|
+
u_scanCenterEC: function () {
|
|
48
|
+
return Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center, new Cesium.Cartesian4());
|
|
49
|
+
},
|
|
50
|
+
u_scanPlaneNormalEC: function () {
|
|
51
|
+
var temp = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center, new Cesium.Cartesian4());
|
|
52
|
+
var temp1 = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center1, new Cesium.Cartesian4());
|
|
53
|
+
var _scratchCartesian3Normal = new Cesium.Cartesian3();
|
|
54
|
+
_scratchCartesian3Normal.x = temp1.x - temp.x;
|
|
55
|
+
_scratchCartesian3Normal.y = temp1.y - temp.y;
|
|
56
|
+
_scratchCartesian3Normal.z = temp1.z - temp.z;
|
|
57
|
+
Cesium.Cartesian3.normalize(_scratchCartesian3Normal, _scratchCartesian3Normal);
|
|
58
|
+
return _scratchCartesian3Normal;
|
|
59
|
+
},
|
|
60
|
+
u_radius: function () {
|
|
61
|
+
if (circleMode == 'CircleScan') {
|
|
62
|
+
return radius * ((new Date().getTime() - _time) % duration) / duration;
|
|
63
|
+
} else {
|
|
64
|
+
return radius;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
u_scanColor: color
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
this._viewer.scene.postProcessStages.add(_delegate);
|
|
71
|
+
return _delegate;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// 雷达扫描 自定义
|
|
75
|
+
setRadarScanEffect: function (options) {
|
|
76
|
+
if (options && options.position) {
|
|
77
|
+
var id = options.id || 'radarScan' + parseInt(Math.random() * 1000),
|
|
78
|
+
cartesian = options.position,
|
|
79
|
+
radius = options.radius,
|
|
80
|
+
color = options.color || Cesium.Color.RED,
|
|
81
|
+
duration = options.duration || 1500,
|
|
82
|
+
$this = this,
|
|
83
|
+
border = options.border || 1,
|
|
84
|
+
width = options.width || 3.0;
|
|
85
|
+
var cartesian3Center = cartesian;
|
|
86
|
+
var cartesian4Center = new Cesium.Cartesian4(cartesian3Center.x, cartesian3Center.y, cartesian3Center.z, 1);
|
|
87
|
+
var position = this.transformCartesianToWGS84(cartesian);
|
|
88
|
+
var cartesian3Center1 = this.transformWGS84ToCartesian({
|
|
89
|
+
lng: position.lng,
|
|
90
|
+
lat: position.lat,
|
|
91
|
+
alt: position.alt + 500
|
|
92
|
+
});
|
|
93
|
+
var cartesian4Center1 = new Cesium.Cartesian4(cartesian3Center1.x, cartesian3Center1.y, cartesian3Center1.z, 1);
|
|
94
|
+
var cartesian3Center2 = this.transformWGS84ToCartesian({
|
|
95
|
+
lng: position.lng + 0.001,
|
|
96
|
+
lat: position.lat,
|
|
97
|
+
alt: position.alt
|
|
98
|
+
});
|
|
99
|
+
var cartesian4Center2 = new Cesium.Cartesian4(cartesian3Center2.x, cartesian3Center2.y, cartesian3Center2.z, 1);
|
|
100
|
+
var _time = new Date().getTime();
|
|
101
|
+
var _RotateQ = new Cesium.Quaternion();
|
|
102
|
+
var _RotateM = new Cesium.Matrix3();
|
|
103
|
+
var _scratchCartesian4Center = new Cesium.Cartesian4();
|
|
104
|
+
var _scratchCartesian4Center1 = new Cesium.Cartesian4();
|
|
105
|
+
var _scratchCartesian4Center2 = new Cesium.Cartesian4();
|
|
106
|
+
var _scratchCartesian3Normal = new Cesium.Cartesian3();
|
|
107
|
+
var _scratchCartesian3Normal1 = new Cesium.Cartesian3();
|
|
108
|
+
var _delegate = new Cesium.PostProcessStage({
|
|
109
|
+
name: id,
|
|
110
|
+
fragmentShader: this._getRadarScanShader({
|
|
111
|
+
border: border,
|
|
112
|
+
width: width,
|
|
113
|
+
get: true
|
|
114
|
+
}),
|
|
115
|
+
uniforms: {
|
|
116
|
+
u_scanCenterEC: function () {
|
|
117
|
+
return Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center, _scratchCartesian4Center);
|
|
118
|
+
},
|
|
119
|
+
u_scanPlaneNormalEC: function () {
|
|
120
|
+
var temp = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center, _scratchCartesian4Center);
|
|
121
|
+
var temp1 = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center1, _scratchCartesian4Center1);
|
|
122
|
+
_scratchCartesian3Normal.x = temp1.x - temp.x;
|
|
123
|
+
_scratchCartesian3Normal.y = temp1.y - temp.y;
|
|
124
|
+
_scratchCartesian3Normal.z = temp1.z - temp.z;
|
|
125
|
+
Cesium.Cartesian3.normalize(_scratchCartesian3Normal, _scratchCartesian3Normal);
|
|
126
|
+
return _scratchCartesian3Normal;
|
|
127
|
+
},
|
|
128
|
+
u_scanLineNormalEC: function () {
|
|
129
|
+
var temp = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center, _scratchCartesian4Center);
|
|
130
|
+
var temp1 = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center1, _scratchCartesian4Center1);
|
|
131
|
+
var temp2 = Cesium.Matrix4.multiplyByVector($this._viewer.camera._viewMatrix, cartesian4Center2, _scratchCartesian4Center2);
|
|
132
|
+
_scratchCartesian3Normal.x = temp1.x - temp.x;
|
|
133
|
+
_scratchCartesian3Normal.y = temp1.y - temp.y;
|
|
134
|
+
_scratchCartesian3Normal.z = temp1.z - temp.z;
|
|
135
|
+
Cesium.Cartesian3.normalize(_scratchCartesian3Normal, _scratchCartesian3Normal);
|
|
136
|
+
_scratchCartesian3Normal1.x = temp2.x - temp.x;
|
|
137
|
+
_scratchCartesian3Normal1.y = temp2.y - temp.y;
|
|
138
|
+
_scratchCartesian3Normal1.z = temp2.z - temp.z;
|
|
139
|
+
var tempTime = (new Date().getTime() - _time) % duration / duration;
|
|
140
|
+
Cesium.Quaternion.fromAxisAngle(_scratchCartesian3Normal, tempTime * Cesium.Math.PI * 2, _RotateQ);
|
|
141
|
+
Cesium.Matrix3.fromQuaternion(_RotateQ, _RotateM);
|
|
142
|
+
Cesium.Matrix3.multiplyByVector(_RotateM, _scratchCartesian3Normal1, _scratchCartesian3Normal1);
|
|
143
|
+
Cesium.Cartesian3.normalize(_scratchCartesian3Normal1, _scratchCartesian3Normal1);
|
|
144
|
+
return _scratchCartesian3Normal1;
|
|
145
|
+
},
|
|
146
|
+
u_radius: radius,
|
|
147
|
+
u_scanColor: color
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
this._viewer.scene.postProcessStages.add(_delegate);
|
|
151
|
+
return _delegate;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|