zoukankan      html  css  js  c++  java
  • mapxtreme2008应用到masterpage下的脚本更正

    安装完mapxtreme2008后,在普通网页下,mapxtreme工具中带的zoomin、zoomout、pan控件放到界面上运行都正常(ie9中要用兼容模式,否则单击后地图不会刷新,或参照本人上次发的随笔改动脚本,不用改兼容模式也能用);

    但应用masterpage后,在子页中要是再放置mapcontrol,放上zoomin、zoomout、pan后,运行会提示“无法设置属性“origin”的值: 对象为 null 或未定义”,错误位置为Interaction.js的第425行this.element.origin = GetAbsPos(this.element);通过google看到国外一哥们的一个回答,经测试可以改正这个问题,方法为tool.js (in MapxtremeWebRessources)中ImgTool.prototype.Activate = function()中,

    在if (this.interaction.element != null &&
    this.interaction.element.currentTool) {
      try {

       this.interaction.element.currentTool.Deactivate();
      } catch(e){;}

    }
    之前,插入下面的代码即可
     if (this.interaction.element == null && this.id.indexOf("$") > 0) {
         var prefixe = this.id.substr(0, this.id.lastIndexOf("$") + 1);
         this.interaction.element = FindElement(prefixe + this.interaction.elementID)
     }。

    即原代码改为:

    ImgTool.prototype.Activate = function()
    {
     if (this.interaction.element == null) this.interaction.element = FindElement(this.interaction.elementID);
     if (this.interaction.element == null && this.id.indexOf("$") > 0) {
         var prefixe = this.id.substr(0, this.id.lastIndexOf("$") + 1);
         this.interaction.element = FindElement(prefixe + this.interaction.elementID)
     }
     if (this.interaction.element != null && this.interaction.element.currentTool) {
      try {
       this.interaction.element.currentTool.Deactivate();
      } catch(e){;}
      }
     this.interaction.InitHandlers();
     this.imgElement.src = this.activeImg;
     this.interaction.element.style.cursor = this.cursorImg;
     this.interaction.element.currentTool = this;
     this.active = true;
     var activeTool = document.getElementById(this.id+"Active");
     if (activeTool) activeTool.value = this.id + "," + this.interaction.element.id;
    }

    参考网址为:http://community.mapinfo.com/forums/thread.jspa?messageID=56533

  • 相关阅读:
    大型门户网站架构设计的可伸缩性(转载)
    geodatabase的类型(翻译)
    在Windows Server 2008上部署SVN代码管理总结
    可以有效改进项目管理技能的十个过程(转载)
    GTD和知识管理
    查询Oracle版本号
    微软产品组里的十一类人(转载)
    在Win7中创建、部署WebService时遇到的访问被拒绝错误解决方法
    小议地理编码(转载)
    在Win7中将我的电脑快捷方式放入任务栏
  • 原文地址:https://www.cnblogs.com/enjoyprogram/p/2031914.html
Copyright © 2011-2022 走看看