| | |
| | | startup: function () { |
| | | var that = this; |
| | | |
| | | function createTooltip(frameDiv) {//抄录createTooltip函数 |
| | | |
| | | var tooltip = function (frameDiv) { |
| | | |
| | | var div = document.createElement('DIV'); |
| | | div.className = "twipsy right"; |
| | | |
| | | var arrow = document.createElement('DIV'); |
| | | arrow.className = "twipsy-arrow"; |
| | | div.appendChild(arrow); |
| | | |
| | | var title = document.createElement('DIV'); |
| | | title.className = "twipsy-inner"; |
| | | div.appendChild(title); |
| | | |
| | | this._div = div; |
| | | this._title = title; |
| | | this.message = ''; |
| | | |
| | | // add to frame div and display coordinates |
| | | frameDiv.appendChild(div); |
| | | var that = this; |
| | | div.onmousemove = function (evt) { |
| | | that.showAt({ x: evt.clientX, y: evt.clientY }, that.message); |
| | | }; |
| | | }; |
| | | |
| | | tooltip.prototype.setVisible = function (visible) { |
| | | this._div.style.display = visible ? 'block' : 'none'; |
| | | }; |
| | | |
| | | tooltip.prototype.showAt = function (position, message) { |
| | | if (position && message) { |
| | | this.setVisible(true); |
| | | this._title.innerHTML = message; |
| | | this._div.style.left = position.x + 10 + "px"; |
| | | this._div.style.top = (position.y - this._div.clientHeight / 2) + "px"; |
| | | this.message = message; |
| | | } |
| | | }; |
| | | |
| | | return new tooltip(frameDiv); |
| | | } |
| | | window.MYcreateTooltip = createTooltip;//全局使用 |
| | | |
| | | //关键词&&坐标 |
| | | $("#i-f-gjz").click(function () { |
| | | that.states = 'one'; |
| | |
| | | this.mountainHandler.setInputAction(lang.hitch(this, this.clickHand), Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | }, |
| | | // 注册鼠标左键单击事件 |
| | | clickHand: function clickHand(data) { |
| | | clickHand: function clickHand(data) {// 全局鼠标点击图标事件 渲染地图图标时 添加个相对应的数组储存该对象数据 通过数组是否存在判断点击的项目 |
| | | var pickedObjects = this.map.scene.drillPick(data.position) || 0; |
| | | // console.log(pickedObjects); |
| | | if (pickedObjects.length != 0) { |
| | |
| | | |
| | | } else if (pickedObjects[0].primitive.id.SQLData != undefined) {//SQL查询图标点击事件 |
| | | // console.log('SQLData') |
| | | } else if (pickedObjects[0].primitive.id.spatialQueryData != undefined) {//SQL查询图标点击事件 |
| | | var data = pickedObjects[0].primitive.id.spatialQueryData; |
| | | data.name = pickedObjects[0].primitive.id.name; |
| | | data.dom = pickedObjects[0].primitive.id.description; |
| | | // console.log(data); |
| | | var doms = $('#spatialQueryValuemain'); |
| | | var domo = $('#spatialQueryValue'); |
| | | doms.empty(); |
| | | doms.append('<div>name:' + data.name + '<div/>' + data.dom._value); |
| | | domo.show(); |
| | | } |
| | | } |
| | | } |