function ciy_chart_bank1_c2(opdata) { this.func = ['bank_c2']; this.lastdata = {}; this.resize = function () { } this.showpopup = function (html, pos) { if (thos.popup) thos.popup.remove(); var oset = $5(opdata.container).offset(); thos.popup = $5(''); thos.popup.css({ top: pos.y - oset.top, left: pos.x - oset.left, opacity: 1 }); opdata.container.append(thos.popup); return thos.popup; //showfarm(data.entity.ciydata); } this.hidepopup = function () { if (thos.popup) { thos.popup.css({ opacity: 0 }); setTimeout(function () { console.log('timeout remove'); thos.popup.remove(); thos.popup = null; }, 500); } } this.setdata = function (funame, data) { if (!data) return; this.lastdata[funame] = data; if (thos.ce) return; thos.ce = new ciyearth(); var mapset = { wmts_source: 4, wmts_style: 2, setin: 2, setop: 1 }; mapset.domid = $5('#map1', opdata.container)[0]; mapset.personheight = 1.8; mapset.flys = mapset.flys || []; thos.ce.init(mapset); thos.ce.viewer.scene.screenSpaceCameraController._zoomFactor = 1; var positions = []; for (var i in data.bplants) { var dat = data.bplants[i]; if (dat.lat > -0.001 && dat.lat < 0.001) continue; dat.img = '/ud/bill/map' + dat.cmcode + '.png'; dat.width = 20; dat.height = 27; var marker = thos.ce.addmarker(dat); marker.ciydata = dat; positions.push(marker.position._value); } thos.ce.viewer.camera.flyToBoundingSphere(new Cesium.BoundingSphere.fromPoints(positions), { duration: 1, offset: new Cesium.HeadingPitchRange(0, -1.57, 0) }); thos.ce.ciyevent = function (type, act, data, data2) { if (type == 'map') { if (act == 'movestart') { console.log('movestart'); thos.hidepopup(); } } else if (type == 'entity') { if (act == 'leftclick' && data.entity) { console.log(data); var mas = data.entity.ciydata; var html = '
'; html += '
' + mas.name + '
'; if (mas.lxrname) html += '
联系人:' + mas.lxrname + '
'; html += '×'; html += '
'; var pdom = thos.showpopup(html, data.event.position); pdom.on('click', '.close', function () { thos.hidepopup(); }); pdom.on('click', '.showfmr', function () { thos.hidepopup(); showfarm(data.entity.ciydata); }); } } }; } this.distory = function (data) { thos.ce.destroy(); thos.ce = null; } var thos = this; var map; this.ce = null; this.resize(); opdata.container.append('
'); if (urlp.dev) return; }