cesium_dev_kit 1.0.57 → 1.0.58

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/dist/index.js CHANGED
@@ -54,7 +54,7 @@ class Controller {
54
54
  init({
55
55
  containerId,
56
56
  viewerConfig,
57
- extreaConfig,
57
+ extraConfig,
58
58
  MapImageryList
59
59
  }) {
60
60
  const mapID = containerId;
@@ -103,13 +103,13 @@ class Controller {
103
103
 
104
104
  vConfig = Object.assign(vConfig, viewerConfig); // 后台接口配置 融合替换 默认配置
105
105
  const viewer = new Cesium$1.Viewer(mapID, vConfig);
106
- if (!extreaConfig['logo']) {
106
+ if (!extraConfig['logo']) {
107
107
  const cC = viewer.cesiumWidget.creditContainer;
108
108
  cC.style.display = 'none'; // 影藏logo
109
109
  }
110
110
 
111
111
  // 是否开启深度参数
112
- if (extreaConfig['depthTest']) {
112
+ if (extraConfig['depthTest']) {
113
113
  // 设置开启深度检测
114
114
  viewer.scene.globe.depthTestAgainstTerrain = true;
115
115
  }
@@ -3249,7 +3249,7 @@ Math3d.prototype = {
3249
3249
  result.push(ellipsoid.cartesianToCartographic(updatedPositions[j]));
3250
3250
  }
3251
3251
  callback(result);
3252
- }).otherwise(function (error) {
3252
+ }).catch(function (error) {
3253
3253
  console.log(error);
3254
3254
  });
3255
3255
  }
@@ -3484,6 +3484,7 @@ Primitive.prototype = {
3484
3484
  Pass = Cesium$6.Pass,
3485
3485
  Appearance = Cesium$6.Appearance,
3486
3486
  BufferUsage = Cesium$6.BufferUsage,
3487
+ VertexLayout = Cesium$6.VertexLayout,
3487
3488
  Color = Cesium$6.Color,
3488
3489
  VertexArray = Cesium$6.VertexArray,
3489
3490
  buildModuleUrl = Cesium$6.buildModuleUrl,
@@ -3510,7 +3511,7 @@ Primitive.prototype = {
3510
3511
  this._color = defaultValue(options.color, new Color(1.0, 1.0, 0.0, 0.8));
3511
3512
  this._scale = defaultValue(options.scale, new Cartesian3(10, 10, 15));
3512
3513
  this._texture = undefined;
3513
- this._imageUrl = buildModuleUrl(defaultStatic);
3514
+ this._imageUrl = defaultStatic;
3514
3515
  this._modelMatrix = computeModelMatrix(this);
3515
3516
  this._height = computeHeight(this);
3516
3517
  createTexture(this);
@@ -3709,7 +3710,7 @@ Primitive.prototype = {
3709
3710
 
3710
3711
  //创建顶点着色器
3711
3712
  const creaateVertexShader = function () {
3712
- var vertexShader = `
3713
+ var vertexShader = `#version 300 es
3713
3714
  in vec3 position;
3714
3715
  in vec3 normal;
3715
3716
  in vec2 st;
@@ -3720,10 +3721,10 @@ Primitive.prototype = {
3720
3721
  out vec4 v_pickColor;
3721
3722
  void main()
3722
3723
  {
3723
- v_positionEC = (czm_modelView * vec4(position, 1.0)).xyz; // position in eye coordinates
3724
- v_normalEC = czm_normal * normal; // normal in eye coordinates
3724
+ v_positionEC = (czm_modelView * vec4(position, 1.0)).xyz;
3725
+ v_normalEC = czm_normal * normal;
3725
3726
  v_st = st;
3726
- //v_pickColor = czm_batchTable_pickColor(batchId);
3727
+ // v_pickColor = czm_batchTable_pickColor(batchId);
3727
3728
  gl_Position = czm_modelViewProjection * vec4(position, 1.0);
3728
3729
  }
3729
3730
  `;
@@ -3732,14 +3733,14 @@ Primitive.prototype = {
3732
3733
 
3733
3734
  //创建片源着色器
3734
3735
  const createFragmentShader = function () {
3735
- var fragmentShader = `
3736
- in vec3 v_positionEC;
3737
- in vec3 v_normalEC;
3738
- in vec2 v_st;
3739
- out vec4 myOutputColor;
3740
- uniform vec4 color;
3741
- in vec4 v_pickColor;
3742
- uniform sampler2D myImage;
3736
+ var fragmentShader = `#version 300 es
3737
+ in vec3 v_positionEC;
3738
+ in vec3 v_normalEC;
3739
+ in vec2 v_st;
3740
+ layout(location=2) out vec4 my_fragColor;
3741
+ uniform vec4 color;
3742
+ in vec4 v_pickColor;
3743
+ uniform sampler2D myImage;
3743
3744
  void main()
3744
3745
  {
3745
3746
  vec3 positionToEyeEC = -v_positionEC;
@@ -3757,12 +3758,12 @@ Primitive.prototype = {
3757
3758
  float dt_a12 = sin(dt_a11);
3758
3759
  float vst=smoothstep(0.7, 1.0, dt_a12)+0.4;
3759
3760
  vec4 colorImage = texture(myImage, vec2(fract(st.s- czm_frameNumber*0.003), st.t));
3760
- material.alpha =mix(0.1,1.0,clamp((1.0-st.t) * color.a,0.0,1.0)) +(1.0-sign(st.t-czm_frameNumber*0.001))*0.2*(1.0-colorImage.r)+0.4 ;
3761
+ material.alpha =mix(0.1,1.0,clamp((1.0-st.t) * color.a,0.0,1.0)) +(1.0-sign(st.t-czm_frameNumber*0.001))*0.2*(1.0-colorImage.r)+0.4;
3761
3762
  material.diffuse =(1.0-colorImage.a)*vec3(1.0,2.0,1.0)+colorImage.rgb*vec3(1.0,2.0,1.0);
3762
3763
  #ifdef FLAT
3763
- myOutputColor = vec4(material.diffuse + material.emission, material.alpha);
3764
+ my_fragColor = vec4(material.diffuse + material.emission, material.alpha);
3764
3765
  #else
3765
- myOutputColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
3766
+ my_fragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
3766
3767
  #endif
3767
3768
  }
3768
3769
  `;
@@ -3828,10 +3829,10 @@ Primitive.prototype = {
3828
3829
  this._handler = new Cesium$6.ScreenSpaceEventHandler(this._viewer.scene.canvas);
3829
3830
  this._xyzState = false;
3830
3831
  this._xyzPid = undefined;
3831
- this._build();
3832
+ this._builds();
3832
3833
  }
3833
3834
  XyzAxisPrimitive.prototype = {
3834
- _build() {
3835
+ _builds() {
3835
3836
  this._createAxisXYZ();
3836
3837
  this._bindHandler();
3837
3838
  },
@@ -4475,7 +4476,7 @@ Primitive.prototype = {
4475
4476
  }));
4476
4477
  },
4477
4478
  getVSPolylie: function () {
4478
- return 'in vec3 position3DHigh;\
4479
+ return 'in vec3 position3DHigh; \
4479
4480
  in vec3 position3DLow;\
4480
4481
  in vec4 color;\
4481
4482
  out vec4 v_color;\
@@ -4491,8 +4492,8 @@ Primitive.prototype = {
4491
4492
  ';
4492
4493
  },
4493
4494
  getFSPolyline: function () {
4494
- return 'in vec4 v_color;\
4495
- out vec4 myOutputColor;\
4495
+ return 'in vec4 v_color; \
4496
+ layout(location=2) out vec4 myOutputColor;\
4496
4497
  void main()\
4497
4498
  {\
4498
4499
  float d = distance(gl_PointCoord, vec2(0.5,0.5));\
@@ -13566,6 +13567,665 @@ function getCatesian3FromPX$2(px, viewer) {
13566
13567
  return cartesian;
13567
13568
  }
13568
13569
 
13570
+ let Cesium$i = null;
13571
+ /**
13572
+ * 外部插件模块
13573
+ * @param {*} viewer
13574
+ */
13575
+ function RadarPlugin(viewer, cesiumGlobal, defaultStatic) {
13576
+ if (viewer) {
13577
+ this._viewer = viewer;
13578
+ Cesium$i = cesiumGlobal;
13579
+ this._installPlugin();
13580
+ }
13581
+ }
13582
+ RadarPlugin.prototype = {
13583
+ // 安装插件
13584
+ _installPlugin: function () {
13585
+ this._installCounputeVertex();
13586
+ this._installCylinderGeometry();
13587
+ this._installRadarPrimitive();
13588
+ },
13589
+ _installCylinderGeometry: function () {
13590
+ function n(t) {
13591
+ this.length = t.length, this.topRadius = t.topRadius, this.bottomRadius = t.bottomRadius, this.slices = t.slices ? t.slices : 64, this.zReverse = t.zReverse;
13592
+ }
13593
+ var s = new Cesium$i.Cartesian2(),
13594
+ u = new Cesium$i.Cartesian3(),
13595
+ l = new Cesium$i.Ray();
13596
+ n._createGeometry = function (t) {
13597
+ var e = t.length,
13598
+ i = t.topRadius,
13599
+ n = t.bottomRadius,
13600
+ r = t.slices,
13601
+ a = 2 * Math.PI / (r - 1),
13602
+ u = t.zReverse,
13603
+ l = [],
13604
+ h = [],
13605
+ d = [],
13606
+ m = [],
13607
+ f = [n, i],
13608
+ p = [0, u ? -e : e],
13609
+ c = 0,
13610
+ _ = Math.atan2(n - i, e),
13611
+ g = s;
13612
+ g.z = Math.sin(_);
13613
+ for (var v = Math.cos(_), y = 0; y < p.length; y++) {
13614
+ m[y] = [];
13615
+ for (var C = f[y], w = 0; w < r; w++) {
13616
+ m[y].push(c++);
13617
+ var x = a * w,
13618
+ A = C * Math.cos(x),
13619
+ b = C * Math.sin(x);
13620
+ l.push(A, b, p[y]), A = v * Math.cos(x), b = v * Math.sin(x), h.push(A, b, g.z), d.push(y / (p.length - 1), 0);
13621
+ }
13622
+ }
13623
+ for (var M = [], y = 1; y < p.length; y++) for (var w = 1; w < r; w++) {
13624
+ var P = m[y - 1][w - 1],
13625
+ S = m[y][w - 1],
13626
+ F = m[y][w],
13627
+ E = m[y - 1][w];
13628
+ M.push(F), M.push(E), M.push(P), M.push(F), M.push(P), M.push(S), w == m[y].length - 1 && (P = m[y - 1][w], S = m[y][w], F = m[y][0], E = m[y - 1][0], M.push(F), M.push(E), M.push(P), M.push(F), M.push(P), M.push(S));
13629
+ }
13630
+ M = new Int16Array(M), l = new Float32Array(l), h = new Float32Array(h), d = new Float32Array(d);
13631
+ var T = {
13632
+ position: new Cesium$i.GeometryAttribute({
13633
+ componentDatatype: Cesium$i.ComponentDatatype.DOUBLE,
13634
+ componentsPerAttribute: 3,
13635
+ values: l
13636
+ }),
13637
+ normal: new Cesium$i.GeometryAttribute({
13638
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
13639
+ componentsPerAttribute: 3,
13640
+ values: h
13641
+ }),
13642
+ st: new Cesium$i.GeometryAttribute({
13643
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
13644
+ componentsPerAttribute: 2,
13645
+ values: d
13646
+ })
13647
+ },
13648
+ R = Cesium$i.BoundingSphere.fromVertices(l),
13649
+ G = new Cesium$i.Geometry({
13650
+ attributes: T,
13651
+ indices: M,
13652
+ primitiveType: Cesium$i.PrimitiveType.TRIANGLES,
13653
+ boundingSphere: R
13654
+ });
13655
+ return l = [], M = [], d = [], G;
13656
+ };
13657
+ n.createGeometry = function (t, e) {
13658
+ if (!e) return n._createGeometry(t);
13659
+ Cesium$i.Matrix4.multiplyByPoint(e, Cesium$i.Cartesian3.ZERO, u), u.clone(l.origin);
13660
+ var i = t.length,
13661
+ r = t.topRadius,
13662
+ s = (t.bottomRadius, t.slices),
13663
+ h = 2 * Math.PI / (s - 1),
13664
+ d = t.zReverse,
13665
+ m = [],
13666
+ f = [],
13667
+ p = [],
13668
+ c = [],
13669
+ _ = [0, d ? -i : i],
13670
+ g = 0,
13671
+ g = 0;
13672
+ m.push(0, 0, 0), f.push(1, 1), g++;
13673
+ for (var v = new Cesium$i.Cartesian3(), y = r / 15, C = 0; C < 16; C++) {
13674
+ for (var w = y * C, x = [], A = 0; A < s; A++) {
13675
+ var b = h * A,
13676
+ M = w * Math.cos(b),
13677
+ P = w * Math.sin(b);
13678
+ v.x = M, v.y = P, v.z = _[1];
13679
+ var S = (0, Cesium$i.Scene.extend2Earth)(v, e, l);
13680
+ S ? (x.push(g), m.push(M, P, _[1]), f.push(C / 15, 1), g++) : (S = u, x.push(-1));
13681
+ }
13682
+ c.push(x);
13683
+ }
13684
+ for (var F, E, T = [0, c.length - 1], R = 0; R < T.length; R++) for (var C = T[R], A = 1; A < c[C].length; A++) F = c[C][A - 1], E = c[C][A], F >= 0 && E >= 0 && p.push(0, F, E);
13685
+ m = new Float32Array(m), p = new Int32Array(p), f = new Float32Array(f);
13686
+ var G = {
13687
+ position: new Cesium$i.GeometryAttribute({
13688
+ componentDatatype: Cesium$i.ComponentDatatype.DOUBLE,
13689
+ componentsPerAttribute: 3,
13690
+ values: m
13691
+ }),
13692
+ st: new Cesium$i.GeometryAttribute({
13693
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
13694
+ componentsPerAttribute: 2,
13695
+ values: f
13696
+ })
13697
+ },
13698
+ V = Cesium$i.BoundingSphere.fromVertices(m),
13699
+ D = new Cesium$i.Geometry({
13700
+ attributes: G,
13701
+ indices: p,
13702
+ primitiveType: Cesium$i.PrimitiveType.TRIANGLES,
13703
+ boundingSphere: V
13704
+ });
13705
+ return (0, Cesium$i.Scene.computeVertexNormals)(D), m = [], p = [], D;
13706
+ };
13707
+ n.createOutlineGeometry = function (t) {
13708
+ var e = t.length,
13709
+ i = t.topRadius,
13710
+ n = t.bottomRadius,
13711
+ r = t.slices,
13712
+ a = 2 * Math.PI / (r - 1),
13713
+ u = t.zReverse,
13714
+ l = [],
13715
+ h = [],
13716
+ d = [],
13717
+ m = [],
13718
+ f = [n, i],
13719
+ p = [0, u ? -e : e],
13720
+ c = 0,
13721
+ _ = Math.atan2(n - i, e),
13722
+ g = s;
13723
+ g.z = Math.sin(_);
13724
+ for (var v = Math.cos(_), y = 0; y < p.length; y++) {
13725
+ m[y] = [];
13726
+ for (var C = f[y], w = 0; w < r; w++) {
13727
+ m[y].push(c++);
13728
+ var x = a * w,
13729
+ A = C * Math.cos(x),
13730
+ b = C * Math.sin(x);
13731
+ l.push(A, b, p[y]), A = v * Math.cos(x), b = v * Math.sin(x), h.push(A, b, g.z), d.push(y / (p.length - 1), 0);
13732
+ }
13733
+ }
13734
+ for (var M = [], y = 1; y < p.length; y++) for (var w = 1; w < r; w += 1) {
13735
+ var P = m[y - 1][w - 1],
13736
+ S = m[y][w - 1];
13737
+ m[y][w], m[y - 1][w];
13738
+ w % 8 == 1 && M.push(P, S);
13739
+ }
13740
+ M = new Int16Array(M), l = new Float32Array(l), h = new Float32Array(h), d = new Float32Array(d);
13741
+ var F = {
13742
+ position: new Cesium$i.GeometryAttribute({
13743
+ componentDatatype: Cesium$i.ComponentDatatype.DOUBLE,
13744
+ componentsPerAttribute: 3,
13745
+ values: l
13746
+ }),
13747
+ normal: new Cesium$i.GeometryAttribute({
13748
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
13749
+ componentsPerAttribute: 3,
13750
+ values: h
13751
+ }),
13752
+ st: new Cesium$i.GeometryAttribute({
13753
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
13754
+ componentsPerAttribute: 2,
13755
+ values: d
13756
+ })
13757
+ },
13758
+ E = Cesium$i.BoundingSphere.fromVertices(l),
13759
+ T = new Cesium$i.Geometry({
13760
+ attributes: F,
13761
+ indices: M,
13762
+ primitiveType: Cesium$i.PrimitiveType.LINES,
13763
+ boundingSphere: E
13764
+ });
13765
+ return l = [], M = [], d = [], T;
13766
+ };
13767
+ n.fromAngleAndLength = function (t, e, i) {
13768
+ return t = Cesium$i.Math.toRadians(t), new n({
13769
+ topRadius: Math.tan(t) * e / 2,
13770
+ bottomRadius: 0,
13771
+ length: e,
13772
+ zReverse: i
13773
+ });
13774
+ };
13775
+ Cesium$i.Scene.CylinderGeometry = n;
13776
+ },
13777
+ /**
13778
+ * 相控雷达
13779
+ */
13780
+ _installRadarPrimitive: function () {
13781
+ var r;
13782
+ function n(t, e) {
13783
+ e = e || {}, r = t.scene.globe.ellipsoid, this._geometry = null, this._angle = e.angle, this._radius = e.radius ? e.radius : 5, this._position = e.position, this._rotation = e.rotation ? e.rotation : {
13784
+ heading: 0,
13785
+ pitch: 0,
13786
+ roll: 0
13787
+ }, this._trackedEntity = e.trackedEntity, this.defaultColor = e.color ? e.color : Cesium$i.Color.YELLOW, this.defaultLineColor = e.lineColor ? e.lineColor : this.defaultColor, this._show = Cesium$i.defaultValue(e.show, !0), this._outline = Cesium$i.defaultValue(e.outline, !1), this._topShow = Cesium$i.defaultValue(e.top, !0), this._topOutline = Cesium$i.defaultValue(e.topOutline, !0), this._modelMatrix = Cesium$i.Matrix4.clone(Cesium$i.Matrix4.IDENTITY), this._quaternion = new Cesium$i.Quaternion(), this._translation = new Cesium$i.Cartesian3(), this._scale = new Cesium$i.Cartesian3(1, 1, 1), this._matrix = new Cesium$i.Matrix4(), this._inverseMatrix = new Cesium$i.Matrix4(), this._positionCartographic = new Cesium$i.Cartographic(), this._positionCartesian = null, this._drawCommands = [], this._outlinePositions = [], this.viewer = t, this.viewer.scene.primitives.add(this), this.updateGeometry(), this._groundArea = Cesium$i.defaultValue(e.groundArea, !1), this.addGroundAreaEntity(this._groundArea);
13788
+ }
13789
+ Object.defineProperties(n.prototype, {
13790
+ trackedEntity: {
13791
+ get: function () {
13792
+ return this._trackedEntity;
13793
+ },
13794
+ set: function (t) {
13795
+ this._trackedEntity = t;
13796
+ }
13797
+ },
13798
+ color: {
13799
+ get: function () {
13800
+ return this.defaultColor;
13801
+ },
13802
+ set: function (t) {
13803
+ this.defaultColor = t;
13804
+ }
13805
+ },
13806
+ lineColor: {
13807
+ get: function () {
13808
+ return this.defaultLineColor;
13809
+ },
13810
+ set: function (t) {
13811
+ this.defaultLineColor = t;
13812
+ }
13813
+ },
13814
+ show: {
13815
+ get: function () {
13816
+ return this._show;
13817
+ },
13818
+ set: function (t) {
13819
+ this._show = t;
13820
+ }
13821
+ },
13822
+ outline: {
13823
+ get: function () {
13824
+ return this._outline;
13825
+ },
13826
+ set: function (t) {
13827
+ this._outline = t, this.updateGeometry();
13828
+ }
13829
+ },
13830
+ top: {
13831
+ get: function () {
13832
+ return this._topShow;
13833
+ },
13834
+ set: function (t) {
13835
+ this._topShow = t, this.updateGeometry();
13836
+ }
13837
+ },
13838
+ topOutline: {
13839
+ get: function () {
13840
+ return this._topOutline;
13841
+ },
13842
+ set: function (t) {
13843
+ this._topOutline = t, this.updateGeometry();
13844
+ }
13845
+ },
13846
+ groundArea: {
13847
+ get: function () {
13848
+ return this._groundArea;
13849
+ },
13850
+ set: function (t) {
13851
+ this._groundArea = t, this.addGroundAreaEntity(this._groundArea);
13852
+ }
13853
+ },
13854
+ angle: {
13855
+ get: function () {
13856
+ return this._angle;
13857
+ },
13858
+ set: function (t) {
13859
+ this._angle = t, this.updateGroundCircleRadius(), this.updateGeometry();
13860
+ }
13861
+ },
13862
+ radius: {
13863
+ get: function () {
13864
+ return this._radius;
13865
+ },
13866
+ set: function (t) {
13867
+ this._radius = t, this.updateGroundCircleRadius(), this.updateGeometry();
13868
+ }
13869
+ },
13870
+ heading: {
13871
+ get: function () {
13872
+ return this._rotation.heading;
13873
+ },
13874
+ set: function (t) {
13875
+ this._rotation.heading = t;
13876
+ }
13877
+ },
13878
+ pitch: {
13879
+ get: function () {
13880
+ return this._rotation.pitch;
13881
+ },
13882
+ set: function (t) {
13883
+ this._rotation.pitch = t;
13884
+ }
13885
+ },
13886
+ roll: {
13887
+ get: function () {
13888
+ return this._rotation.roll;
13889
+ },
13890
+ set: function (t) {
13891
+ this._rotation.roll = t;
13892
+ }
13893
+ },
13894
+ position: {
13895
+ get: function () {
13896
+ return this._position;
13897
+ },
13898
+ set: function (t) {
13899
+ this._position = t;
13900
+ }
13901
+ }
13902
+ });
13903
+ n.prototype.updateGroundCircleRadius = function () {
13904
+ this._ground_radius = this._radius * Math.cos(Cesium$i.Math.toRadians(this._angle));
13905
+ };
13906
+ n.prototype.addGroundAreaEntity = function (t) {
13907
+ if (t && !this.groundAreaEntity) {
13908
+ var e = this;
13909
+ this.updateGroundCircleRadius(), this.groundAreaEntity = viewer.entities.add({
13910
+ position: this._position,
13911
+ ellipse: {
13912
+ show: 0 === this._rotation.pitch && 0 === this._rotation.roll,
13913
+ semiMinorAxis: new Cesium$i.CallbackProperty(function (t) {
13914
+ return e._ground_radius;
13915
+ }, !1),
13916
+ semiMajorAxis: new Cesium$i.CallbackProperty(function (t) {
13917
+ return e._ground_radius;
13918
+ }, !1),
13919
+ material: this.defaultColor
13920
+ },
13921
+ polyline: {
13922
+ show: this._trackedEntityPosition && (0 !== this._rotation.pitch || 0 !== this._rotation.roll),
13923
+ positions: new Cesium$i.CallbackProperty(function (t) {
13924
+ return e._trackedEntityPosition ? Cesium$i.Cartesian3.distance(e._position, e._trackedEntityPosition) > e._radius ? [] : [e._position, e._trackedEntityPosition] : [];
13925
+ }, !1),
13926
+ followSurface: !1,
13927
+ material: new Cesium$i.PolylineDashMaterialProperty({
13928
+ color: Cesium$i.Color.CYAN
13929
+ }),
13930
+ width: 1
13931
+ }
13932
+ });
13933
+ }
13934
+ };
13935
+ var l = new Cesium$i.Cartesian3();
13936
+ n.prototype.computeMatrix = function (t, e) {
13937
+ if (this._positionCartesian || (this._positionCartesian = new Cesium$i.Cartesian3()), this.position instanceof Cesium$i.Cartesian3 ? this._positionCartesian = this.position : "function" == typeof this.position.getValue ? this._positionCartesian = this.position.getValue(t) : this.position._value && this.position._value instanceof Cesium$i.Cartesian3 && (this._positionCartesian = this.position._value), this._trackedEntity && this._trackedEntity.position) {
13938
+ var i = this._positionCartesian,
13939
+ n = Cesium$i.Property.getValueOrUndefined(this._trackedEntity.position, t, l);
13940
+ if (n) {
13941
+ this._trackedEntityPosition = n;
13942
+ var o = mars3d.matrix.getHeadingPitchRollForLine(i, n, r);
13943
+ this._rotation.heading = o.heading, this._rotation.pitch = o.pitch, this._rotation.roll = o.roll;
13944
+ }
13945
+ }
13946
+ return this._modelMatrix = Cesium$i.Transforms.eastNorthUpToFixedFrame(this._positionCartesian, r, this._modelMatrix), this._positionCartographic = Cesium$i.Cartographic.fromCartesian(this._positionCartesian, r, this._positionCartographic), Cesium$i.Transforms.eastNorthUpToFixedFrame(this._positionCartesian, r, this._modelMatrix), Cesium$i.Quaternion.fromHeadingPitchRoll(this._rotation, this._quaternion), this._matrix = Cesium$i.Matrix4.fromTranslationQuaternionRotationScale(this._translation, this._quaternion, this._scale, this._matrix), Cesium$i.Matrix4.multiplyTransformation(this._modelMatrix, this._matrix, this._matrix), Cesium$i.Matrix4.inverseTransformation(this._matrix, this._inverseMatrix), this._matrix;
13947
+ };
13948
+ n.prototype.getTopGeometry = function () {
13949
+ for (var t = this.radius, e = [], i = [], n = [], r = [], o = 90 - parseInt(this.angle), s = o < 1 ? o / 8 : 1, l = 2 * Math.PI / 127, h = 0, d = this.angle; d < 91; d += s) {
13950
+ var m = Cesium$i.Math.toRadians(d < 90 ? d : 90);
13951
+ m = Math.cos(m) * t;
13952
+ for (var f = [], p = 0; p < 128; p++) {
13953
+ var c = l * p,
13954
+ _ = m * Math.cos(c),
13955
+ g = m * Math.sin(c),
13956
+ v = Math.sqrt(t * t - _ * _ - g * g);
13957
+ e.push(_, g, v), i.push(1, 1), f.push(h++);
13958
+ }
13959
+ r.push(f);
13960
+ }
13961
+ for (var d = 1; d < r.length; d++) for (var p = 1; p < r[d].length; p++) {
13962
+ var y = r[d - 1][p - 1],
13963
+ C = r[d][p - 1],
13964
+ w = r[d][p],
13965
+ x = r[d - 1][p];
13966
+ n.push(y, C, w), n.push(y, w, x);
13967
+ }
13968
+ e = new Float32Array(e), n = new Int32Array(n), i = new Float32Array(i);
13969
+ var A = {
13970
+ position: new Cesium$i.GeometryAttribute({
13971
+ componentDatatype: Cesium$i.ComponentDatatype.DOUBLE,
13972
+ componentsPerAttribute: 3,
13973
+ values: e
13974
+ }),
13975
+ st: new Cesium$i.GeometryAttribute({
13976
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
13977
+ componentsPerAttribute: 2,
13978
+ values: i
13979
+ })
13980
+ },
13981
+ b = Cesium$i.BoundingSphere.fromVertices(e),
13982
+ M = new Cesium$i.Geometry({
13983
+ attributes: A,
13984
+ indices: n,
13985
+ primitiveType: Cesium$i.PrimitiveType.TRIANGLES,
13986
+ boundingSphere: b
13987
+ });
13988
+ return (0, Cesium$i.Scene.computeVertexNormals)(M), M;
13989
+ };
13990
+ n.prototype.getTopOutlineGeometry = function () {
13991
+ for (var t = this.radius, e = [], i = [], n = [], r = [], o = 90 - parseInt(this.angle), s = o < 1 ? o / 8 : 1, l = 2 * Math.PI / 127, h = 0, d = this.angle; d < 91; d += s) {
13992
+ var m = Cesium$i.Math.toRadians(d < 90 ? d : 90);
13993
+ m = Math.cos(m) * t;
13994
+ for (var f = [], p = 0; p < 128; p++) {
13995
+ var c = l * p,
13996
+ _ = m * Math.cos(c),
13997
+ g = m * Math.sin(c),
13998
+ v = Math.sqrt(t * t - _ * _ - g * g);
13999
+ e.push(_, g, v), i.push(1, 1), f.push(h++);
14000
+ }
14001
+ r.push(f);
14002
+ }
14003
+ for (var d = 1; d < r.length; d++) for (var p = 1; p < r[d].length; p++) {
14004
+ var y = r[d - 1][p - 1],
14005
+ C = r[d][p - 1],
14006
+ w = r[d][p];
14007
+ r[d - 1][p];
14008
+ p % 8 == 1 && n.push(y, C), d % 8 == 1 && n.push(C, w);
14009
+ }
14010
+ e = new Float32Array(e), n = new Int32Array(n), i = new Float32Array(i);
14011
+ var x = {
14012
+ position: new Cesium$i.GeometryAttribute({
14013
+ componentDatatype: Cesium$i.ComponentDatatype.DOUBLE,
14014
+ componentsPerAttribute: 3,
14015
+ values: e
14016
+ }),
14017
+ st: new Cesium$i.GeometryAttribute({
14018
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
14019
+ componentsPerAttribute: 2,
14020
+ values: i
14021
+ })
14022
+ },
14023
+ A = Cesium$i.BoundingSphere.fromVertices(e),
14024
+ b = new Cesium$i.Geometry({
14025
+ attributes: x,
14026
+ indices: n,
14027
+ primitiveType: Cesium$i.PrimitiveType.LINES,
14028
+ boundingSphere: A
14029
+ });
14030
+ return (0, Cesium$i.Scene.computeVertexNormals)(b), b;
14031
+ };
14032
+ n.prototype.updateGeometry = function () {
14033
+ this._geometry = Cesium$i.Scene.CylinderGeometry.createGeometry(new Cesium$i.Scene.CylinderGeometry({
14034
+ topRadius: this._radius * Math.cos(Cesium$i.Math.toRadians(this.angle)),
14035
+ bottomRadius: 0,
14036
+ length: this._radius * Math.sin(Cesium$i.Math.toRadians(this.angle))
14037
+ })), this._topGeometry = this.getTopGeometry(), this._topOutlineGeometry = this.getTopOutlineGeometry(), this._outlineGeometry = Cesium$i.Scene.CylinderGeometry.createOutlineGeometry(new Cesium$i.Scene.CylinderGeometry({
14038
+ topRadius: this._radius * Math.cos(Cesium$i.Math.toRadians(this.angle)),
14039
+ bottomRadius: 0,
14040
+ slices: 128,
14041
+ length: this._radius * Math.sin(Cesium$i.Math.toRadians(this.angle))
14042
+ })), this._positions = new Float32Array(this._geometry.attributes.position.values.length);
14043
+ for (var t = 0; t < this._positions.length; t++) this._positions[t] = this._geometry.attributes.position.values[t];
14044
+ this._drawCommands && this._drawCommands.length && (this._drawCommands.forEach(function (t) {
14045
+ t.vertexArray = t.vertexArray && t.vertexArray.destroy();
14046
+ }), this._drawCommands.splice(0, this._drawCommands.length));
14047
+ };
14048
+ n.prototype.update = function (t) {
14049
+ if (this._show) {
14050
+ this.computeMatrix(t.time);
14051
+ t.mode === Cesium$i.SceneMode.SCENE3D ? (this._geometry.boundingSphere = Cesium$i.BoundingSphere.fromVertices(this._geometry.attributes.position.values), this._drawCommands && this._drawCommands.length || (this._drawCommands.push(this.createDrawCommand(this._geometry, t)), this._outline && this._drawCommands.push(this.createDrawCommand(this._outlineGeometry, t)), this._topShow && (this._drawCommands.push(this.createDrawCommand(this._topGeometry, t)), this._topOutline && this._drawCommands.push(this.createDrawCommand(this._topOutlineGeometry, t)))), this._drawCommands.forEach(function (e) {
14052
+ t.commandList.push(e);
14053
+ }), this.groundAreaEntity && (this.groundAreaEntity.ellipse.show = this._groundArea && 0 === this._rotation.pitch && 0 === this._rotation.roll, this.groundAreaEntity.polyline.show = !1)) : (this.groundAreaEntity || this.addGroundAreaEntity(!0), this.groundAreaEntity.ellipse.show = 0 === this._rotation.pitch && 0 === this._rotation.roll, this.groundAreaEntity.polyline.show = this._trackedEntityPosition && (0 !== this._rotation.pitch || 0 !== this._rotation.roll));
14054
+ }
14055
+ };
14056
+ n.prototype.getFragmentShaderSource = function (t) {
14057
+ return "#version 300 es\n\
14058
+ in vec3 v_position;\n\
14059
+ in vec3 v_normal; \n\
14060
+ uniform float picked; \n\
14061
+ uniform vec4 pickedColor; \n\
14062
+ uniform vec4 defaultColor; \n\
14063
+ uniform float specular; \n\
14064
+ uniform float shininess; \n\
14065
+ uniform vec3 emission; \n\
14066
+ in vec2 v_st; \n\
14067
+ uniform bool isLine; \n\
14068
+ uniform float glowPower; \n\
14069
+ layout(location=2) out vec4 pc_FragColor; \n\
14070
+ void main() { \n\
14071
+ vec3 positionToEyeEC = -v_position; \n\
14072
+ vec3 normalEC = normalize(v_normal); \n\
14073
+ vec4 color = defaultColor; \n\
14074
+ if (picked != 0.0) { \n\
14075
+ color = pickedColor; \n\
14076
+ } \n\
14077
+ czm_material material; \n\
14078
+ material.specular = specular; \n\
14079
+ material.shininess = shininess; \n\
14080
+ material.normal = normalEC; \n\
14081
+ material.emission = emission;//vec3(0.2,0.2,0.2);\n\
14082
+ material.diffuse = color.rgb ;\n\
14083
+ if(isLine){\n\
14084
+ material.alpha = 1.0; \n\
14085
+ }\n\
14086
+ else{ \n\
14087
+ material.alpha = color.a; \n\
14088
+ }\n\
14089
+ if(v_st.x==0.0){ \n\
14090
+ pc_FragColor =color ;\n\
14091
+ }else { \n\
14092
+ pc_FragColor = czm_phong(normalize(positionToEyeEC), material) ; \n\
14093
+ } \n\
14094
+ }";
14095
+ };
14096
+ n.prototype.getVertexShaderSource = function (t) {
14097
+ return "#version 300 es\n\
14098
+ #ifdef GL_ES\n\
14099
+ precision highp float;\n\
14100
+ #endif\n\n\
14101
+ in vec3 position;\n\
14102
+ in vec2 st;\n\
14103
+ in vec3 normal;\n\
14104
+ uniform mat4 modelViewMatrix;\n\
14105
+ uniform mat3 normalMatrix;\n\
14106
+ uniform mat4 projectionMatrix;\n\
14107
+ out vec3 v_position;\n\
14108
+ out vec3 v_normal;\n\
14109
+ out vec2 v_st;\n\n\
14110
+ out vec3 v_light0Direction;\n\n\
14111
+ void main(void) \n\
14112
+ {\n\
14113
+ vec4 pos = modelViewMatrix * vec4( position,1.0);\n\
14114
+ v_normal = normalMatrix * normal;\n\
14115
+ v_st = st;\n\
14116
+ v_position = pos.xyz;\n\
14117
+ v_light0Direction = mat3( modelViewMatrix) * vec3(1.0,1.0,1.0);\n\
14118
+ gl_Position = projectionMatrix * pos;\n\
14119
+ }";
14120
+ };
14121
+ n.prototype.createDrawCommand = function (t, e, i) {
14122
+ var n = e.context,
14123
+ r = new Cesium$i.Cartesian3();
14124
+ Cesium$i.Matrix4.multiplyByPoint(this._matrix, t.boundingSphere.center, r);
14125
+ var o = new Cesium$i.BoundingSphere(r, t.boundingSphere.radius),
14126
+ s = new Cesium$i.DrawCommand({
14127
+ modelMatrix: i || this._matrix,
14128
+ owner: this,
14129
+ primitiveType: t.primitiveType,
14130
+ pass: Cesium$i.Pass.TRANSLUCENT,
14131
+ boundingVolume: o
14132
+ }),
14133
+ u = this,
14134
+ l = Cesium$i.GeometryPipeline.createAttributeLocations(t);
14135
+ return s.vertexArray = Cesium$i.VertexArray.fromGeometry({
14136
+ context: n,
14137
+ geometry: t,
14138
+ attributeLocations: l,
14139
+ bufferUsage: Cesium$i.BufferUsage.STATIC_DRAW
14140
+ }), s.vertexArray._attributeLocations = l, s.shaderProgram = Cesium$i.ShaderProgram.replaceCache({
14141
+ context: n,
14142
+ vertexShaderSource: this.getVertexShaderSource(t),
14143
+ fragmentShaderSource: this.getFragmentShaderSource(t),
14144
+ attributeLocations: l
14145
+ }), s.renderState = Cesium$i.RenderState.fromCache({
14146
+ blending: Cesium$i.BlendingState.ALPHA_BLEND,
14147
+ depthTest: {
14148
+ enabled: !0,
14149
+ func: Cesium$i.DepthFunction.LESS
14150
+ },
14151
+ cull: {
14152
+ enabled: !1,
14153
+ face: Cesium$i.CullFace.BACK
14154
+ }
14155
+ }), s.uniformMap = {}, s.uniformMap.projectionMatrix = function () {
14156
+ return e.context.uniformState.projection;
14157
+ }, s.uniformMap.modelViewMatrix = function () {
14158
+ return e.context.uniformState.modelView;
14159
+ }, s.uniformMap.shininess = function () {
14160
+ return u.shininess || (u.shininess = 0), u.shininess;
14161
+ }, s.uniformMap.emission = function () {
14162
+ return u.emission || (u.emission = new Cesium$i.Cartesian3(.2, .2, .2)), u.emission;
14163
+ }, s.uniformMap.specular = function () {
14164
+ return u.specular || (u.specular = 0), u.specular;
14165
+ }, s.uniformMap.isLine = function () {
14166
+ return t.primitiveType == Cesium$i.PrimitiveType.LINES || t.primitiveType == Cesium$i.PrimitiveType.LINE_STRIP;
14167
+ }, s.uniformMap.defaultColor = function () {
14168
+ return t.primitiveType == Cesium$i.PrimitiveType.LINES || t.primitiveType == Cesium$i.PrimitiveType.LINE_STRIP ? (u.defaultLineColor || (u.defaultLineColor = new Cesium$i.Color(1, 1, 0, 1)), u.defaultLineColor) : (u.defaultColor || (u.defaultColor = new Cesium$i.Color(1, 0, 0, 1)), u.defaultColor);
14169
+ }, s.uniformMap.picked = function () {
14170
+ return u.picked || (u.picked = 0), u.picked;
14171
+ }, s.uniformMap.pickedColor = function () {
14172
+ return u.pickedColor || (u.pickedColor = new Cesium$i.Color(1, 1, 0, 1)), u.pickedColor;
14173
+ }, s.uniformMap.normalMatrix = function () {
14174
+ return e.context.uniformState.normal;
14175
+ }, s.uniformMap.glowPower = function () {
14176
+ return .25;
14177
+ }, s;
14178
+ };
14179
+ n.prototype.remove = function () {
14180
+ this.viewer.scene.primitives.remove(this), this.groundAreaEntity && this.viewer.entities.remove(this.groundAreaEntity);
14181
+ };
14182
+ n.prototype.addToScene = function () {
14183
+ this.viewer.scene.primitives.add(this), this.groundAreaEntity && this.viewer.entities.add(this.groundAreaEntity);
14184
+ };
14185
+ n.prototype.destroy = function (t) {
14186
+ t && (this.viewer.scene.primitives.remove(this), this.groundAreaEntity && this.viewer.entities.remove(this.groundAreaEntity), this._drawCommands.forEach(function (t) {
14187
+ t.vertexArray = t.vertexArray && t.vertexArray.destroy();
14188
+ }), this._drawCommands = []);
14189
+ };
14190
+ Cesium$i.Scene.RadarPrimitiveRight = n;
14191
+ },
14192
+ _installCounputeVertex: function () {
14193
+ function n(t) {
14194
+ var e = t.indices,
14195
+ i = t.attributes,
14196
+ n = e.length;
14197
+ if (i.position) {
14198
+ var o = i.position.values;
14199
+ if (void 0 === i.normal) i.normal = new Cesium$i.GeometryAttribute({
14200
+ componentDatatype: Cesium$i.ComponentDatatype.FLOAT,
14201
+ componentsPerAttribute: 3,
14202
+ values: new Float32Array(o.length)
14203
+ });else for (var a = i.normal.values, s = 0; s < n; s++) a[s] = 0;
14204
+ for (var u, l, h, d = i.normal.values, m = new Cesium$i.Cartesian3(), f = new Cesium$i.Cartesian3(), p = new Cesium$i.Cartesian3(), c = new Cesium$i.Cartesian3(), _ = new Cesium$i.Cartesian3(), s = 0; s < n; s += 3) u = 3 * e[s + 0], l = 3 * e[s + 1], h = 3 * e[s + 2], Cesium$i.Cartesian3.fromArray(o, u, m), Cesium$i.Cartesian3.fromArray(o, l, f), Cesium$i.Cartesian3.fromArray(o, h, p), Cesium$i.Cartesian3.subtract(p, f, c), Cesium$i.Cartesian3.subtract(m, f, _), Cesium$i.Cartesian3.cross(c, _, c), d[u] += c.x, d[u + 1] += c.y, d[u + 2] += c.z, d[l] += c.x, d[l + 1] += c.y, d[l + 2] += c.z, d[h] += c.x, d[h + 1] += c.y, d[h + 2] += c.z;
14205
+ r(t), i.normal.needsUpdate = !0;
14206
+ }
14207
+ return t;
14208
+ }
14209
+ function r(t) {
14210
+ for (var e, i, n, r, o = t.attributes.normal.values, a = 0; a < o.length; a += 3) e = o[a], i = o[a + 1], n = o[a + 2], r = 1 / Math.sqrt(e * e + i * i + n * n), o[a] = e * r, o[a + 1] = i * r, o[a + 2] = n * r;
14211
+ }
14212
+ function o(t, e, i, n) {
14213
+ n = n || Cesium$i.Ellipsoid.WGS84, Cesium$i.Matrix4.multiplyByPoint(e, t, a), Cesium$i.Cartesian3.subtract(a, i.origin, i.direction), Cesium$i.Cartesian3.normalize(i.direction, i.direction);
14214
+ var r = Cesium$i.IntersectionTests.rayEllipsoid(i, n),
14215
+ o = null;
14216
+ if (r && (o = Cesium$i.Ray.getPoint(i, r.start)), o) try {
14217
+ Cesium$i.Cartographic.fromCartesian(o, null, s);
14218
+ } catch (t) {
14219
+ return null;
14220
+ }
14221
+ return o;
14222
+ }
14223
+ var a = new Cesium$i.Cartesian3(),
14224
+ s = (new Cesium$i.Ray(), new Cesium$i.Cartographic());
14225
+ Cesium$i.Scene.computeVertexNormals = n, Cesium$i.Scene.extend2Earth = o;
14226
+ }
14227
+ };
14228
+
13569
14229
  const prototypeExtends = function (viewer, cesiumGlobal, defaultStatic) {
13570
14230
  function _inner(parents, children) {
13571
14231
  var curr = null;
@@ -13598,15 +14258,21 @@ function initCesium({
13598
14258
  cesiumGlobal,
13599
14259
  containerId,
13600
14260
  viewerConfig = {},
13601
- extreaConfig = {},
14261
+ extraConfig = {},
13602
14262
  MapImageryList = [],
13603
14263
  defaultStatic
13604
14264
  }) {
14265
+ if (!cesiumGlobal) {
14266
+ throw 'Missing cesiumGlobal parameter, please check the calling function initCesium.';
14267
+ }
14268
+ if (!containerId) {
14269
+ throw 'Missing containerId parameter, please check the calling function initCesium.';
14270
+ }
13605
14271
  const initCom = new Controller(cesiumGlobal);
13606
14272
  const _viewer = initCom.init({
13607
14273
  containerId,
13608
14274
  viewerConfig,
13609
- extreaConfig,
14275
+ extraConfig,
13610
14276
  MapImageryList
13611
14277
  });
13612
14278
 
@@ -13627,6 +14293,8 @@ function initCesium({
13627
14293
  const _attackArrowObj = new AttackArrow(_viewer, cesiumGlobal);
13628
14294
  const _straightArrowObj = new StraightArrow(_viewer, cesiumGlobal);
13629
14295
  const _pincerArrowObj = new PincerArrow(_viewer, cesiumGlobal);
14296
+ // 初始化相控相关对象
14297
+ new RadarPlugin(_viewer, cesiumGlobal, defaultStatic);
13630
14298
  return {
13631
14299
  viewer: _viewer,
13632
14300
  material: _material,