var UE = { billboards: [], id: "map", url: "http://127.0.0.1:96", mainUrl: location.href.substring(0, location.href.lastIndexOf("/") + 1), view: { x: 116.5139265, //116.51411, y: 39.7725406 //39.799614 }, map: null, init: function () { var that = this; this.map = new TUMap({ id: this.id, url: this.url, onInit: function () { that.inited(); } }); }, inited: function () { // x, y, z, roll, pitch, yaw, distance, callBack, time //this.map.flyToGIS(this.view.x, this.view.y, 0, 0, -45, 0, 30000, null, 5); this.map.flyTo(-554198.375, -964085.9375, 0, 0, -27, -120, 60000, null, 3); Videos.length = 10; // this.addVideos(Videos); var that = this; this.map.EnableBillboardCallBack(true, function (data) { console.log(data) }); }, // 添加视频点 addVideos: function (data) { this.removeVideos(); for (var i = 0, c = data.length; i < c; i++) { var x = parseFloat(data[i].longitude), y = parseFloat(data[i].latitude); if (x == 0 || y == 0) continue; var p = this.map.transformWGS84ToLocal(x, y); var bb = this.map.createBillboard({ x: p.x, y: p.y, z: 500, //vectorType: "WGS84", image: this.mainUrl + "UE/Video.png", scale: 0.25, clickedScale: 0.3, visibility: true, flash: false, canClick: true // , // alertWindow: {//可选,点击弹窗 // url: this.mainUrl + "UE/video?channelId=" + data[i].channelId,//弹窗地址 // size: new TUVector2(300, 200),//弹窗大小 // offset: new TUVector2(0, -200)//弹窗位置,右:x正,下:y正 // } }); } this.billboards.push(bb); }, // 添加视频点 removeVideos: function () { this.billboards.forEach(function (b) { b.removeFromMap(); }); this.billboards.length = 0; }, flyTo: function (x, y, pitch, distance, time) { this.map.flyToGIS(x, y, 0, 0, pitch || -45, 0, distance || 15000, null, time || 5); }, test: function () { this.map.flyToGIS(this.view.x, this.view.y, 0, 0, 0, 90, 750, null, 3); } } window.onload = function () { UE.init(); }