当前位置: 首页 > news >正文

图表生成网站/百度收录怎么做

图表生成网站,百度收录怎么做,微网站设计与开发是什么,菏泽市建设信息网研究了一段时间的MapXtreme2005 v6.6, 实现了个简单的鹰眼,放出来与大家分享,转载请注明出处。设计思路为设置两个MapControl ,map1和map2,map1为主地图,map2为索引图,将map1.Bounds的矩形在map…

研究了一段时间的MapXtreme2005 v6.6, 实现了个简单的鹰眼,放出来与大家分享,转载请注明出处。设计思路为设置两个MapControl ,map1和map2,map1为主地图,map2为索引图,将map1.Bounds的矩形在map2上转换为System.Drawing.Rectangle,之后将这个Rectangle的左上坐标和width,height传到客户端,应用JS在客户端绘图。 同理移动客户端索引图上的Rectangle,则将Rectangle的中心坐标传回转换后设置map1的中心坐标。

一、打开VS2005新建一个网站,选择“MapXtreme 6.6 Web Application”模板(当然也可以建一个空模板,然后自己拖控件,配置web..config);


二、把界面的上MapControl1命名为MainMap,MapAlias为Map1,再拖一个MapContol到界面上(自己排版),命名为IndexMap(作为导航地图),MapAlias为Map2;

三、下面为源码:

      MapForm.aspx

 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="MapForm.aspx.cs" Inherits="IndexMap.IndexPage" %>
<%@ Register Assembly="MapInfo.WebControls, Version=4.0.0.428, Culture=neutral, PublicKeyToken=0a9556cc66c0af57"
    Namespace="MapInfo.WebControls" TagPrefix="cc1" %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="JavaScript">...
        var currentMoveObj = null; 
        var relLeft; 
        var relTop;
        function f_mdown(obj)
        {
          currentMoveObj = obj;   
          currentMoveObj.style.position = "absolute";
          relLeft = event.x - currentMoveObj.style.pixelLeft;
          relTop = event.y - currentMoveObj.style.pixelTop;
        }
        window.document.onmouseup = function()
        {
          currentMoveObj = null; 
        }
        window.document.οnmοusemοve=function()
        {
          if(currentMoveObj != null)
          ...{
            currentMoveObj.style.pixelLeft=event.x-relLeft;
            currentMoveObj.style.pixelTop=event.y-relTop;
          }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript" src="js/JScript.js"></script>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td valign="top">
                <img src="images/mi_logo.gif" alt="MapInfo" /></td>
            <td background="images/header_bg.gif" width="100%">
                <img src="images/header_bg.gif" alt="" /></td>
            <td>
                <img src="images/mapxtreme_logo.gif" alt="MapXtreme" /></td>
        </tr>
    </table>
   
    <table style="position:absolute;left: 10px; top: 90px;" border="1" cellpadding="0" cellspacing="0">
        <tr>
            <td style="width: 200px">
                <table>
                    <tr>
                        <td style="width: 200px; height: 200px;">
                            <cc1:MapControl ID="IndexMap" runat="server" Height="200px" Width="200px" MapAlias="Map2" />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 200px; height: 400px;"></td>
                    </tr>
                </table>
            </td>
            <td style="display:block;position:relative; width: 597px;">
                <cc1:MapControl ID="MainMap" runat="server" Height="600px" Width="600px"  MapAlias="Map1"/></td><td></td></tr>
        <tr><td style="width: 143px"></td><td style="width: 597px">
            <cc1:ZoomInTool ID="ZoomInTool1" runat="server" MapControlID="MainMap" />
            <cc1:ZoomOutTool ID="ZoomOutTool1" runat="server" MapControlID="MainMap" />
            <cc1:PanTool ID="PanTool1" runat="server" MapControlID="MainMap" />
        </td><td></td></tr>
    </table>
    <div id = "indexDiv" style="position:absolute;left:14px;top:94px;height:200px;width:200px;background:transparent;"></div>
    <script language="javascript" type="text/javascript">...
        function bindevent()
        ...{
            var mapimage = document.getElementById("MainMap_Image");           
            mapimage.attachEvent('onload', getZoomValue);
        }
        bindevent();
    </script>
    </form>
</body>
</html>

 

MapForm.cs

 

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MapInfo.WebControls;
using ApplicationStateManager;

namespace IndexMap
...{
    public partial class IndexPage : System.Web.UI.Page
    ...{
        private void Page_Load(object sender, System.EventArgs e)
        ...{
            // If the StateManager doesn't exist in the session put it else get it.
            if (StateManager.GetStateManagerFromSession() == null)
                StateManager.PutStateManagerInSession(new AppStateManager());
            if (Session.IsNewSession)
            ...{
                MapControlModel model = MapControlModel.SetDefaultModelInSession();
                model.Commands.Add(new IndexMap.ZoomValue());
                model.Commands.Add(new IndexMap.MoveMainMap());
            }
            // Now Restore State
            StateManager.GetStateManagerFromSession().ParamsDictionary[StateManager.ActiveMapAliasKey] = MainMap.MapAlias;
            StateManager.GetStateManagerFromSession().RestoreState();
        }

        // At the time of unloading the page, save the state
        private void Page_UnLoad(object sender, System.EventArgs e)
        ...{
            StateManager.GetStateManagerFromSession().SaveState();
        }

        protected MapInfo.Mapping.Map GetMapObj(string mapAlias)
        ...{
            MapInfo.Mapping.Map myMap = MapInfo.Engine.Session.Current.MapFactory[mapAlias];
            if(myMap == null)
            ...{
                myMap = MapInfo.Engine.Session.Current.MapFactory[0];
            }
            return myMap;
        }
    }
}
CustomerCommand.cs

using System;
using System.Data;
using System.IO;
using System.Drawing;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MapInfo.Web;
using MapInfo.WebControls;
using MapInfo.Data;
using MapInfo.Geometry;

namespace IndexMap
...{
    [Serializable]
    public class ZoomValue : MapInfo.WebControls.MapBaseCommand
    ...{
        public ZoomValue()
        ...{
            Name = "ZoomValue";
        }

        public override void Process()
        ...{
            MapControlModel model = MapControlModel.GetModelFromSession();
            MapInfo.Mapping.Map map1 = model.GetMapObj("Map1");
            MapInfo.Mapping.Map map2 = model.GetMapObj("Map2");
            System.Drawing.Rectangle rectNew;
            map2.DisplayTransform.ToDisplay(map1.Bounds, out rectNew);
            HttpContext.Current.Response.Output.Write(rectNew.X + "," + rectNew.Y + "," + rectNew.Height + "," + rectNew.Width);
        }
    }

    [Serializable]
    public class MoveMainMap : MapInfo.WebControls.MapBaseCommand
    ...{
        public MoveMainMap()
        ...{
            Name = "MoveMainMap";
        }

        public override void Process()
        ...{
            int x = System.Convert.ToInt32(HttpContext.Current.Request["CenterX"]);
            int y = System.Convert.ToInt32(HttpContext.Current.Request["CenterY"]);

            MapControlModel model = MapControlModel.GetModelFromSession();
            MapInfo.Mapping.Map map1 = model.GetMapObj("Map1");
            MapInfo.Mapping.Map map2 = model.GetMapObj("Map2");

            System.Drawing.Point spoint = new System.Drawing.Point(x,y);
            MapInfo.Geometry.DPoint point;
            map2.DisplayTransform.FromDisplay(spoint, out point);

            map1.Center = point;
            MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat);
            StreamImageToClient(ms);
        }
    }
}

JScript.js

// JScript 文件
function getZoomValue()
...{
    var MapImage = document.getElementById("MainMap_Image");
    var url = "MapController.ashx?Command=ZoomValue&Width=" + MapImage.width + "&height=" + MapImage.height + "&ExportFormat=" + MapImage.exportFormat + "&Ran=" + Math.random();
    if(MapImage.mapAlias)
        url += "&MapAlias" + MapImage.mapAlias;
    var xmlHttp = CreateXMLHttp();
    xmlHttp.open("GET",url,false);
    xmlHttp.send(null);
    var result = xmlHttp.responseText;
    var htmlContent = new Array();
    htmlContent = result.split(',');
    var div = document.getElementById("indexDiv");
    var left = 1*htmlContent[0] ;
    var top = 1*htmlContent[1] ;
    var height = 1*htmlContent[2] ;
    var width = 1*htmlContent[3] ;
    if (left < 0) left = 0;
    if (top < 0) top = 0;
    if (width > 200) width = 200;
    if (height > 200) height = 200;
    div.innerHTML="<div id = 'indexRect' style='border:3px solid  red;position:absolute;left:" + left + ";top:" + top +";height:" + height +"px;width:"+ width +"px;cursor:move' οnmοusedοwn='f_mdown(this)' οnmοuseup='MoveMainMap()'></div>";
}

function MoveMainMap()
...{
    var mapImage = document.getElementById("MainMap_Image");
    var indexRect = document.getElementById("indexRect");
    var w = indexRect.clientWidth /2;
    var h = indexRect.clientHeight /2;
    var x = parseInt((parseInt(indexRect.style.left) + w));
    var y = parseInt((parseInt(indexRect.style.top) + h));
    var url = "MapController.ashx?Command=MoveMainMap&Width=" + mapImage.width +
                    "&Height=" + mapImage.height +
                    "&ExportFormat=" + mapImage.exportFormat + "&Ran=" + Math.random();
    url += "&CenterX=" + x;
    url += "&CenterY=" + y;       
    if (mapImage.mapAlias)
        url +=  "&MapAlias=" + mapImage.mapAlias;
   
    var xmlHttp = CreateXMLHttp();
    xmlHttp.open("GET", url, false);
    xmlHttp.send(null);
    try ...{
    mapImage.src = url;
    } catch(e) ...{ alert("ll"); }
}


代码完毕!

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/nosave/archive/2008/01/02/2010750.aspx

转载于:https://www.cnblogs.com/carekee/articles/1724099.html

http://www.jmfq.cn/news/4782781.html

相关文章:

  • 龙岗企业网站改版公司/江北seo综合优化外包
  • wordpress 网站遭篡改/外贸平台
  • 中国最大的网站/湖南seo优化推荐
  • 事业单位网站建设注销情况说明/四种基本营销模式
  • html做音乐网站/信息流优化师是什么
  • 建设部网站 自住房/seo是怎么优化推广的
  • 太平洋手机官网报价大全/冬镜seo
  • 怎样登录住房和城乡建设部网站/长春seo排名优化
  • 宝坻建设路小学网站/网址搜索引擎入口
  • 图片比较多的网站怎么做/网页制作基础教程
  • 辽阳哪里做网站/全网优化推广
  • 自己怎么做返利网站吗/代写文章接单平台
  • wordpress post page/北京seo网站优化培训
  • 做网站的实验总结/南京百度提升优化
  • cms内容管理系统是什么/兰州seo关键词优化
  • 网站开发过滤器作用/上海百度推广排名
  • 平台网站建设制作/高级搜索百度
  • 百度问一问付费咨询/太原seo团队
  • 响应式手机网站怎么做/在百度上怎么发布信息
  • 网站添加漂浮二维码怎么做/搜索词
  • 怎么做室内设计公司网站/sem竞价培训班
  • 厦门网站关键词推广/小程序设计
  • 青岛的建筑公司/seo排名怎么样
  • 自己做网站需要学些什么/口碑营销的定义
  • 图片网站怎么做排名/站长工具网站排名
  • 网站制作难吗/百度点击快速排名
  • 可以做分销的淘客网站/成都百度推广账户优化
  • 大足网站设计/北京seo外包公司要靠谱的
  • 天津高端模板建站/免费的api接口网站
  • 福州专业做网站公司/sem优化托管