shuishen
2021-06-23 9dd06fefff5262947d42e99f518706d4a068d654
widgets/spatialAnalysis/Widget.js
@@ -31,50 +31,52 @@
            var that = this;
            // 暴露在外的接口
            function createTooltip(frameDiv) {//抄录createTooltip函数
            topic.subscribe("closeOnceUse", lang.hitch(this, this.closeOnceUse));
               var tooltip = function (frameDiv) {
            // function createTooltip(frameDiv) {//抄录createTooltip函数
                  var div = document.createElement('DIV');
                  div.className = "twipsy right";
            //    var tooltip = function (frameDiv) {
                  var arrow = document.createElement('DIV');
                  arrow.className = "twipsy-arrow";
                  div.appendChild(arrow);
            //       var div = document.createElement('DIV');
            //       div.className = "twipsy right";
                  var title = document.createElement('DIV');
                  title.className = "twipsy-inner";
                  div.appendChild(title);
            //       var arrow = document.createElement('DIV');
            //       arrow.className = "twipsy-arrow";
            //       div.appendChild(arrow);
                  this._div = div;
                  this._title = title;
                  this.message = '';
            //       var title = document.createElement('DIV');
            //       title.className = "twipsy-inner";
            //       div.appendChild(title);
                  // 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);
                  };
               };
            //       this._div = div;
            //       this._title = title;
            //       this.message = '';
               tooltip.prototype.setVisible = function (visible) {
                  this._div.style.display = visible ? 'block' : 'none';
               };
            //       // 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.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;
                  }
               };
            //    tooltip.prototype.setVisible = function (visible) {
            //       this._div.style.display = visible ? 'block' : 'none';
            //    };
               return new tooltip(frameDiv);
            }
            window.MYcreateTooltip = createTooltip;//全局使用
            //    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;//全局使用
            var domHtmls = [//默认
               {
@@ -116,6 +118,9 @@
            that.beginSpatialAnalysis(domHtmls);
            var isit = false;
            $('.ccslius').click(() => {
               isit = false;
            })
            $('.ccsliu').dblclick(() => {//测试开关 点击图例其他的图片
               if (isit) {
@@ -149,6 +154,15 @@
                        name: '地形开挖',
                        classs: 'digTheEarth-tool',
                        img: './images/addL/pdpx.png'
                     }, {//方量分析//做好
                        name: '方量分析',
                        classs: 'volumeAnalysis-tool',
                        img: './images/addL/pdpx.png'
                     }
                     , {//空间查询
                        name: '空间查询',
                        classs: 'spatialQuery-tool',
                        img: './images/addL/pdpx.png'
                     }
                     ,
                     {//建造模型
@@ -160,15 +174,6 @@
                     {//清除模型
                        name: '清除模型',
                        classs: 'modesssss2222',
                        img: './images/addL/pdpx.png'
                     }
                     , {//地形开挖,//做好
                        name: '地形开挖',
                        classs: 'digTheEarth-tool',
                        img: './images/addL/pdpx.png'
                     }, {//方量分析//做好
                        name: '方量分析',
                        classs: 'volumeAnalysis-tool',
                        img: './images/addL/pdpx.png'
                     }
                  ];
@@ -255,7 +260,7 @@
            $('.digTheEarth-tool').click(function () {
               that.closeOnceUse('digTheEarth');
               $(".jimu-widget-digTheEarth").show();
               topic.publish('beginDigTheEarth', 'beginDigTheEarth');
               // topic.publish('beginDigTheEarth', 'beginDigTheEarth');
            })
@@ -264,6 +269,13 @@
               that.closeOnceUse('volumeAnalysis');
               $(".jimu-widget-volumeAnalysis").show();
               topic.publish('beginVolumeAnalysis', 'beginVolumeAnalysis');
            })
            //空间查询
            $('.spatialQuery-tool').click(function () {
               that.closeOnceUse();
               $(".jimu-widget-spatialQuery").show();
               topic.publish('beginSpatialQuery', 'beginSpatialQuery');
            })
         },
@@ -309,15 +321,17 @@
            if ($(".jimu-widget-digTheEarth").is(":visible")) {//判断是否隐藏
               $(".jimu-widget-digTheEarth").hide();
               topic.publish('closesDigTheEarth');
               console.log('dakai ')
            }
            //关闭方量贩分析
            if ($(".jimu-widget-volumeAnalysis").is(":visible")) {//判断是否隐藏
               $(".jimu-widget-volumeAnalysis").hide();
               topic.publish('closesVolumeAnalysis');
            }
            //关闭空间查询
            if ($(".jimu-widget-spatialQuery").is(":visible")) {//判断是否隐藏
               $(".jimu-widget-spatialQuery").hide();
               topic.publish('closesSpatialQuery');
            }
         },