• 点线面查询闪烁


    ArcGIS Server点线面查询闪烁

    基本思路:

    1. 首先做查询,按条件查找出地理信息DoSearch(string txtvalue)
    2. 在服务器端将经纬度坐标转换为屏幕坐标,并且用回调方式向客服端的二维数组数组写入给点经纬度以及其他信息

    //将点的经纬度坐标存入数组中,以备刷新地图时重绘各点

                            string ptcollection=" ptcollection["+i+"]=new Array();";

                            ptcollection +="ptcollection["+i+"][0]="+geomPt.X+";";

                            ptcollection += "ptcollection["+i+"][1]="+geomPt.Y+";";

                            ptcollection += "ptcollection[" + i + "][2]='" + mc + "';";

                            i++;

                            CallbackResult ptc = new CallbackResult(null, null, "javascript", ptcollection);

                            Map1.CallbackResults.Add(ptc);

    //将经纬度坐标转化为屏幕坐标

                        System.Drawing.Point pt= geomPt.ToScreenPoint(Map1.GetTransformationParams(ESRI.ArcGIS.ADF.Web.Geometry.TransformationDirection.ToScreen));

     

    1. 在客服端以gif图片绘制出各点(DrawPt(x,y,mc)),其中线取中点,面取的是包络线矩形的中点

    function DrawPt(x,y,mc)

            {

                //动态获取点的ID号

                var id=document.body.getElementsByTagName("pt").length;

                var pt=document.createElement("pt");

                pt.style.position="absolute";

                pt.style.left=x;

     

              // pt.style.background="green";

                pt.style.top=y;

                pt.style.zIndex=110;

                pt.setAttribute("align","center");

                pt.onclick = function(){pointClick1(mc,x,y)};

                pt.id=id;

                pt.value=mc;

    //         pt.style.visibility="hidden";

                document.body.appendChild(pt);

                document.getElementById('divCache').style.display='none';

            }

     

    4. 做地图移动,放大缩小时gif图片跟着地图移动

            function RedirectToScreen(mapxmax,mapxmin,mapymax,mapymin)

            {

                document.getElementById("div").style.visibility="hidden";

                document.getElementById('divCache').style.display='';

    //            document.all.<%=tableCache.ClientID%>.style.visibility="visible";

                if(document.body.getElementsByTagName("pt").length!='0')

                {

                    var ptCount=document.body.getElementsByTagName("pt").length;

                    //首先删除以前所有的点

                    for(var i=0;i<ptCount;i++)

                    {  

                        var img=document.getElementById(i);

                        document.body.removeChild(img);

                    }

                }

                var screenWidth=document.body.clientWidth;

                var screenHeight=document.body.clientHeight;

                for(var i=0;i<ptcollection.length;i++)

                {  

                    var x=ptcollection[i][0];

                    var y=ptcollection[i][1];

                    var mc=ptcollection[i][2];

                   

                    if(x<mapxmax&&x>mapxmin&&y<mapymax&&y>mapymin)

                    {

                        screenx=parseInt((screenWidth/Math.abs(mapxmax-mapxmin))*Math.abs(x-mapxmin));

                        screeny=parseInt(screenHeight-(screenHeight/Math.abs(mapymax-mapymin))*Math.abs(y-mapymin));

                      

                        DrawPt(screenx,screeny,mc);

                   }

                }

               document.getElementById('divCache').style.display='none';

            }

    1. 控制图片只有在地图范围内时才显示if(x<mapxmax&&x>mapxmin&&y<mapymax&&y>mapymin)

    缺点(不足):由于线和面用点绘制闪烁很慢,所以这里以中点代贴,以待改进

  • 相关阅读:
    融云技术分享:全面揭秘亿级IM消息的可靠投递机制
    企业微信的IM架构设计揭秘:消息模型、万人群、已读回执、消息撤回等
    喜马拉雅亿级用户量的离线消息推送系统架构设计实践
    uni-app 项目使用 npm 包中的小程序自定义组件
    Leetcode563. 二叉树的坡度
    vue看源码遇到 报错
    windows使用
    mysql 显示行号
    从优秀到卓越
    【面经】阿里蚂蚁金服22秋招-Java后端
  • 原文地址:https://www.cnblogs.com/gisdream/p/1456989.html
Copyright © 2020-2023  润新知