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 |  745 ++++++++++++++++++++++----------------------------------
 1 files changed, 295 insertions(+), 450 deletions(-)

diff --git a/widgets/modelDiagram/Widget.js b/widgets/modelDiagram/Widget.js
index d2cca48..067f034 100644
--- a/widgets/modelDiagram/Widget.js
+++ b/widgets/modelDiagram/Widget.js
@@ -3,464 +3,309 @@
 // 模块描述:显示坐标
 ///////////////////////////////////////////////////////////////////////////
 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,
-		html,
-		topic,
-		BaseWidget,
-		aspect,
-		string,
-		utils
-	) {
-		return declare([BaseWidget], {
-			baseClass: 'jimu-widget-modelDiagram',
-			name: 'modelDiagram',
-			layers: {},
-			startup: function () {
-				var that = this;
-				// 暴露在外的接口
-				// that.beginModelDiagram();
-				// that.beginCesium();
+    function (declare,
+        lang,
+        array,
+        html,
+        topic,
+        BaseWidget,
+        aspect,
+        string,
+        utils
+    ) {
+        return declare([BaseWidget], {
+            baseClass: 'jimu-widget-modelDiagram',
+            name: 'modelDiagram',
+            layers: {},
+            startup: function () {
+                var that = this;
+                // 暴露在外的接口
+                // that.beginModelDiagram();
+                // that.beginCesium();
 
-				$('.seemodo').click(() => {
-					that.seemodo();
-				})
+                // 三个按钮事件
+                $('.jimu-widget-modelDiagram').find('.once').click(() => {
+                    that.once();
+                })
+                $('.jimu-widget-modelDiagram').find('.always').click(() => {
+                    that.always();
+                })
+                $('.jimu-widget-modelDiagram').find('.stopPlay').click(() => {
+                    that.stopPlay();
+                })
 
-				$('.closemodo').click(() => {
-					that.closeModo();
-				})
-				$('.beginPlay').click(() => {
-					that.beginPlay();
-				})
-				$('.stopPlay').click(() => {
-					that.stopPlay();
-				})
-				$('.closesmodelDiagram').click(() => {
-					console.log(3423)
-					$('.jimu-widget-modelDiagram').hide();
-					if (that.openEntity) {
-						that.map.entities.removeAll();
-					}
-				})
+                $('.jimu-widget-modelDiagram').find('.always').unbind("mousedown").bind("mousedown", function (event) {
+                    if (event.which == 3) {
+                        // console.log('you');
+                        if ($("#modelDiagramCHONGFU").is(":hidden")) { //判断是否隐藏
+                            $('#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;
+                                for (var i = 1; i <= H; i++) {
+                                    var aa = as * 100000;
+                                    aa += i * JH;
+                                    aa = aa / 100000;
+                                    for (var n = 1; n <= W; n++) {
+                                        var bb = bs * 100000;
+                                        bb += n * JW;
+                                        bb = bb / 100000;
+                                        // console.log(aa,bb)
+                                        that.always(aa, bb);
+                                    }
+                                }
+                            })
+                            $('#modelDNo').click(() => {
+                                $('#modelDiagramCHONGFU').hide();
+                            })
+                        }
+                    } else if (event.which == 1) {
+                        // console.log('zuo');
+                    }
+                });
 
-			},
-			beginCesium: function (a = 116.058987, b = 28.973468, g = 1000) {
-				var viewer = this.map
-					, that = this
-					, url = "./images/gltf/Cesium_Man.glb";
-				// var startPosition = new Cesium.Cartesian3(
-				// 	116.058987,
-				// 	28.973468,
-				// 	1000
-				// );
-				// var endPosition = new Cesium.Cartesian3(
-				// 	116.158987,
-				// 	29.073468,
-				// 	1000
-				// );
-				// var position = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468);
-				//动态 //缺少viewer.timeline时间轴
-				//Make sure viewer is at the desired time.
-				//Make sure viewer is at the desired time.
-				// var start = Cesium.JulianDate.fromDate(new Date(2018, 11, 12, 15));
-				// var totalSeconds = 10;
-				// var stop = Cesium.JulianDate.addSeconds(
-				// 	start,
-				// 	totalSeconds,
-				// 	new Cesium.JulianDate()
-				// );
-				// viewer.clock.startTime = start.clone();
-				// viewer.clock.stopTime = stop.clone();
-				// viewer.clock.currentTime = start.clone();
-				// viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
-				// // console.log(viewer.timeline,111)
-				// viewer.timeline.zoomTo = function (startTime, stopTime) {
-				// 	//>>includeStart('debug', pragmas.debug);
-				// 	if (!defined(startTime)) {
-				// 		throw new DeveloperError("startTime is required.");
-				// 	}
-				// 	if (!defined(stopTime)) {
-				// 		throw new DeveloperError("stopTime is required");
-				// 	}
-				// 	if (JulianDate.lessThanOrEquals(stopTime, startTime)) {
-				// 		throw new DeveloperError("Start time must come before end time.");
-				// 	}
-				// 	//>>includeEnd('debug');
+                $('.jimu-widget-modelDiagram').find('.closesmodelDiagram').click(() => {
+                    $('.jimu-widget-modelDiagram').hide();
+                    that.stopPlay();
+                })
+                //初演示
+                layui.use(['dropdown', 'util', 'layer', 'table'], function () {
+                    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, 12, 1, 6]
+                        }, {
+                            title: '飞机',
+                            value: './images/gltf/Cesium_Air.glb',
+                            id: 101,
+                            num: [3, 3, 30, 30, 27, 3, 6]
+                        }, {
+                            title: '飞机2',
+                            value: './images/gltf/CesiumDrone.glb',
+                            id: 102,
+                            num: [3, 3, 7, 7, 17, 2, 6]
+                        }, {
+                            title: '装甲车',
+                            value: './images/gltf/GroundVehicle.glb',
+                            id: 103,
+                            num: [3, 3, 4, 9, 17, 1, 6]
+                        }, {
+                            title: '热气球',
+                            value: './images/gltf/CesiumBalloon.glb',
+                            id: 104,
+                            num: [3, 3, 15, 17, 33, 2, 6]
+                        }, {
+                            title: '牛奶车',
+                            value: './images/gltf/CesiumMilkTruck.glb',
+                            id: 105,
+                            num: [3, 3, 3, 5, 13, 1, 6]
+                        }, {
+                            title: '牛奶车gltf',
+                            value: './images/gltf/CesiumMilkTruck.gltf',
+                            id: 106,
+                            num: [3, 3, 3, 5, 13, 1, 6]
+                        }, {
+                            title: '人gltf',
+                            value: './images/gltf/walk.gltf',
+                            id: 107,
+                            num: [3, 3, 1, 1, 11, 1, 4]
+                        }],
+                        click: function (obj) {
+                            layer.tips('选择了:' + obj.title, this.elem, {
+                                tips: [1, '#5FB878']
+                            });
+                            that.urls = obj.value;
+                            var dom = $('.models');
+                            dom.empty();
+                            var str = `${obj.title} <i class="layui-icon layui-icon-down layui-font-12"></i>`
+                            dom.append(str);
+                            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)
+                });
 
-				// 	this._startJulian = startTime;
-				// 	this._endJulian = stopTime;
-				// 	this._timeBarSecondsSpan = JulianDate.secondsDifference(stopTime, startTime);
+            },
+            urls: './images/gltf/Cesium_Man.glb',
+            setNum: function (num) {
+                $('#modelDiagramW').val(num[0])
+                $('#modelDiagramH').val(num[1])
+                $('#modelDiagramJW').val(num[2])
+                $('#modelDiagramJH').val(num[3])
+            },
+            beginCesium: function (a, b, g, once, scale) {
+                var viewer = this.map,
+                    that = this,
+                    url = that.urls;
 
-				// 	// If clock is not unbounded, clamp timeline range to clock.
-				// 	if (this._clock && this._clock.clockRange !== ClockRange$1.UNBOUNDED) {
-				// 		var clockStart = this._clock.startTime;
-				// 		var clockEnd = this._clock.stopTime;
-				// 		var clockSpan = JulianDate.secondsDifference(clockEnd, clockStart);
-				// 		var startOffset = JulianDate.secondsDifference(
-				// 			clockStart,
-				// 			this._startJulian
-				// 		);
-				// 		var endOffset = JulianDate.secondsDifference(clockEnd, this._endJulian);
+                //静态
+                // var position = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468, 1000);
 
-				// 		if (this._timeBarSecondsSpan >= clockSpan) {
-				// 			// if new duration longer than clock range duration, clamp to full range.
-				// 			this._timeBarSecondsSpan = clockSpan;
-				// 			this._startJulian = this._clock.startTime;
-				// 			this._endJulian = this._clock.stopTime;
-				// 		} else if (startOffset > 0) {
-				// 			// if timeline start is before clock start, shift right
-				// 			this._endJulian = JulianDate.addSeconds(
-				// 				this._endJulian,
-				// 				startOffset,
-				// 				new JulianDate()
-				// 			);
-				// 			this._startJulian = clockStart;
-				// 			this._timeBarSecondsSpan = JulianDate.secondsDifference(
-				// 				this._endJulian,
-				// 				this._startJulian
-				// 			);
-				// 		} else if (endOffset < 0) {
-				// 			// if timeline end is after clock end, shift left
-				// 			this._startJulian = JulianDate.addSeconds(
-				// 				this._startJulian,
-				// 				endOffset,
-				// 				new JulianDate()
-				// 			);
-				// 			this._endJulian = clockEnd;
-				// 			this._timeBarSecondsSpan = JulianDate.secondsDifference(
-				// 				this._endJulian,
-				// 				this._startJulian
-				// 			);
-				// 		}
-				// 	}
+                // console.log(a, b, g, scale)
 
-				// 	this._makeTics();
-
-				// 	var evt = document.createEvent("Event");
-				// 	evt.initEvent("setzoom", true, true);
-				// 	evt.startJulian = this._startJulian;
-				// 	evt.endJulian = this._endJulian;
-				// 	evt.epochJulian = this._epochJulian;
-				// 	evt.totalSpan = this._timeBarSecondsSpan;
-				// 	evt.mainTicSpan = this._mainTicSpan;
-				// 	this._topDiv.dispatchEvent(evt);
-				// }
-				// viewer.timeline.zoomTo(start, stop);
-
-				// // Create a path for our vehicle by lerping between two positions.
-				// var position = new Cesium.SampledPositionProperty();
-				// var startPosition = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468, 1000);
-				// var endPosition = Cesium.Cartesian3.fromDegrees(116.158987, 29.073468, 1000);
-				// // var startPosition = new Cesium.Cartesian3(
-				// // 	-2379556.799372864,
-				// // 	-4665528.205030263,
-				// // 	3628013.106599678
-				// // );
-				// // var endPosition = new Cesium.Cartesian3(
-				// // 	-2379603.7074103747,
-				// // 	-4665623.48990283,
-				// // 	3627860.82704567
-				// // );
-				// // A velocity vector property will give us the entity's speed and direction at any given time.
-				// var velocityVectorProperty = new Cesium.VelocityVectorProperty(
-				// 	position,
-				// 	false
-				// );
-				// var velocityVector = new Cesium.Cartesian3();
-				// // Store the wheel's rotation over time in a SampledProperty.
-				// var wheelAngleProperty = new Cesium.SampledProperty(Number);
-				// var wheelAngle = 0;
-
-				// var numberOfSamples = 100;
-				// for (var i = 0; i <= numberOfSamples; ++i) {
-				// 	var factor = i / numberOfSamples;
-				// 	var time = Cesium.JulianDate.addSeconds(
-				// 		start,
-				// 		factor * totalSeconds,
-				// 		new Cesium.JulianDate()
-				// 	);
-
-				// 	// Lerp using a non-linear factor so that the vehicle accelerates.
-				// 	var locationFactor = Math.pow(factor, 2);
-				// 	var location = Cesium.Cartesian3.lerp(
-				// 		startPosition,
-				// 		endPosition,
-				// 		locationFactor,
-				// 		new Cesium.Cartesian3()
-				// 	);
-				// 	position.addSample(time, location);
-				// 	// Rotate the wheels based on how fast the vehicle is moving at each timestep.
-				// 	velocityVectorProperty.getValue(time, velocityVector);
-				// 	var metersPerSecond = Cesium.Cartesian3.magnitude(velocityVector);
-				// 	var wheelRadius = 0.52; //in meters.
-				// 	var circumference = Math.PI * wheelRadius * 2;
-				// 	var rotationsPerSecond = metersPerSecond / circumference;
-
-				// 	wheelAngle +=
-				// 		((Math.PI * 2 * totalSeconds) / numberOfSamples) *
-				// 		rotationsPerSecond;
-				// 	wheelAngleProperty.addSample(time, wheelAngle);
-				// }
-
-				// function updateSpeedLabel(time, result) {
-				// 	velocityVectorProperty.getValue(time, velocityVector);
-				// 	var metersPerSecond = Cesium.Cartesian3.magnitude(velocityVector);
-				// 	var kmPerHour = Math.round(metersPerSecond * 3.6);
-
-				// 	return kmPerHour + " km/hr";
-				// }
-
-				// var rotationProperty = new Cesium.CallbackProperty(function (
-				// 	time,
-				// 	result
-				// ) {
-				// 	return Cesium.Quaternion.fromAxisAngle(
-				// 		Cesium.Cartesian3.UNIT_X,
-				// 		wheelAngleProperty.getValue(time),
-				// 		result
-				// 	);
-				// },
-				// 	false);
-
-				// var wheelTransformation = new Cesium.NodeTransformationProperty({
-				// 	rotation: rotationProperty,
-				// });
-
-				// var nodeTransformations = {
-				// 	Wheels: wheelTransformation,
-				// 	Wheels_mid: wheelTransformation,
-				// 	Wheels_rear: wheelTransformation,
-				// };
-
-				// // Add our vehicle model.
-				// var vehicleEntity = viewer.entities.add({
-				// 	position: position,
-				// 	orientation: new Cesium.VelocityOrientationProperty(position), // Automatically set the vehicle's orientation to the direction it's facing.
-				// 	model: {
-				// 		uri: url,
-				// 		runAnimations: false,
-				// 		nodeTransformations: nodeTransformations,
-				// 	},
-				// 	label: {
-				// 		text: new Cesium.CallbackProperty(updateSpeedLabel, false),
-				// 		font: "20px sans-serif",
-				// 		showBackground: true,
-				// 		distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
-				// 			0.0,
-				// 			100.0
-				// 		),
-				// 		eyeOffset: new Cesium.Cartesian3(0, 3.5, 0),
-				// 	},
-				// });
-
-				// viewer.trackedEntity = vehicleEntity;
-				// vehicleEntity.viewFrom = new Cesium.Cartesian3(-10.0, 7.0, 4.0);
-
-				//静态
-				// var position = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468, 1000);
-				var position = Cesium.Cartesian3.fromDegrees(a, b, g);
-				viewer.trackedEntity = viewer.entities.add({//viewer.trackedEntity跟随
-					name: url,
-					position: position,
-					model: {
-						uri: url,
-					},
-				});
-				that.entityPeople = viewer.trackedEntity;
-
-				// var viewModel = {// 以下是工具栏
-				// 	blackAndWhiteShow: false,
-				// 	blackAndWhiteGradations: 5.0,
-				// 	brightnessShow: false,
-				// 	brightnessValue: 0.5,
-				// 	nightVisionShow: false,
-				// 	silhouette: false,
-				// };
-
-				// Cesium.knockout.track(viewModel);
-				// var toolbar = document.getElementById("toolbarcesium");
-				// Cesium.knockout.applyBindings(viewModel, toolbar);
-				// for (var name in viewModel) {
-				// 	if (viewModel.hasOwnProperty(name)) {
-				// 		Cesium.knockout
-				// 			.getObservable(viewModel, name)
-				// 			.subscribe(updatePostProcess);
-				// 	}
-				// }
-
-				// if (
-				// 	!Cesium.PostProcessStageLibrary.isSilhouetteSupported(viewer.scene)
-				// ) {
-				// 	window.alert(
-				// 		"This browser does not support the silhouette post process."
-				// 	);
-				// }
-
-				// var stages = viewer.scene.postProcessStages;
-				// var silhouette = stages.add(
-				// 	Cesium.PostProcessStageLibrary.createSilhouetteStage()
-				// );
-				// var blackAndWhite = stages.add(
-				// 	Cesium.PostProcessStageLibrary.createBlackAndWhiteStage()
-				// );
-				// var brightness = stages.add(
-				// 	Cesium.PostProcessStageLibrary.createBrightnessStage()
-				// );
-				// var nightVision = stages.add(
-				// 	Cesium.PostProcessStageLibrary.createNightVisionStage()
-				// );
-
-				// function updatePostProcess() {
-				// 	silhouette.enabled = Boolean(viewModel.silhouette);
-				// 	silhouette.uniforms.color = Cesium.Color.YELLOW;
-				// 	blackAndWhite.enabled = Boolean(viewModel.blackAndWhiteShow);
-				// 	blackAndWhite.uniforms.gradations = Number(
-				// 		viewModel.blackAndWhiteGradations
-				// 	);
-				// 	brightness.enabled = Boolean(viewModel.brightnessShow);
-				// 	brightness.uniforms.brightness = Number(viewModel.brightnessValue);
-				// 	nightVision.enabled = Boolean(viewModel.nightVisionShow);
-				// }
-				// updatePostProcess();
-
-			},
-			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();
-				clearInterval(this.time);
-			},
-			seemodo: function () {
-				var that = this;
-				if (that.seeEntity) {
-					this.map.trackedEntity = that.entityPeople;//目标视野跟踪
-				} else {
-					this.map.trackedEntity = '';
-				}
-				that.seeEntity = !that.seeEntity;
-				console.log(that.seeEntity)
-				// console.log('seedom')
-				// this.map.entities.remove(this.entityPeople)//删除entity
-			},
-			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 {
-					var a = $('#modelDiagramjdu').val() == '' ? 116.058987 : +$('#modelDiagramjdu').val();
-					var b = $('#modelDiagramwdu').val() == '' ? 28.973468 : +$('#modelDiagramwdu').val();
-					var g = $('#modelDiagramgdu').val() == '' ? 1000 : +$('#modelDiagramgdu').val();
-					// 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)
-			},
-
-			onMinimize: function () {
-				this.resize();
-			},
-
-			onMaximize: function () {
-				this.resize();
-			},
-
-			resize: function () {
-
-			},
+                var position = Cesium.Cartesian3.fromDegrees(a, b, g);
+                that.entityPeople = viewer.entities.add({ //viewer.trackedEntity跟随
+                    name: url,
+                    position: position,
+                    model: {
+                        uri: url,
+                        scale: scale
+                    },
+                });
 
 
-			destroy: function () {
-				//销毁的时候触发
-				//todo
-				//do something before this func
-				this.inherited(arguments);
-			}
 
-		});
-	});
\ No newline at end of file
+                if (once == 'once') {
+                    // viewer.trackedEntity = that.entityPeople;
+
+                    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))
+                            }
+                        });
+                    }
+
+
+                }
+
+
+            },
+            stopPlay: function () {
+                this.map.entities.removeAll();
+                // clearInterval(this.time);
+            },
+            seemodo: function () {
+                var that = this;
+                if (that.seeEntity) {
+                    this.map.trackedEntity = that.entityPeople; //目标视野跟踪
+                } else {
+                    this.map.trackedEntity = '';
+                }
+                that.seeEntity = !that.seeEntity;
+                console.log(that.seeEntity)
+                // console.log('seedom')
+                // this.map.entities.remove(this.entityPeople)//删除entity
+            },
+            getInput: function () {
+                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.scale);
+                } else {
+                    this.beginCesium(this.a, this.b, this.g, '', this.scale);
+                }
+            },
+            //单次添加
+            once: function () {
+                this.stopPlay();
+                this.getInput();
+                // console.log([a, b, g])
+                this.beginCesium(this.a, this.b, this.g, 'once', this.scale);
+            },
+
+            onClose: function () {
+                //面板关闭的时候触发 (when this panel is closed trigger)
+            },
+
+            onMinimize: function () {
+                this.resize();
+            },
+
+            onMaximize: function () {
+                this.resize();
+            },
+
+            resize: function () {
+
+            },
+
+
+            destroy: function () {
+                //销毁的时候触发
+                //todo
+                //do something before this func
+                this.inherited(arguments);
+            }
+
+        });
+    });
\ No newline at end of file

--
Gitblit v1.9.3