本文严禁擅自转载或用于商业目的,如有需要请事先联系作者:dev.vip#gmail.com
Web ADF全名是Web Application Develope Framework,是ArcGIS Server专用的开发框架,9.2版本的ArcIMS也开始提供ADF的封装。完全使用Web控件编程几乎不能解决我们实际项目中的问题,因此我们从《ArcGIS Server 开发系列(一)--编程框架总览》中提到的途径二开始,即web controls + common datasource apis。
目标:
根据查询语句实现图层信息查询
准备工作:
1.Windows XP sp2中/英文版
2.Visual Studio 2005中/英文版
3.ArcGIS Server 9.2(我打上了sp2补丁),创建一个ArcGIS Server服务,Map Server属性中更改Pooling,使用池化连接方式,Progresses选择“In a seperate process for each instance(high isolation)”,我的服务为“World”
4.利用vs2005创建一个模板server应用--Web Mapping Application,并更改MapResourceManager属性
这样我们可以测试程序看是否能够正常运行,启动调试看到如下结果:
代码实现:
我们要完成的工作是对图层属性信息的查询,首先在页面左侧添加一个新的panel,左侧的Tasks、Results等都是放置在panel之中,在这个新的panel中分别添加TreeViewPlus、TextBox、Button三个控件,TextBox输入查询条件,Button确定查询, TreeViewPlus显示结果,在设计试图中浏览效果如下:
双击“Query”Button,编写点击事件。
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
Query方法实现了对图层属性信息的查询。
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
运行程序,text box中输入“CNTRY_NAME LIKE 'A%'”,查询结果:
这样这个小程序就完成了,在server中实现了对图层属性信息的查询,现在我们需要进行更多的考虑:
第一,考虑web控件、 functionality、datasource、resource、resourcemamager之间的关系,代码中多次对它们的关系进行了描述,用文档中的一幅图可以概括整个框架,这篇文章对此进行了阐述--《ArcGIS Server .Net Web ADF体系结构》。
第二,程序中使用的mxd仅仅包含一个world图层,因此对图层进行遍历的过程中只需获得第一图层的ID,如果指定图层名,可以在lnames得到所需的图层进行查询。
第三,程序实现的查询方式相当简单,在text box中输入原始的sql来完成where语句,只仅仅是一个测试,一般我们会屏蔽掉sql相关的关键字,提供多个text box或dropdownlist供用户选择进行字段查询。
第四,如果查询信息量不大,返回结果数量不多,完全可以考虑ajax来完成页面请求,不论是速度还是用户体验都会得到提高。
第五,通过程序可以看到,查询结果保存在一个datatable中,这极大的方便了server查询和.net的无缝连接,直接将结果和TreeViewPlus绑定,换成其他的visual studio控件也没问题。
只要整个框架思路清晰了,查询功能的实现其实很简单,这也是途径2开发方式的一个例子,可以看出ArcGIS Server ADF给开发提供了很多便利,和ArcIMS相比开发难度相当,多看看文档和ADF OMD图可以让我们对ArcGIS Server ADF开发有更多的了解,记住,这只是server开发的起步。
http://www.cnblogs.com/flyingis/archive/2007/08/14/854806.html