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

  • 相关阅读:
    学习链接
    【转】C#学习路线WinForm学习路线
    WPF 等待动画控件
    wpf 设置窗体在屏幕的初始位置
    WPF 添加右键菜单 自定义透明控件
    记录自己的点滴
    Linux下的mysql默认大小写敏感
    springboot+mybatis遇到BUG:自动注入失败
    springboot在阿里CentOS 7后台永久运行
    阿里云CentOS7 64位安装jdk8和mysql5.6.43及远程连接mysql
  • 原文地址:https://www.cnblogs.com/enjoyprogram/p/2031914.html
Copyright © 2011-2022 走看看