zhanmingkan
2022-05-16 dc9784b9f149e15b0ddfb439135fe712ba2f8e8b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
/**
 * 陆军实战战术模拟
 */
var tankStartArr = [];
var tankPathArr = [];
var intervalPopArr = [];
var intervaltankId;
var tankdata;
function loadtankdemo(){
    var args = JSON.stringify({
        "lType" : "坦克轨迹"
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/policeLine/queryPoliceLine.action",
        contentType : "application/json;charset=utf-8",
        data : args,
        success : function(data) {
            if (data.length != 0) {
                tankdata = data;
                var pathArr = [];
                var url = "../../easy3dfile/data/model/military/99tank.gltf";
                var pinBuilder = new Cesium.PinBuilder();
                for (var i = 0; i < data.length; i++) {
                    var poiArr = stringToNumber(data[i].lPoyline);
                    var poistart = Cesium.Cartesian3.fromDegrees(poiArr[0],poiArr[1],poiArr[2]);
                    var poistartArr = [poistart];
                    tankStartArr.push(viewer.entities.add({
                        position : poistart,
                        billboard : {
                            image : pinBuilder.fromText(i,Cesium.Color.RED,36).toDataURL(),
                            verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
                        }
                    }));
                    tankPathArr.push(viewer.entities.add({
                        id : 'tank'+data[i].lId,
                        polyline : {
                            clampToGround : true,
                            width : 3,
                            show : true,
                            material : new Cesium.PolylineDashMaterialProperty({
                                color: Cesium.Color.YELLOW
                            })
                        }
                    }));
                    pathArr.push(poistartArr);
                }
                CesiumPop.bindPopGlobeEventHandler(viewer);
                var j = 1;
                intervaltankId = setInterval(function(){
                    for (var x = 0; x < intervalPopArr.length; x++) {
                        CesiumPop.stopInterval(intervalPopArr[x]);
                    }
                    intervalPopArr.length = 0;
                    var startTime = Cesium.JulianDate.now(startTime);
                    var stopTime = Cesium.JulianDate.now(startTime);
                    for (var i = 0; i < tankdata.length; i++) {
                        var poiArr = stringToNumber(data[i].lPoyline);
                        var poiArrM = [];
                        for (var k = 0; k < poiArr.length; k=k+3) {
                            poiArrM.push([poiArr[k],poiArr[k+1],poiArr[k+2]]);
                        }
                        if(poiArrM[j]){
                            var curpos = Cesium.Cartesian3.fromDegrees(poiArrM[j][0],poiArrM[j][1],poiArrM[j][2]);
                            var prepos = Cesium.Cartesian3.fromDegrees(poiArrM[j-1][0],poiArrM[j-1][1],poiArrM[j-1][2]);
                            var heading = Cesium.Math.toRadians(azimuthtwopoi(poiArrM[j-1][0],poiArrM[j-1][1],poiArrM[j][0],poiArrM[j][1])-180);
                            var hpr = new Cesium.HeadingPitchRoll(heading, 0, 0);
                            var orientation = Cesium.Transforms.headingPitchRollQuaternion(curpos, hpr);
                            pathArr[i].push(curpos);
                            tankPathArr[i].polyline.positions = pathArr[i];
                            var result = createTankLines([prepos,curpos],orientation,url);
                            if(Cesium.JulianDate.compare(startTime, result.startTime)>0){startTime = result.startTime;}
                            if(Cesium.JulianDate.compare(stopTime, result.stopTime)<0){stopTime = result.stopTime;}
                            if(i==0||i==7){
                                var popE = viewer.entities.getById("popentitytank"+i);
                                if(popE){
                                    intervalPopArr.push(CesiumPop.updateSampledPopPos(viewer,"tank"+i,[prepos,curpos],50,244,324,Cesium.Color.WHITE));
                                }else{
                                    var curheight = poiArrM[j][2]+2;
                                    var content = '<div class="mapPopNavy font2"><table cellspacing="0">'
                                        +'<tr><td class="keytd">型号</td><td colspan="2">99B型主战坦克</td></tr>'
                                        +'<tr><td class="keytd">编号</td><td colspan="2">05'+i+'</td></tr>'
                                        +'<tr><td class="imgtd" colspan="2"><img src="../images/99b.jpg">'
                                        +'</td><td class="imgtd">'
                                        +'<div class="label-poor">77旅</div>'
                                        +'<div class="label-stabilty m-t-10" onclick="missileLaunch('
                                        +poiArrM[j][0]+','+poiArrM[j][1]+','+poiArrM[j][2]+','+112.78768536467054+','
                                        +42.15345681079423+','+curheight+')">炮击模拟</div>'
                                        +'</td></tr>'
                                        +'<tr><td class="keytd" colspan="2">实时载弹量</td><td>42</td></tr>'
                                        +'<tr><td class="keytd" colspan="2">XPS</td><td>198pa</td></tr>'
                                        +'<tr><td class="keytd" colspan="2">E/P°</td><td>33</td></tr>'
                                        +'</table></div>';
                                    var options = {
                                        "viewer":viewer,
                                        "id":"tank"+i,
                                        "popupWidth":244,
                                        "popupHeight":324,
                                        "pos":{"lon":poiArrM[j][0],"lat":poiArrM[j][1],"alt":poiArrM[j][2]},
                                        "extentHeight":50,
                                        "extentColor":Cesium.Color.WHITE,
                                        "content":content
                                    };
                                    CesiumPop.addDivPop(options);
                                    intervalPopArr.push(CesiumPop.updateSampledPopPos(viewer,"tank"+i,[prepos,curpos],50,244,324,Cesium.Color.WHITE));
                                }
                            }
                        }
                    }
                    j++;
                    viewer.clock.startTime = startTime.clone();
                    viewer.clock.stopTime = stopTime.clone();
                    viewer.clock.currentTime = startTime.clone();
                    viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
                    viewer.clock.multiplier = 1;
                    viewer.timeline.zoomTo(startTime, stopTime);
                }, 10000);
            }else{
                console.log("坦克轨迹信息为空!");
            }
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("获取坦克轨迹信息失败!");
        }
    });
}
function createTankLines(nodes,orientation,url){
    //添加移动实体
    var times = [];
    var startTime = Cesium.JulianDate.now(startTime);
    for (var i = 0; i < nodes.length; i++) {
        var time = new Cesium.JulianDate();
        Cesium.JulianDate.addSeconds(startTime, i*10, time);
        times.push(time);
    }
    var stopTime = times[times.length - 1];
    //插值
    var property = new Cesium.SampledPositionProperty();
    property.addSamples(times, nodes);
    
    viewer.entities.add({
        position : property,
        orientation : orientation,
        model : {
            uri : url,
            scale : 0.0017,
            lightColor : Cesium.Color.WHITE,
            shadows : Cesium.ShadowMode.DISABLED
        }
    });
    return {
        startTime:startTime,
        stopTime:stopTime
    };
}
/**
 * 海军实战战术模拟
 */
var navyTargetEntity;
var shipStart1;
var shipStart2;
var pathentity1;
var pathentity2;
var intervalId;
function loadshipdemo(){
    //靶区
    var targetline = [
        Cesium.Cartesian3.fromDegrees(116.367474,19.259384,100),
        Cesium.Cartesian3.fromDegrees(116.385871,17.255558,100),
        Cesium.Cartesian3.fromDegrees(112.982371,17.202515,100),
        Cesium.Cartesian3.fromDegrees(112.969148,19.254026,100),
        Cesium.Cartesian3.fromDegrees(116.367474,19.259384,100)
    ];
    navyTargetEntity = viewer.entities.add({
        id : 'targetregion',
        polyline : {
            positions : targetline,
            clampToGround : true,
            width : 2,
            show : true,
            material : new Cesium.PolylineDashMaterialProperty({
                color: Cesium.Color.RED
            })
        },
        wall : {
            positions : Cesium.Cartesian3.fromDegreesArrayHeights([116.367474,19.259384, 3000.0,
                116.385871,17.255558, 3000.0,
                112.982371,17.202515, 3000.0,
                112.969148,19.254026, 3000.0,
                116.367474,19.259384, 3000.0]),
            material : Cesium.Color.RED.withAlpha(0.8),
            outline : false
        }
    });
    
    //军舰移动
    var url = "../../easy3dfile/data/model/military/ship2.gltf";
    var url2 = "../../easy3dfile/data/model/military/ship2.gltf";
    var pinBuilder = new Cesium.PinBuilder();
    //指挥舰
    var poistart1 = Cesium.Cartesian3.fromDegrees(path1[0][0],path1[0][1],path1[0][2]);
    shipStart1 = viewer.entities.add({
        position : poistart1,
        billboard : {
            image : pinBuilder.fromText('指',Cesium.Color.RED,36).toDataURL(),
            verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
        }
    });
    pathentity1 = viewer.entities.add({
        name : 'path1',
        polyline : {
            clampToGround : true,
            width : 3,
            show : true,
            material : new Cesium.PolylineDashMaterialProperty({
                color: Cesium.Color.RED
            })
        }
    });
    //靶舰
    var poistart2 = Cesium.Cartesian3.fromDegrees(path2[0][0],path2[0][1],path2[0][2]);
    shipStart2 = viewer.entities.add({
        position : poistart2,
        billboard : {
            image : pinBuilder.fromText('靶',Cesium.Color.YELLOW,36).toDataURL(),
            verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
        }
    });
    pathentity2 = viewer.entities.add({
        name : 'path2',
        polyline : {
            clampToGround : true,
            width : 3,
            show : true,
            material : new Cesium.PolylineDashMaterialProperty({
                color: Cesium.Color.YELLOW
            })
        }
    });
    
    CesiumPop.bindPopGlobeEventHandler(viewer);
    var i = 1;
    var trend = true;
    var path1Arr = [poistart1];
    var path2Arr = [poistart2];
    intervalId = setInterval(function(){
        var startTime = Cesium.JulianDate.now(startTime);
        var stopTime = Cesium.JulianDate.now(startTime);
        CesiumRadar.clear(viewer);
        
        if(path1[i]){
            CesiumPop.removeDivPopById(viewer,'ship1');
            var curpos1 = Cesium.Cartesian3.fromDegrees(path1[i][0],path1[i][1],path1[i][2]);
            var heading1 = Cesium.Math.toRadians(path1[i][3]-180);
            var pitch1 = 0;
            var roll1 = 0;
            var hpr1 = new Cesium.HeadingPitchRoll(heading1, pitch1, roll1);
            var orientation1 = Cesium.Transforms.headingPitchRollQuaternion(curpos1, hpr1);
            path1Arr.push(Cesium.Cartesian3.fromDegrees(path1[i][0],path1[i][1],path1[i][2]));
            pathentity1.polyline.positions = path1Arr;
            var content = '<div class="mapPopNavy font2"><table cellspacing="0">'
                +'<tr><td class="keytd">舰名</td><td colspan="2">辽宁舰</td></tr>'
                +'<tr><td class="keytd">舷号</td><td colspan="2">16</td></tr>'
                +'<tr><td class="imgtd" colspan="2"><img src="../images/ship1.jpg">'
                +'</td><td class="imgtd">'
                +'<div class="label-poor">南 海</div>'
                +'<div class="label-stabilty m-t-10" onclick="missileLaunch('
                + path1[i][0]+','+path1[i][1]+','+path1[i][2]+','+path2[i][0]+','+path2[i][1]+',5000)">指 挥</div>'
                +'</td></tr>'
                +'<tr><td class="keytd">经度</td><td colspan="2">'+path1[i][0]+'</td></tr>'
                +'<tr><td class="keytd">纬度</td><td colspan="2">'+path1[i][1]+'</td></tr>'
                +'<tr><td class="keytd">方位角</td><td colspan="2">'+path1[i][3]+'</td></tr>'
                +'<tr><td class="keytd">Eb/n0</td><td colspan="2">'+path1[i][4]+'</td></tr>'
                +'<tr><td class="keytd">AGC</td><td colspan="2">'+path1[i][5]+'</td></tr>'
                +'<tr><td class="keytd">网速</td><td colspan="2">'+path1[i][6]+'</td></tr>'
                +'</table></div>';
            var options = {
                "viewer":viewer,
                "id":"ship1",
                "popupWidth":244,
                "popupHeight":324,
                "pos":{"lon":path1[i][0],"lat":path1[i][1],"alt":path1[i][2]},
                "extentHeight":3000,
                "extentColor":Cesium.Color.WHITE,
                "content":content
            };
            CesiumPop.addDivPop(options);
            
            var result = createShipLines([poistart1,curpos1],orientation1,url);
            poistart1 = curpos1;
            if(Cesium.JulianDate.compare(startTime, result.startTime)>0){startTime = result.startTime;}
            if(Cesium.JulianDate.compare(stopTime, result.stopTime)<0){stopTime = result.stopTime;}
            
            var smoption = {};
            smoption.viewer = viewer;
            smoption.position = new Cesium.Cartesian3.fromDegrees(path1[i][0],path1[i][1],path1[i][2]);
            smoption.id = "radar1";
            smoption.heading = 15*i;
            smoption.pitch = 0.0;
            smoption.roll = 0.0;
            smoption.angle = 120;
            smoption.cone = 40;
            smoption.far = 5000;
            smoption.near = 5;
            smoption.color = Cesium.Color.RED.withAlpha(0.2);
            smoption.outColor = Cesium.Color.RED.withAlpha(0.7);
            CesiumRadar.create(smoption);
        }
        if(path2[i]){
            CesiumPop.removeDivPopById(viewer,'ship2');
            var curpos2 = Cesium.Cartesian3.fromDegrees(path2[i][0],path2[i][1],path2[i][2])
            var heading2 = Cesium.Math.toRadians(path2[i][3]-180);
            var pitch2 = 0;
            var roll2 = 0;
            var hpr2 = new Cesium.HeadingPitchRoll(heading2, pitch2, roll2);
            var orientation2 = Cesium.Transforms.headingPitchRollQuaternion(curpos2, hpr2);
            path2Arr.push(Cesium.Cartesian3.fromDegrees(path2[i][0],path2[i][1],path2[i][2]));
            pathentity2.polyline.positions = path2Arr;
            var content = '<div class="mapPopNavy font2"><table cellspacing="0">'
                +'<tr><td class="keytd">舰名</td><td colspan="2">鹰潭舰</td></tr>'
                +'<tr><td class="keytd">舷号</td><td colspan="2">052</td></tr>'
                +'<tr><td class="imgtd" colspan="2"><img src="../images/ship2.jpg">'
                +'</td><td class="imgtd">'
                +'<div class="label-poor">南 海</div>'
                +'<div class="label-stabilty m-t-10" onclick="dropdisturb('
                + path2[i][0]+','+path2[i][1]+','+path2[i][2]+')">靶 舰</div>'
                +'</td></tr>'
                +'<tr><td class="keytd">经度</td><td colspan="2">'+path2[i][0]+'</td></tr>'
                +'<tr><td class="keytd">纬度</td><td colspan="2">'+path2[i][1]+'</td></tr>'
                +'<tr><td class="keytd">方位角</td><td colspan="2">'+path2[i][3]+'</td></tr>'
                +'<tr><td class="keytd">Eb/n0</td><td colspan="2">'+path2[i][4]+'</td></tr>'
                +'<tr><td class="keytd">AGC</td><td colspan="2">'+path2[i][5]+'</td></tr>'
                +'<tr><td class="keytd">网速</td><td colspan="2">'+path2[i][6]+'</td></tr>'
                +'</table></div>';
            var options = {
                "viewer":viewer,
                "id":"ship2",
                "popupWidth":244,
                "popupHeight":324,
                "pos":{"lon":path2[i][0],"lat":path2[i][1],"alt":path2[i][2]},
                "extentHeight":3000,
                "extentColor":Cesium.Color.WHITE,
                "content":content
            };
            CesiumPop.addDivPop(options);
            
            var result = createShipLines([poistart2,curpos2],orientation2,url2);
            poistart2 = curpos2;
            if(Cesium.JulianDate.compare(startTime, result.startTime)>0){startTime = result.startTime;}
            if(Cesium.JulianDate.compare(stopTime, result.stopTime)<0){stopTime = result.stopTime;}
            
            var smoption = {};
            smoption.viewer = viewer;
            smoption.position = new Cesium.Cartesian3.fromDegrees(path2[i][0],path2[i][1],path2[i][2]);
            smoption.id = "radar2";
            smoption.heading = 20*i+30;
            smoption.pitch = 0.0;
            smoption.roll = 0.0;
            smoption.angle = 120;
            smoption.cone = 40;
            smoption.far = 5000;
            smoption.near = 5;
            smoption.color = Cesium.Color.GREEN.withAlpha(0.2);
            smoption.outColor = Cesium.Color.GREEN.withAlpha(0.7);
            CesiumRadar.create(smoption);
        }
        if(trend){
            i++;
            if(i>300){
                trend = false;
            }
        }else{
            i--;
            if(i<1){
                trend = true;
            }
        }
        
        viewer.clock.startTime = startTime.clone();
        viewer.clock.stopTime = stopTime.clone();
        viewer.clock.currentTime = startTime.clone();
        viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
        viewer.clock.multiplier = 1;
        viewer.timeline.zoomTo(startTime, stopTime);
    }, 5000);
}
function createShipLines(nodes,orientation,url){
    //添加移动实体
    var times = [];
    var startTime = Cesium.JulianDate.now(startTime);
    for (var i = 0; i < nodes.length; i++) {
        var time = new Cesium.JulianDate();
        Cesium.JulianDate.addSeconds(startTime, i*5, time);
        times.push(time);
    }
    var stopTime = times[times.length - 1];
    //插值
    var property = new Cesium.SampledPositionProperty();
    property.addSamples(times, nodes);
    
    viewer.entities.add({
        position : property,
        orientation : orientation,
        model : {
            uri : url,
            minimumPixelSize : 128,
            maximumScale : 25000
        }
    });
    return {
        startTime:startTime,
        stopTime:stopTime
    };
}
function removetankdemo(){
    clearInterval(intervaltankId);
    CesiumPop.clearDivPop(viewer);
    for (var x = 0; x < tankStartArr.length; x++) {
        viewer.entities.remove(tankStartArr[x]);
    }
    for (var y = 0; y < tankPathArr.length; y++) {
        viewer.entities.remove(tankPathArr[y]);
    }
    for (var i = 0; i < intervalPopArr.length; i++) {
        CesiumPop.stopInterval(intervalPopArr[i]);
    }
    intervalPopArr.length = 0;
    tankStartArr.length = 0;
    tankPathArr.length = 0;
    clearmissilelaunch();
}
function removeshipdemo(){
    clearInterval(intervalId);
    CesiumPop.clearDivPop(viewer);
    viewer.entities.remove(navyTargetEntity);
    viewer.entities.remove(shipStart1);
    viewer.entities.remove(shipStart2);
    viewer.entities.remove(pathentity1);
    viewer.entities.remove(pathentity2);
    for (var x = 0; x < disturbArr.length; x++) {
        viewer.entities.remove(disturbArr[x]);
    }
    CesiumRadar.clear(viewer);
    clearmissilelaunch();
}
function removeMilitary(){
    removeshipdemo();
    removetankdemo();
}
var disturbArr = [];
function dropdisturb(x,y,z){
    var pos1 = Cesium.Cartesian3.fromDegrees(x-0.01,y,z);
    var pos2 = Cesium.Cartesian3.fromDegrees(x,y-0.01,z);
    var pos3 = Cesium.Cartesian3.fromDegrees(x-0.01,y-0.01,z);
    var pos4 = Cesium.Cartesian3.fromDegrees(x+0.01,y,z);
    var pos5 = Cesium.Cartesian3.fromDegrees(x,y+0.01,z);
    var pos6 = Cesium.Cartesian3.fromDegrees(x+0.01,y+0.01,z);
    disturbArr.push(viewer.entities.add({
        position: pos1,
        point: {
            pixelSize: 10,
            color: Cesium.Color.GREEN.withAlpha(0.8),
            disableDepthTestDistance: 8000,
            outlineWidth: 2,
            outlineColor: Cesium.Color.YELLOW.withAlpha(1),
        },
    }),
    viewer.entities.add({
        position: pos2,
        point: {
            pixelSize: 10,
            color: Cesium.Color.GREEN.withAlpha(0.8),
            disableDepthTestDistance: 8000,
            outlineWidth: 2,
            outlineColor: Cesium.Color.YELLOW.withAlpha(1)
        },
    }),
    viewer.entities.add({
        position: pos3,
        point: {
            pixelSize: 10,
            color: Cesium.Color.GREEN.withAlpha(0.8),
            disableDepthTestDistance: 8000,
            outlineWidth: 2,
            outlineColor: Cesium.Color.YELLOW.withAlpha(1)
        },
    }),
    viewer.entities.add({
        position: pos4,
        point: {
            pixelSize: 10,
            color: Cesium.Color.GREEN.withAlpha(0.8),
            disableDepthTestDistance: 8000,
            outlineWidth: 2,
            outlineColor: Cesium.Color.YELLOW.withAlpha(1)
        },
    }),
    viewer.entities.add({
        position: pos5,
        point: {
            pixelSize: 10,
            color: Cesium.Color.GREEN.withAlpha(0.8),
            disableDepthTestDistance: 8000,
            outlineWidth: 2,
            outlineColor: Cesium.Color.YELLOW.withAlpha(1)
        },
    }),
    viewer.entities.add({
        position: pos6,
        point: {
            pixelSize: 10,
            color: Cesium.Color.GREEN.withAlpha(0.8),
            disableDepthTestDistance: 8000,
            outlineWidth: 2,
            outlineColor: Cesium.Color.YELLOW.withAlpha(1)
        },
    }));
}
function missileLaunch(x,y,z,tx,ty,ch){
    clearmissilelaunch();
    var options = {
            'lon':x,
            'lat':y,
            'alt':z,
            'targetlon':tx,
            'targetlat':ty,
            'curheight':ch,
            'viewer':viewer
    };
    CesiumCurvedTrail.create(options);
}
 
function clearmissilelaunch(){
    CesiumCurvedTrail.clear(viewer);
}
function drawstraightArrow(){
    var cssColorStr = '#'+$('.colpick_hex_field').children('input').val();
    CesiumArrow.draw("straightArrow",cssColorStr);
}
function drawattackArrow(){
    var cssColorStr = '#'+$('.colpick_hex_field').children('input').val();
    CesiumArrow.draw("attackArrow",cssColorStr);
}
function drawpincerArrow(){
    var cssColorStr = '#'+$('.colpick_hex_field').children('input').val();
    CesiumArrow.draw("pincerArrow",cssColorStr);
}
function saveArrow(){
    var planName = $('#planName').val();
    if(planName!=''){
        var result = CesiumArrow.saveData();
        var obj = {
            'planName':planName,
            'planPos':result
        };
        var args = JSON.stringify(obj);
        $.ajax({
            type : "post",
            url : "../../easyAPI/plan/insert.action",
            data : args,
            contentType : "application/json;charset=utf-8",
            success : function(data) {
                if(data == 1){
                    getPlanAll();
                }else{
                    console.log("保存失败!");
                }
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                console.log("ajax请求失败!");
            }
        });
    }else{
        swal("请输入作战方案名称!","请重试!","error");
    }
}
function clearOneArrow(){
    CesiumArrow.clearOne();
}
function clearAllArrow(){
    CesiumArrow.clearAll();
}
var planData;
function getPlanAll(){
    $.ajax({
        type : "post",
        url : "../../easyAPI/plan/getPlan.action",
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            showPlans(data);
            planData = data;
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("获取标签信息失败!");
        }
    });
}
function deletePlanById(planId){
    $.ajax({
        type : "post",
        url : "../../easyAPI/plan/delete.action",
        data : "planId="+planId,
        success : function(data) {
            if (data == 1) {
                clearAllArrow();
                getPlanAll();
            }else{
                console.log("删除作战方案失败!");
            };
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("删除作战方案失败!");
        }
    });
}
function showPlans(data){
    var content = '';
    for (var i = 0; i < data.length; i++) {
        content += '<div class="row ';
        (i % 2 == 0) ? content += 'sr-row-up' : content += 'sr-row-up-black';
        content += '"><div class="col-md-2 mycol"><i onclick="getPlanById(\''+data[i].planId
                + '\')" class="fa fa-map-marker myfa"></i></div><label class="col-md-9 mycol" onclick="getPlanById(\''
                + data[i].planId+'\')">'+data[i].planName+'</label><div class="col-md-1 mycol">'
                + '<i onclick="deletePlanById(\''+data[i].planId+'\')" class="fa fa-remove myfa"></i></div></div>';
    }
    $('#millayer').html(content);
}
function getPlanById(planId){
    for (var i = 0; i < planData.length; i++) {
        if(planId==planData[i].planId){
            var args = $.parseJSON(planData[i].planPos);
            CesiumArrow.showData(args);
            break;
        }
    }
}