From 25ce610f6ecca7325e7a743dc032c4a76559c63d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 02 Jul 2021 09:10:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap

---
 widgets/modelDiagram/Widget.js |  200 ++++++++++++++++++++++----------------------------
 1 files changed, 88 insertions(+), 112 deletions(-)

diff --git a/widgets/modelDiagram/Widget.js b/widgets/modelDiagram/Widget.js
index 9364133..067f034 100644
--- a/widgets/modelDiagram/Widget.js
+++ b/widgets/modelDiagram/Widget.js
@@ -3,16 +3,16 @@
 // 模块描述:显示坐标
 ///////////////////////////////////////////////////////////////////////////
 define([
-        'dojo/_base/declare',
-        'dojo/_base/lang',
-        'dojo/_base/array',
-        'dojo/_base/html',
-        'dojo/topic',
-        'jimu/BaseWidget',
-        'jimu/utils',
-        'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
-        'libs/zTree_v3/js/jquery.ztree.all'
-    ],
+    'dojo/_base/declare',
+    'dojo/_base/lang',
+    'dojo/_base/array',
+    'dojo/_base/html',
+    'dojo/topic',
+    'jimu/BaseWidget',
+    'jimu/utils',
+    'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
+    'libs/zTree_v3/js/jquery.ztree.all'
+],
     function (declare,
         lang,
         array,
@@ -93,42 +93,42 @@
                             title: '人偶',
                             value: './images/gltf/Cesium_Man.glb',
                             id: 100,
-                            num: [3, 3, 1, 1]
+                            num: [3, 3, 1, 1, 12, 1, 6]
                         }, {
                             title: '飞机',
                             value: './images/gltf/Cesium_Air.glb',
                             id: 101,
-                            num: [3, 3, 30, 30]
+                            num: [3, 3, 30, 30, 27, 3, 6]
                         }, {
                             title: '飞机2',
                             value: './images/gltf/CesiumDrone.glb',
                             id: 102,
-                            num: [3, 3, 7, 7]
+                            num: [3, 3, 7, 7, 17, 2, 6]
                         }, {
                             title: '装甲车',
                             value: './images/gltf/GroundVehicle.glb',
                             id: 103,
-                            num: [3, 3, 4, 9]
+                            num: [3, 3, 4, 9, 17, 1, 6]
                         }, {
                             title: '热气球',
                             value: './images/gltf/CesiumBalloon.glb',
                             id: 104,
-                            num: [3, 3, 1, 1]
+                            num: [3, 3, 15, 17, 33, 2, 6]
                         }, {
                             title: '牛奶车',
                             value: './images/gltf/CesiumMilkTruck.glb',
                             id: 105,
-                            num: [3, 3, 1, 1]
+                            num: [3, 3, 3, 5, 13, 1, 6]
                         }, {
                             title: '牛奶车gltf',
                             value: './images/gltf/CesiumMilkTruck.gltf',
                             id: 106,
-                            num: [3, 3, 1, 1]
+                            num: [3, 3, 3, 5, 13, 1, 6]
                         }, {
                             title: '人gltf',
                             value: './images/gltf/walk.gltf',
                             id: 107,
-                            num: [3, 3, 1, 1]
+                            num: [3, 3, 1, 1, 11, 1, 4]
                         }],
                         click: function (obj) {
                             layer.tips('选择了:' + obj.title, this.elem, {
@@ -139,11 +139,42 @@
                             dom.empty();
                             var str = `${obj.title} <i class="layui-icon layui-icon-down layui-font-12"></i>`
                             dom.append(str);
-                            that.setNum(obj.num)
+                            a = obj.num[2];
+                            b = obj.num[3];
+                            that.getInput();
+                            var neWnum = [obj.num[0], obj.num[1], obj.num[2] * that.scale, obj.num[3] * that.scale]
+                            that.setNum(neWnum);
+                            that.shijiaoC = obj.num[4];
+                            that.shijiaoW = obj.num[5];
+                            that.shijiaoG = obj.num[6];
                         }
                     });
                 });
-
+                var a = 1;
+                var b = 1;
+                $("#c").bind('input propertychange', function () {
+                    var a = $("#c").val();
+                    that.shijiaoC = a;
+                    console.log(that.shijiaoC)
+                })
+                $("#w").bind('input propertychange', function () {
+                    var a = $("#w").val();
+                    that.shijiaoW = a;
+                    console.log(that.shijiaoW)
+                })
+                $("#g").bind('input propertychange', function () {
+                    var a = $("#g").val();
+                    that.shijiaoG = a;
+                    console.log(that.shijiaoG)
+                })
+                $("#modelDiagrambeishu").on("input", function () {
+                    // $('#modelDiagramW').val();
+                    var it = $(this).val();
+                    $('#modelDiagramJW').val(a * it);
+                    // $('#modelDiagramH').val();
+                    $('#modelDiagramJH').val(b * it);
+                    // console.log(a, b, it)
+                });
 
             },
             urls: './images/gltf/Cesium_Man.glb',
@@ -153,20 +184,23 @@
                 $('#modelDiagramJW').val(num[2])
                 $('#modelDiagramJH').val(num[3])
             },
-            beginCesium: function (a, b, g, once) {
+            beginCesium: function (a, b, g, once, scale) {
                 var viewer = this.map,
                     that = this,
                     url = that.urls;
 
                 //静态
                 // var position = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468, 1000);
+
+                // console.log(a, b, g, scale)
+
                 var position = Cesium.Cartesian3.fromDegrees(a, b, g);
                 that.entityPeople = viewer.entities.add({ //viewer.trackedEntity跟随
                     name: url,
                     position: position,
                     model: {
                         uri: url,
-                        scale: 110
+                        scale: scale
                     },
                 });
 
@@ -174,38 +208,32 @@
 
                 if (once == 'once') {
                     // viewer.trackedEntity = that.entityPeople;
-                    that.map.camera.flyTo({
-                        destination: position,
-                        duration: 3
-                    });
+
+                    var gg = g + scale * that.shijiaoG;
+                    if (scale > 10000) {
+                        var aa = a;
+                        var bb = b;
+                        that.map.camera.flyTo({
+                            destination: Cesium.Cartesian3.fromDegrees(a, b, gg),
+                            duration: 3
+                        });
+                    } else {
+                        var aa = a + (scale * that.shijiaoC) / 100000;
+                        var bb = b + (scale * that.shijiaoW) / 100000;
+                        that.map.scene.camera.setView({
+                            destination: new Cesium.Cartesian3.fromDegrees(Number(aa), Number(bb), Number(gg)),
+                            orientation: {
+                                heading: Cesium.Math.toRadians(Number(265.00)),
+                                pitch: Cesium.Math.toRadians(Number(-15.98)),
+                                roll: Cesium.Math.toRadians(Number(360.00))
+                            }
+                        });
+                    }
+
+
                 }
 
 
-            },
-            entityPeople: '',
-            seeEntity: true,
-            openEntity: false,
-            time: '',
-            beginPlay: function () {
-                var postion = [116.058987, 28.973468, 1000],
-                    a = 116.058987,
-                    b = 28.973468,
-                    g = 1000;
-                this.time = setInterval(() => {
-
-                    if (this.openEntity) {
-                        // this.map.entities.remove(this.entityPeople)//删除entity
-                        // this.map.entities.remove(this.map.trackedEntity)//删除entity
-                        this.map.entities.removeAll();
-                    } else {
-                        a += 0.01;
-                        b += 0.01;
-                        // g += 0.01;
-                        this.beginCesium(a, b);
-                    }
-                    this.openEntity = !this.openEntity;
-                    console.log(this.openEntity)
-                }, 1000);
             },
             stopPlay: function () {
                 this.map.entities.removeAll();
@@ -227,18 +255,24 @@
                 this.a = $('#modelDiagramjdu').val() == '' ? 116.058987 : +$('#modelDiagramjdu').val();
                 this.b = $('#modelDiagramwdu').val() == '' ? 28.973468 : +$('#modelDiagramwdu').val();
                 this.g = $('#modelDiagramgdu').val() == '' ? 1000 : +$('#modelDiagramgdu').val();
+                this.scale = $('#modelDiagrambeishu').val() == '' ? 1000 : +$('#modelDiagrambeishu').val();
             },
             a: '',
             b: '',
             g: '',
+            scale: '',
+            shijiaoC: 12,
+            shijiaoW: 1,
+            shijiaoG: 4,
+
             //重复添加
             always: function (aa = 'a', bb = 'b') {
                 this.getInput();
                 // console.log([a, b, g])
                 if (aa != 'a' && bb != 'b') {
-                    this.beginCesium(aa, bb, this.g);
+                    this.beginCesium(aa, bb, this.g, '', this.scale);
                 } else {
-                    this.beginCesium(this.a, this.b, this.g);
+                    this.beginCesium(this.a, this.b, this.g, '', this.scale);
                 }
             },
             //单次添加
@@ -246,67 +280,9 @@
                 this.stopPlay();
                 this.getInput();
                 // console.log([a, b, g])
-                this.beginCesium(this.a, this.b, this.g, 'once');
+                this.beginCesium(this.a, this.b, this.g, 'once', this.scale);
             },
-            closeModo: function () {
-                if (this.openEntity) {
-                    // this.map.entities.remove(this.entityPeople)//删除entity
-                    // this.map.entities.remove(this.map.trackedEntity)//删除entity
-                    this.map.entities.removeAll();
-                } else {
-                    this.getInput
-                    // console.log([a, b, g])
-                    this.beginCesium(a, b, g);
-                }
-                this.openEntity = !this.openEntity;
-                console.log(this.openEntity)
-                // var that = this;
-                // if (that.seeEntity) {
-                // 	this.map.trackedEntity = that.entityPeople;//目标视野跟踪
-                // } else {
-                // 	this.map.trackedEntity = '';
-                // }
-                // viewer.entities.remove(that.entityPeople)//删除entity
 
-                // viewer.entities.removeById(id)//根据id删除entity
-
-                // viewer.entities.removeAll()//清空所有entity
-
-                // viewer.entities.getById(id)// 获取enetity
-
-                // viewer.entities.contains(entity)// 是否包含
-                // viewer.entities.removeById('')
-            },
-            beginModelDiagram: function () {
-                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({
-                        name: "gltf",
-                        position: new Cesium.Cartesian3.fromDegrees(115.783206 - 0.002034006, 28.810602 - 0.005072179, 800),
-                        model: {
-                            uri: url
-                        }
-                    });
-                viewer.zoomTo(gltf);
-                $("#modelDiagramSelOpt").change(function () {
-                    var value = $(this).val();
-                    if (value === "1") {
-                        collect.removeInstance(url, [collect._instances._array[0]._array[0].id]);
-                        viewer.entities._show = true;
-                    } else {
-                        viewer.entities._show = false;
-                        collect.add(url, {
-                            position: new Cesium.Cartesian3.fromDegrees(115.783206 - 0.002034006, 28.810602 - 0.005072179, 1000)
-                        });
-
-                    }
-                })
-            },
             onClose: function () {
                 //面板关闭的时候触发 (when this panel is closed trigger)
             },

--
Gitblit v1.9.3