liuyg
2021-06-28 3597dfbb9e33ab955d259df876d72a99dc817d2a
widgets/modelDiagram/Widget.js
@@ -51,12 +51,12 @@
                     $('#modelDiagramCHONGFU').show();
                     $('#modelDYes').click(() => {
                        that.getInput();
                        var W = $('#modelDiagramW').val()
                           , H = $('#modelDiagramH').val()
                           , JW = $('#modelDiagramJW').val()
                           , JH = $('#modelDiagramJH').val()
                           , as = that.a - (0.00001 * ((+H + 1) / 2)) * JH
                           , bs = that.b - (0.00001 * ((+W + 1) / 2)) * JW;
                                var W = $('#modelDiagramW').val(),
                                    H = $('#modelDiagramH').val(),
                                    JW = $('#modelDiagramJW').val(),
                                    JH = $('#modelDiagramJH').val(),
                                    as = that.a - (0.00001 * ((+H + 1) / 2)) * JH,
                                    bs = that.b - (0.00001 * ((+W + 1) / 2)) * JW;
                        for (var i = 1; i <= H; i++) {
                           var aa = as * 100000;
                           aa += i * JH;
@@ -85,54 +85,55 @@
            })
            //初演示
            layui.use(['dropdown', 'util', 'layer', 'table'], function () {
               var dropdown = layui.dropdown
                  , layer = layui.layer;
                    var dropdown = layui.dropdown,
                        layer = layui.layer;
               dropdown.render({
                  elem: '.models'
                  , data: [{
                     title: '人偶'
                     , value: './images/gltf/Cesium_Man.glb'
                     , id: 100
                     , num: [3, 3, 1, 1]
                        elem: '.models',
                        data: [{
                            title: '人偶',
                            value: './images/gltf/Cesium_Man.glb',
                            id: 100,
                            num: [3, 3, 1, 1]
                  }, {
                     title: '飞机'
                     , value: './images/gltf/Cesium_Air.glb'
                     , id: 101
                     , num: [3, 3, 30, 30]
                            title: '飞机',
                            value: './images/gltf/Cesium_Air.glb',
                            id: 101,
                            num: [3, 3, 30, 30]
                  }, {
                     title: '飞机2'
                     , value: './images/gltf/CesiumDrone.glb'
                     , id: 102
                     , num: [3, 3, 7, 7]
                            title: '飞机2',
                            value: './images/gltf/CesiumDrone.glb',
                            id: 102,
                            num: [3, 3, 7, 7]
                  }, {
                     title: '装甲车'
                     , value: './images/gltf/GroundVehicle.glb'
                     , id: 103
                     , num: [3, 3, 4, 9]
                            title: '装甲车',
                            value: './images/gltf/GroundVehicle.glb',
                            id: 103,
                            num: [3, 3, 4, 9]
                  }, {
                     title: '热气球'
                     , value: './images/gltf/CesiumBalloon.glb'
                     , id: 104
                     , num: [3, 3, 1, 1]
                            title: '热气球',
                            value: './images/gltf/CesiumBalloon.glb',
                            id: 104,
                            num: [3, 3, 1, 1]
                  }, {
                     title: '牛奶车'
                     , value: './images/gltf/CesiumMilkTruck.glb'
                     , id: 105
                     , num: [3, 3, 1, 1]
                            title: '牛奶车',
                            value: './images/gltf/CesiumMilkTruck.glb',
                            id: 105,
                            num: [3, 3, 1, 1]
                  }, {
                     title: '牛奶车gltf'
                     , value: './images/gltf/CesiumMilkTruck.gltf'
                     , id: 106
                     , num: [3, 3, 1, 1]
                            title: '牛奶车gltf',
                            value: './images/gltf/CesiumMilkTruck.gltf',
                            id: 106,
                            num: [3, 3, 1, 1]
                  }, {
                     title: '人gltf'
                     , value: './images/gltf/walk.gltf'
                     , id: 107
                     , num: [3, 3, 1, 1]
                  }
                  ]
                  , click: function (obj) {
                     layer.tips('选择了:' + obj.title, this.elem, { tips: [1, '#5FB878'] });
                            title: '人gltf',
                            value: './images/gltf/walk.gltf',
                            id: 107,
                            num: [3, 3, 1, 1]
                        }],
                        click: function (obj) {
                            layer.tips('选择了:' + obj.title, this.elem, {
                                tips: [1, '#5FB878']
                            });
                     that.urls = obj.value;
                     var dom = $('.models');
                     dom.empty();
@@ -153,9 +154,9 @@
            $('#modelDiagramJH').val(num[3])
         },
         beginCesium: function (a, b, g, once) {
            var viewer = this.map
               , that = this
               , url = that.urls;
                var viewer = this.map,
                    that = this,
                    url = that.urls;
            //静态
            // var position = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468, 1000);
@@ -165,10 +166,18 @@
               position: position,
               model: {
                  uri: url,
                        scale: 110
               },
            });
            if (once == 'once') {
               viewer.trackedEntity = that.entityPeople;
                    // viewer.trackedEntity = that.entityPeople;
                    that.map.camera.flyTo({
                        destination: position,
                        duration: 3
                    });
            }
@@ -178,10 +187,10 @@
         openEntity: false,
         time: '',
         beginPlay: function () {
            var postion = [116.058987, 28.973468, 1000]
               , a = 116.058987
               , b = 28.973468
               , g = 1000;
                var postion = [116.058987, 28.973468, 1000],
                    a = 116.058987,
                    b = 28.973468,
                    g = 1000;
            this.time = setInterval(() => {
               if (this.openEntity) {
@@ -269,14 +278,14 @@
            // viewer.entities.removeById('')
         },
         beginModelDiagram: function () {
            var that = this
               , viewer = that.map
               , scene = viewer.scene;
                var that = this,
                    viewer = that.map,
                    scene = viewer.scene;
            // scene.globe.show = false;
            viewer.shouldAnimate = true;
            var collect = new Cesium.InstanceLayer(scene._context)
               , url = "./images/gltf/walk.gltf"
               , gltf = viewer.entities.add({
                var collect = new Cesium.InstanceLayer(scene._context),
                    url = "./images/gltf/walk.gltf",
                    gltf = viewer.entities.add({
                  name: "gltf",
                  position: new Cesium.Cartesian3.fromDegrees(115.783206 - 0.002034006, 28.810602 - 0.005072179, 800),
                  model: {
@@ -291,8 +300,7 @@
                  viewer.entities._show = true;
               } else {
                  viewer.entities._show = false;
                  collect.add(url,
                     {
                        collect.add(url, {
                        position: new Cesium.Cartesian3.fromDegrees(115.783206 - 0.002034006, 28.810602 - 0.005072179, 1000)
                     });