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

  • 相关阅读:
    接口框架 python+unittest+request+HTMLTestRunner
    python循环语句的简单条件语句、多重条件语句和嵌套条件语句编写
    MAC下配置java+jmeter环境变量
    jmeter _Random函数生成随机数
    python-unittest模块中的各类断言
    Django密码错误报错提醒
    转载Django 500,404,400错误修改优化
    postman从body,headers,data中获取token后回写做全局变量
    postman小白教程
    git拉取代码切换分支
  • 原文地址:https://www.cnblogs.com/enjoyprogram/p/2031914.html
Copyright © 2011-2022 走看看