北京经济技术开发区经开区虚拟城市项目-【前端】--政府服务中心-1号屏Web
Surpriseplus
2023-10-07 3371d6e613d8a8f13c769e1ac77f4fa2b76ccb24
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
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
import Vue from "vue";
import coord from "@/components/poplayer/coord";
import store from "@/utils/store";
import mapData from "../../../static/mapData";
import {
    liushisijiayuanqudizhibianmafuwu,
    findAddressCandidates,
    getDiKuanFanWei,
    ent_selectByName
} from "../../api/api";
import vueEvents from "@/utils/vueEvent.js";
let PoiLayerConstructor = Vue.extend(coord);
const rpc = {
    timeout: 500,
    method: "get_statue",
    divPoint: null,
    instance: null,
    pathLayer: null,
    position: null,
    marksIndex: null,
    pitchValue: null,
    unsubscribeTicks: null,
    LineRoaming: null, //线路漫游
    dataQuery: [], //关键字查询结果
    pointerFly: null, //定点漫游
    isShow: false,
    objArr: [],
    //关键字查询
    getFuzzyQuery(res) {
        store.queryLayer.val = res.message;
        this.setClearAllMsg();
        if (!res.baidu_keys) return;
        var flag = true;
        if (this.dataQuery.length > 0) {
            if (res.message.indexOf("第") > -1 && res.message.indexOf("条") > -1) {
                var data = mapData.msgMach.localPage;
                flag = false;
                var val_Data = null;
                for (var i in data) {
                    if (res.message.indexOf(data[i]) > -1) {
                        val_Data = this.dataQuery[i];
                        setTimeout(() => {
                            this.setLocation(val_Data);
                        }, 1000);
                        break;
                        return;
                    }
                }
            } else {
                for (var i in this.dataQuery) {
                    var name = this.dataQuery[i].name;
                    for (var j = 0; j < length; j++) {
                        var world = keyWorld[j].word;
                        if (name.indexOf(world) > -1) {
                            flag = false;
                            this.setLocation(this.dataQuery[i]);
                            break;
                            return;
                        }
                    }
                }
            }
        }
        if (!flag) {
            return;
        }
        var keyWorld = res.baidu_keys.results;
        if (keyWorld) {
            var length = keyWorld.length;
 
            this.dataQuery = [];
            this.objArr = [];
            for (var i = 0; i < length; i++) {
                var world = keyWorld[i].word;
                console.log("world", world);
                this.setFuzzyQueryData(world, i, length - 1);
            }
        }
    },
    async setFuzzyQueryData(res, index, length) {
        Promise.all([
            ent_selectByName(res), //企业
            liushisijiayuanqudizhibianmafuwu(res), //园区
            findAddressCandidates(res) //地块
        ]).then(result => {
            var that = this;
            store.queryLayer.data = [];
            //企业
            var EntArr = result[0].result.filter(item => {
                return item.entName.includes(res);
            });
            EntArr.forEach(val => {
                let itemObj = {
                    type: "企业",
                    name: val.entName,
                    address: val.address,
                    lon: val.x,
                    lat: val.y
                };
                that.objArr.push(itemObj);
            });
            //园区
            var YQArr = result[1].candidates.filter(item => {
                return item.attributes.YQmingchen.includes(res);
            });
            YQArr.forEach(val => {
                let itemObj = {
                    type: "园区",
                    name: val.attributes.YQmingchen,
                    address: val.attributes.YQdizhi,
                    lon: val.location.x,
                    lat: val.location.y
                };
                that.objArr.push(itemObj);
            });
            //地块
            var LandArr = result[2].candidates.filter((item) => {
                return item.attributes.QYMC.includes(res);
            })
            // 结果根据QYMC从短到长排序
            LandArr.sort((a, b) => (b.attributes.QYMC.length === a.attributes.QYMC.length ? 0 : a.attributes.QYMC.length > b.attributes.QYMC.length ? 1 : -1))
            LandArr.forEach((val) => {
                let itemObj = {
                    type: "地块",
                    name: val.attributes.QYMC,
                    area: val.attributes.area,
                    code: val.attributes["地块编"],
                    lon: val.location.x,
                    lat: val.location.y,
                };
                objArr.push(itemObj);
            });
            if (index == length) {
                if (that.objArr.length <= 0) {
 
                    vueEvents.$emit("queryData", true);
                    return;
                }
                var num = that.objArr.length;
                for (var i = 0; i < num; i++) {
                    if (i < 6) {
                        that.dataQuery.push(that.objArr[i]);
                    }
                }
                store.queryLayer.data = that.dataQuery;
                that.setClearAllMsg();
                setTimeout(() => {
                    vueEvents.$emit("queryData", true);
                    that.setLocation(that.dataQuery[0]);
                }, 1000);
            }
        });
    },
 
    getFuzzyQueryData(res, index, length, flag) {
        if (!res || res.length <= 0) return;
        for (var i in res) {
            if (this.dataQuery.length < 6) {
                this.dataQuery.push(res[i]);
            }
        }
        if (index == length) {
            if (this.dataQuery.length <= 0) {
                vueEvents.$emit("queryData", false);
                return;
            }
 
            store.queryLayer.data = this.dataQuery;
 
            this.setClearAllMsg();
 
            setTimeout(() => {
                vueEvents.$emit("queryData", true);
                this.setLocation(this.dataQuery[0]);
            }, 1000);
        }
    },
    // 显示地块范围
    getLandmass(res) {
        let that = this;
        // 划线
        getDiKuanFanWei(res.lon, res.lat).then(response => {
            let center = { lon: 0, lat: 0 };
            let polygon = that.read(response.geometry);
            if (polygon.length > 0) {
                var geometry = [];
                let points = polygon[0].split(",");
                for (let i = 0; i < points.length; i++) {
                    let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
                    center.lon += parseFloat(point[0]) / points.length;
                    center.lat += parseFloat(point[1]) / points.length;
                    geometry.push({
                        x: parseFloat(point[0]),
                        y: parseFloat(point[1]),
                        z: 0
                    });
                }
                if (that.lacationLine) {
                    sgworld.Creator.DeleteObject(that.lacationLine);
                    that.lacationLine = null;
                }
                that.lacationLine = sgworld.Creator.createPolyline(
                    geometry,
                    "#ff0000",
                    1,
                    0,
                    "线"
                );
            }
        });
    },
 
    read(wkt) {
        var regExes = {
            typeStr: /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
            emptyTypeStr: /^\s*(\w+)\s*EMPTY\s*$/,
            spaces: /\s+/,
            parenComma: /\)\s*,\s*\(/,
            doubleParenComma: /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
            trimParens: /^\s*\(?(.*?)\)?\s*$/
        };
        /**
         * Object with properties corresponding to the geometry types. Property values
         * are functions that do the actual parsing.
         * @private
         */
        var parse$1 = {
            /**
             * Return point geometry given a point WKT fragment.
             *
             * @param {String} str A WKT fragment representing the point.
             * @return {Point} A point geometry.
             * @private
             */
            point: function point(str) {
                if (str === undefined) {
                    return [];
                }
 
                var coords = str.trim().split(regExes.spaces);
                return [Number.parseFloat(coords[0]), Number.parseFloat(coords[1])];
            },
 
            /**
             * Return a multipoint geometry given a multipoint WKT fragment.
             *
             * @param {String} str A WKT fragment representing the multipoint.
             * @return {Point} A multipoint feature.
             * @private
             */
            multipoint: function multipoint(str) {
                var this$1 = this;
 
                if (str === undefined) {
                    return [];
                }
 
                var point;
                var points = str.trim().split(",");
                var components = [];
                for (var i = 0, len = points.length; i < len; ++i) {
                    point = points[i].replace(regExes.trimParens, "$1");
                    components.push(parse$1.point(point));
                }
                return components;
            },
 
            /**
             * Return a linestring geometry given a linestring WKT fragment.
             *
             * @param {String} str A WKT fragment representing the linestring.
             * @return {LineString} A linestring geometry.
             * @private
             */
            linestring: function linestring(str) {
                if (str === undefined) {
                    return [];
                }
 
                var points = str.trim().split(",");
                var components = [];
                var coords;
                for (var i = 0, len = points.length; i < len; ++i) {
                    coords = points[i].trim().split(regExes.spaces);
                    components.push([
                        Number.parseFloat(coords[0]),
                        Number.parseFloat(coords[1])
                    ]);
                }
                return components;
            },
 
            /**
             * Return a linearring geometry given a linearring WKT fragment.
             *
             * @param {String} str A WKT fragment representing the linearring.
             * @return {LinearRing} A linearring geometry.
             * @private
             */
            linearring: function linearring(str) {
                if (str === undefined) {
                    return [];
                }
 
                var points = str.trim().split(",");
                var components = [];
                var coords;
                for (var i = 0, len = points.length; i < len; ++i) {
                    coords = points[i].trim().split(regExes.spaces);
                    components.push([
                        Number.parseFloat(coords[0]),
                        Number.parseFloat(coords[1])
                    ]);
                }
                return components;
            },
 
            /**
             * Return a multilinestring geometry given a multilinestring WKT fragment.
             *
             * @param {String} str A WKT fragment representing the multilinestring.
             * @return {MultiLineString} A multilinestring geometry.
             * @private
             */
            multilinestring: function multilinestring(str) {
                var this$1 = this;
 
                if (str === undefined) {
                    return [];
                }
 
                var line;
                var lines = str.trim().split(regExes.parenComma);
                var components = [];
                for (var i = 0, len = lines.length; i < len; ++i) {
                    line = lines[i].replace(regExes.trimParens, "$1");
                    components.push(parse$1.linestring(line));
                }
                return components;
            },
 
            /**
             * Return a polygon geometry given a polygon WKT fragment.
             *
             * @param {String} str A WKT fragment representing the polygon.
             * @return {Polygon} A polygon geometry.
             * @private
             */
            polygon: function polygon(str) {
                var this$1 = this;
 
                if (str === undefined) {
                    return [];
                }
 
                var ring, linestring, linearring;
                var rings = str.trim().split(regExes.parenComma);
                var shell;
                var holes = [];
                //for (var i = 0, len = rings.length; i < len; ++i) {
                ring = rings[0].replace(regExes.trimParens, "$1");
                linestring = ring;
                //}
                return linestring;
            },
 
            /**
             * Return a multipolygon geometry given a multipolygon WKT fragment.
             *
             * @param {String} str A WKT fragment representing the multipolygon.
             * @return {MultiPolygon} A multipolygon geometry.
             * @private
             */
            multipolygon: function multipolygon(str) {
                var this$1 = this;
 
                if (str === undefined) {
                    return [];
                }
 
                var polygon;
                var polygons = str.trim().split(regExes.doubleParenComma);
                var components = [];
                for (var i = 0, len = polygons.length; i < len; ++i) {
                    polygon = polygons[i].replace(regExes.trimParens, "$1");
                    components.push(parse$1.polygon(polygon));
                }
                return components;
            }
        };
 
        var geometry, type, str;
        wkt = wkt.replace(/[\n\r]/g, " ");
        var matches = regExes.typeStr.exec(wkt);
        if (wkt.search("EMPTY") !== -1) {
            matches = regExes.emptyTypeStr.exec(wkt);
            matches[2] = undefined;
        }
        if (matches) {
            type = matches[1].toLowerCase();
            str = matches[2];
            if (parse$1[type]) {
                geometry = parse$1[type].apply(this, [str]);
            }
        }
 
        if (geometry === undefined) {
            throw new Error("Could not parse WKT " + wkt);
        }
 
        return geometry;
    },
 
    //地图复位
    setMapRest() {
        const data = mapData.mapRest;
        sgworld.Navigate.flyToPointsInterest({
            destination: {
                x: data.lng,
                y: data.lat,
                z: data.alt
            },
            orientation: {
                heading: data.heading,
                pitch: data.pitch,
                roll: data.roll
            },
            duration: 8 //飞行时间8s
        });
    },
 
    //动画导航
    setLineRoaming() {
        var valdata = mapData.animaNavigation;
        this.marksIndex = 1;
        this.pitchValue = -20;
        this.setShowPathLine(valdata);
        var geom = [];
        for (var i in valdata) {
            geom.push(valdata[i].lng, valdata[i].lat, valdata[i].height);
        }
 
        var that = this;
        sgworld.Creator.getFlyData(geom, data => {
            data.showPoint = false;
            data.showLine = false;
            data.mode = 1;
            data.pitch = -10;
            data.height = 75;
            data.speed = 25;
 
            that.LineRoaming = sgworld.Creator.createDynamicObject(
                data,
                null,
                res => {
                    if (res.time >= res.Totaltime) {
                        that.setCloseLineRomaing();
                        that.setMapRest();
                    }
                }
            );
        });
    },
    //点击获取坐标
    clickToCoordinates() {
        const handlerClick = new Cesium.ScreenSpaceEventHandler(
            Viewer.scene.canvas
        );
        handlerClick.setInputAction(event => {
            let cartesian = Viewer.camera.pickEllipsoid(
                event.position,
                Viewer.scene.globe.ellipsoid
            );
            if (cartesian == undefined) {
                console.log("没有获取到坐标");
            } else {
                // 空间坐标转世界坐标(弧度)
                let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
                // 弧度转为角度(经纬度)
                let lon = Cesium.Math.toDegrees(cartographic.longitude); // 经度值
                let lat = Cesium.Math.toDegrees(cartographic.latitude); // 纬度值
                console.log("经纬度是:", { x: lon, y: lat });
            }
        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    },
    //定位弹窗
    setLocation(res) {
        var objdata = {
            name: res.name,
            address: res.address,
            area: res.area,
            code: res.code,
            lat: res.lat,
            lon: res.lon
        };
 
        //添加定位弹窗
        this.setAddPointLocation(objdata);
        //范围调用
        this.getLandmass(res);
    },
 
    setAddPointLocation(res) {
        // 清除方法
        store.setlocalLayerShowAction(false);
        store.setlocalLayerListAction({});
        store.setlocalLayerShowAction(true);
        store.setlocalLayerListAction(res);
        this.instance = new PoiLayerConstructor({
            data: {
                list: res
            }
        });
        this.instance.$mount();
        this.divPoint = sgworld.Creator.createDivPoint(
            "",
            {
                lon: res.lon,
                lat: res.lat,
                height: 50
            },
            {
                type: "custom",
                offset: ["c", 100],
                description: this.instance.$el,
                near: 0,
                far: 100000
            }
        );
        this.position = window.Viewer.entities.add({
            name: "FLYToMap",
            position: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, 200),
            point: {
                pixelSize: 1,
                color: Cesium.Color.WHITE.withAlpha(0),
                outlineColor: Cesium.Color.WHITE.withAlpha(0.9),
                outlineWidth: 1
            }
        });
        window.Viewer.flyTo(this.position, {
            offset: {
                heading: Cesium.Math.toRadians(0.0),
                pitch: Cesium.Math.toRadians(-45),
                range: 700
            },
            duration: 3
        });
        setTimeout(() => {
            window.Viewer.entities.remove(this.position);
        }, 1000);
        setTimeout(() => {
            this.setPointFly(res);
        }, 4000);
    },
    setflyExtent(res) {
        if (this.unsubscribeTicks) {
            window.Viewer.clock.onTick.removeEventListener(this.unsubscribeTicks);
            this.unsubscribeTicks = null;
        }
        // 相机看点的角度,如果大于0那么则是从地底往上看,所以要为负值
        var pitch = Cesium.Math.toRadians(this.pitchValue);
        // 时间间隔2秒钟
        this.setExtentTime(res[this.marksIndex].flytime);
        var Exection = () => {
            var preIndex = this.marksIndex - 1;
            if (this.marksIndex == 0) {
                preIndex = res.length - 1;
            }
            var heading = this.bearing(
                res[preIndex].lat,
                res[preIndex].lng,
                res[this.marksIndex].lat,
                res[this.marksIndex].lng
            );
            heading = Cesium.Math.toRadians(heading);
            // 当前已经过去的时间,单位s
            var delTime = Cesium.JulianDate.secondsDifference(
                window.Viewer.clock.currentTime,
                window.Viewer.clock.startTime
            );
            var originLat =
                this.marksIndex == 0
                    ? res[res.length - 1].lat
                    : res[this.marksIndex - 1].lat;
            var originLng =
                this.marksIndex == 0
                    ? res[res.length - 1].lng
                    : res[this.marksIndex - 1].lng;
            var endPosition = Cesium.Cartesian3.fromDegrees(
                originLng +
                ((res[this.marksIndex].lng - originLng) /
                    res[this.marksIndex].flytime) *
                delTime,
                originLat +
                ((res[this.marksIndex].lat - originLat) /
                    res[this.marksIndex].flytime) *
                delTime,
                res[this.marksIndex].height
            );
 
            console.log(1, pitch);
            window.Viewer.scene.camera.setView({
                destination: endPosition,
                orientation: {
                    heading: heading,
                    pitch: Cesium.Math.toRadians(-5)
                }
            });
            if (
                Cesium.JulianDate.compare(
                    window.Viewer.clock.currentTime,
                    window.Viewer.clock.stopTime
                ) >= 0
            ) {
                this.unsubscribeTicks = window.Viewer.clock.onTick.removeEventListener(
                    Exection
                );
                this.changeCameraHeading(res);
            }
        };
        window.Viewer.clock.onTick.addEventListener(Exection);
    },
    setPointFly(res) {
        var that = this;
        that.pointerFly = window.sgworld.Analysis.setPointFly({
            position: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, 200),
            hideImage: true,
            time: 120,
            limitTime: true,
            limitAngel: 120,
            end: () => {
                that.pointerFly = null;
            }
        });
        setTimeout(() => {
            this.setClearPointFly();
        }, 5000);
    },
    changeCameraHeading(res) {
        var nextIndex = this.marksIndex + 1;
        if (this.marksIndex == res.length - 1) {
            if (this.unsubscribeTicks) {
                window.Viewer.clock.onTick.removeEventListener(this.unsubscribeTicks);
                this.unsubscribeTicks = null;
            }
            return;
        }
        // 计算两点之间的方向
        var heading = this.bearing(
            res[this.marksIndex].lat,
            res[this.marksIndex].lng,
            res[nextIndex].lat,
            res[nextIndex].lng
        );
        // 相机看点的角度,如果大于0那么则是从地底往上看,所以要为负值
        var pitch = Cesium.Math.toRadians(this.pitchValue);
        // 给定飞行一周所需时间,比如10s, 那么每秒转动度数
        var angle =
            (heading - Cesium.Math.toDegrees(window.Viewer.camera.heading)) / 2;
        // 时间间隔2秒钟
        this.setExtentTime(2);
        // 相机的当前heading
        var initialHeading = window.Viewer.camera.heading;
        var Exection = () => {
            // 当前已经过去的时间,单位s
            var delTime = Cesium.JulianDate.secondsDifference(
                window.Viewer.clock.currentTime,
                window.Viewer.clock.startTime
            );
            var heading = Cesium.Math.toRadians(delTime * angle) + initialHeading;
            window.Viewer.scene.camera.setView({
                orientation: {
                    heading: heading,
                    pitch: Cesium.Math.toRadians(-5)
                }
            });
            if (
                Cesium.JulianDate.compare(
                    window.Viewer.clock.currentTime,
                    window.Viewer.clock.stopTime
                ) >= 0
            ) {
                window.Viewer.clock.onTick.removeEventListener(Exection);
                this.marksIndex = ++this.marksIndex >= res.length ? 0 : this.marksIndex;
                this.setflyExtent(res);
            }
        };
        window.Viewer.clock.onTick.addEventListener(Exection);
    },
    bearing(startLat, startLng, destLat, destLng) {
        startLat = this.toRadians(startLat);
        startLng = this.toRadians(startLng);
        destLat = this.toRadians(destLat);
        destLng = this.toRadians(destLng);
 
        let y = Math.sin(destLng - startLng) * Math.cos(destLat);
        let x =
            Math.cos(startLat) * Math.sin(destLat) -
            Math.sin(startLat) * Math.cos(destLat) * Math.cos(destLng - startLng);
        let brng = Math.atan2(y, x);
        let brngDgr = this.toDegrees(brng);
        return (brngDgr + 360) % 360;
    },
    toRadians(degrees) {
        return (degrees * Math.PI) / 180;
    },
    toDegrees(radians) {
        return (radians * 180) / Math.PI;
    },
    setExtentTime(time) {
        var startTime = Cesium.JulianDate.fromDate(new Date());
        var stopTime = Cesium.JulianDate.addSeconds(
            startTime,
            time,
            new Cesium.JulianDate()
        );
        window.Viewer.clock.startTime = startTime.clone(); // 开始时间
        window.Viewer.clock.stopTime = stopTime.clone(); // 结速时间
        window.Viewer.clock.currentTime = startTime.clone(); // 当前时间
        window.Viewer.clock.clockRange = Cesium.ClockRange.CLAMPED; // 行为方式
        window.Viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK; // 时钟设置为当前系统时间; 忽略所有其他设置。
    },
    setShowPathLine(res) {
        var geom = [];
        for (var i in res) {
            geom.push([res[i].lng, res[i].lat]);
        }
 
        var url = {
            type: "FeatureCollection",
            features: [
                {
                    type: "Feature",
                    geometry: {
                        type: "LineString",
                        coordinates: geom
                    }
                }
            ]
        };
        this.pathLayer = window.sgworld.Creator.createPathLayer({
            url: url,
            color: "#0033FF", //线的颜色
            width: 4.0, //线的宽度
            pointColor: "#FFFFFF", //移动点的颜色
            speed: 5,
            far: 50000
        });
    },
    //结束事件
    setClearAllMsg() {
        if (this.divPoint) {
            this.divPoint && this.divPoint.deleteObject();
            this.divPoint = null;
        }
        if (this.instance) {
            this.instance && this.instance.$destroy();
            this.instance = null;
        }
        if (this.lacationLine) {
            sgworld.Creator.DeleteObject(this.lacationLine);
            this.lacationLine = null;
        }
        // 轨迹线
        this.setClosePathLine();
        // 漫游
        this.setCloseLineRomaing();
        //定点漫游
        this.setClearPointFly();
        vueEvents.$emit("queryLayer", false);
    },
    setClearPointFly() {
        if (this.pointerFly) {
            this.pointerFly && this.pointerFly.end();
            this.pointerFly = null;
        }
    },
    setCloseLineRomaing() {
        if (this.LineRoaming) {
            this.LineRoaming && this.LineRoaming.exit();
            this.LineRoaming = null;
        }
    },
    setClosePathLine() {
        if (this.pathLayer) {
            this.pathLayer && this.pathLayer.deleteObject();
        }
    }
};
export default rpc;