点线面缓冲分析(转自esri中国社区)
2011-08-10 10:32
459 查看
点线面缓冲分析
//缓冲分析主要是生产缓冲图形,再用缓冲图形执行空间查询。 //把需要缓冲的对象放在sesssion中,这样可以对同一个缓冲对象执行多个条件的缓冲分析 ESRI.ArcGIS.ADF.Web.Geometry.Geometry geo = (ESRI.ArcGIS.ADF.Web.Geometry.Geometry)(map1.Page.Session["BufferAnalyesGeometry"]); double dis; if (!Double.TryParse(eventArg,out dis)) { dis = 0.0; } //获取mxd配置文件中的图层属性信息 ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality qfunc = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)map1.GetFunctionality("地图名"); //获取对象缓冲图形 if (qfunc.Resource is ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal) { ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal ags_mr = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)qfunc.Resource; ESRI.ArcGIS.Server.IServerContext sc = ags_mr.ServerContextInfo.ServerContext; ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapdescription; mapdescription = qfunc.MapDescription; //定义Com对象的点 ESRI.ArcGIS.Geometry.IGeometry igeo=null; //点缓冲自定义方法,线、面缓冲用AO控件方法 ESRI.ArcGIS.ADF.Web.Geometry.Polygon nplygon; if (geo is ESRI.ArcGIS.ADF.Web.Geometry.Point) { //生成点的缓冲图形 ESRI.ArcGIS.ADF.Web.Geometry.Point cp=(ESRI.ArcGIS.ADF.Web.Geometry.Point)geo; common.Utils uts = new common.Utils(); ESRI.ArcGIS.ADF.Web.Geometry.PointCollection pc = uts.getMapPointBuffer(cp.X, cp.Y,dis, 1); ESRI.ArcGIS.ADF.Web.Geometry.Ring r1= new ESRI.ArcGIS.ADF.Web.Geometry.Ring(); r1.Points = pc; ESRI.ArcGIS.ADF.Web.Geometry.RingCollection rc = new ESRI.ArcGIS.ADF.Web.Geometry.RingCollection(); rc.Add(r1); nplygon = new ESRI.ArcGIS.ADF.Web.Geometry.Polygon(); nplygon.Rings = rc; } else { if (geo is ESRI.ArcGIS.ADF.Web.Geometry.Polyline) { //线转换 ESRI.ArcGIS.ADF.Web.Geometry.Polyline pl = (ESRI.ArcGIS.ADF.Web.Geometry.Polyline)geo; ESRI.ArcGIS.Geometry.IPointCollection com_polyline_pointcollection = (ESRI.ArcGIS.Geometry.IPointCollection)sc.CreateObject("esriGeometry.Polyline"); object Missing = Type.Missing; foreach (ESRI.ArcGIS.ADF.Web.Geometry.Path new_adf_path in pl.Paths) { ESRI.ArcGIS.Geometry.IPointCollection com_pointcollection = (ESRI.ArcGIS.Geometry.IPointCollection)sc.CreateObject("esriGeometry.Path"); foreach (ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point in new_adf_path.Points) { ESRI.ArcGIS.Geometry.IPoint com_point = (ESRI.ArcGIS.Geometry.IPoint) ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToIGeometry(new_adf_point, sc); com_pointcollection.AddPoint(com_point, ref Missing, ref Missing); } com_polyline_pointcollection.AddPointCollection(com_pointcollection); } ESRI.ArcGIS.Geometry.IPolyline projpoly = (ESRI.ArcGIS.Geometry.IPolyline)com_polyline_pointcollection; igeo = projpoly; } else { igeo = (ESRI.ArcGIS.Geometry.IGeometry)ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToIGeometry(geo, sc); } //利用AO中缓冲区分析 ESRI.ArcGIS.Geometry.ITopologicalOperator topop = (ESRI.ArcGIS.Geometry.ITopologicalOperator)igeo; ESRI.ArcGIS.Geometry.IPolygon bufferPolygon; bufferPolygon = (ESRI.ArcGIS.Geometry.IPolygon)topop.Buffer(dis); // // 定义valueobject的点 ESRI.ArcGIS.ADF.ArcGISServer.PolygonN buffer_polyn; // 进行comobject到valueobject之间的转换 buffer_polyn = (ESRI.ArcGIS.ADF.ArcGISServer.PolygonN) ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ComObjectToValueObject (bufferPolygon, sc, typeof(ESRI.ArcGIS.ADF.ArcGISServer.PolygonN)); nplygon = (ESRI.ArcGIS.ADF.Web.Geometry.Polygon)ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPolygon(buffer_polyn); } //在Buffer图层中显示结果 ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality mapFunct = (ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality)map1.GetFunctionality(mapBufferName); ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource gResource = (ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource)mapFunct.Resource; gResource.Graphics.Tables.Clear(); ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer glayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer(); gResource.Graphics.Tables.Add(glayer); ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement ge1 = new ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement(nplygon,System.Drawing.Color.SeaGreen); ge1.Symbol.Transparency = 70.0; glayer.Add(ge1); //刷新地图 map1.RefreshResource(gResource.Name); string[] lids = m_queryString["Layers"].Split(",".ToCharArray()); //执行空间查询 。。。。 。。。 |
相关文章推荐
- [请您去投票]ESRI中国社区2008年度优秀会员评选
- 将[ESRI中国社区-GIS大讲堂]中Jueery关于ArcGIS Server的帖子内容整理成PDF发上来
- 摘来的 esri 的 js 的 一些东西 来自ESRI中国社区 by xiaoyaohu
- Esri中国社区 » GIS大讲堂:ArcGIS Server .Net ADF中的AJAX
- Linux USB驱动框架分析 - 技术文档 - 安装启动 Linux时代 - 开源、自由、共享 - 中国最大的Linux技术社区
- C#制作Arcgis Engine鹰眼全过程(引自ESRI中国社区)
- 【2013Esri中国用户大会】商业智能位置分析之Esri Maps for Cognos
- 如何编辑SDE数据(转自ESRI中国社区)
- 全图范围设置(转自Esri中国社区)
- JavaCC首页、文档和下载 - 语法分析生成器 - 开源中国社区
- 有关坐标系常见问题的问与答(转自ESRI中国社区)
- 如何编辑SDE数据(转自ESRI中国社区)
- 中国IT格局分析
- @resource和@autowired的区别是什么-CSDN论坛-CSDN.NET-中国最大的IT技术社区 - Google Chrome
- 我最近发现的微软官方网站以及SUN中国社区的五个翻译错误
- 中国电讯,电讯营运商:客户流失的深层次原因分析[原创]
- 社区开放任务指南-3210-HTML5在FirefoxOS上的支持情况分析
- 中国南方冰冻缘何酿成大灾害?专家分析两原因
- 从拥有的专利来分析“中国的IPV9/十进制网络”
- Silverlight调用GP工具实现缓冲分析