惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
H
Hacker News: Front Page
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
Google Online Security Blog
Google Online Security Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
T
Tenable Blog
博客园 - 叶小钗
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
量子位
P
Proofpoint News Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
S
Schneier on Security
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
GRAHAM CLULEY
G
Google Developers Blog
月光博客
月光博客
V
V2EX
T
Troy Hunt's Blog
A
Arctic Wolf

博客园 - protorock

WPF:通过Window.DataContext实现窗口间传值 How to add dependency on a Windows Service AFTER the service is installed 实现泛型IEnumerable接口 关于Local System/Local Service/Network Service账户 vs2010 c# 管理win7防火墙 WIN7系统中连接点(Junction Points) 程序集强名称(Strong Name)延迟签名与签名 VISUAL STUDIO 2010 单元测试 Windows Server 2008 R2上Ext.net 生产环境搭建 在Windows7 (SP1)配置IIS7.5 + .Net Framework 4.0.30319 将Google Map 与ASP.NET AJAX 扩展集成 web.config 加密步骤 - protorock - 博客园 GridView 与自定义对象的绑定和分页 在Windows 2003 中发布 ASP.NET 2.0 + SQL SERVER Express SQL Server 2005 Express Edition 用户实例 在 windows2003 Server VS2005 安装 .Net 3.0 .net framework 2.0,3.0与3.5之间的关系 SharpMap AjaxMapControl 中 Zoomin/Zoomout 操作时冻结问题 HTTP 协议概要(二) 持久连接
Sharpmap AjaxMapControl 分析
protorock · 2007-06-11 · via 博客园 - protorock

(一)概述
sharpmap中的ajaxmapcontrol使用asp.net 2.0提供的ICallbackEventHandler接口实现页面无刷新地图更新。

本质上ICallbackEventHandler接口底层是XMLHTTP,而XMLHTTP是当前非常热门的Ajax的基础。这也许就是sharpmap 作者将这个实现了ICallbackEventHandler接口的地图控件命名为ajaxmapcontrol 的原因吧。

ICallbackEventHandler机制是ajaxmapcontrol的核心所在。单纯从编程角度看,ICallbackEventHandler的编程比使用ms.ajax之类的开发套件编程要复杂一些。而然,ICallbackEventHandler 快捷轻量级特性,在ajaxmapcontrol样的控件中更为适用。

(二)Sharpmap AjaxMapControl 组成
ajaxmapcontrol 实际上是由两个部分组成的:一个是服务器控件;另一个是名为AjaxMap.js 客户端脚本文件。

(三)工作过程
ajaxmapcontrol 主要工作过程
1.   客户端浏览器请求带有 ajaxmapcontrol 的网页。
2.   在浏览器中,用户用鼠标操纵地图图象。鼠标的点击/拖动事件首先被来自AjaxMap.js 脚本函数截获,接着,脚本对服务器发出回调请求(WebForm_DoCallback)。这个调用采用 XMLHTTP 方式请求服务器 Generic Handler,并将鼠标交互产生的各个参数以 Get 方式发送给 Generic Handler;在调用WebForm_DoCallback 时,WebForm_DoCallback 也向 XMLHTTP 注册一个接收处理函数。
3.   在服务器上, Generic Handler 响应客户端回调请求,并根据来自客户端的参数(都是与地图图象有关的参数)生产新的地图图象。并将图象返回给客户端。
4.   XMLHTTP 利用注册的接收处理函数,将来自服务器的新的地图图象显示在页面上。

(四)说明
1.   虽然在 AjaxMapControl 实现了 ICallbackEventHandler 接口,但在服务器端真正响应客户端回调请求的并不是控件本身。服务器端响应客户请求的处理程序由 Generic Handler 完成。
2.   脚本文件是 AjaxMapControl 内嵌资源(Embedded Resource)并被编译到 DLL 中。在 AssemblyInfo.cs 加入[assembly: System.Web.UI.WebResource("SharpMap.UI.Web.UI.Ajax.AjaxMap.js", "text/javascript")],当在客户端浏览器中请求带有ajaxmapcontrol网页后,该网页就能通过 WebResource.axd 请求封入 DLL 的 AjaxMap.js 脚本文件。这样做的好处是可以在客户端缓冲该脚本文件。
3.   在浏览器中,引发脚本向服务器发出回调的操作有两个:拖动地图(Pan)操作和缩/放操作(Zoom in/out)操作;
4.   客户端脚步函数 SharpMap_BeginRefreshMap(obj,dofade)  完成对服务器回调请求。