jxtan
路人甲
路人甲
  • 注册日期2004-08-26
  • 发帖数4
  • QQ
  • 铜币137枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1796回复:4

ARCEngine 开发中,如何判定点图层中的点落在面图层上某个区域

楼主#
更多 发布于:2006-01-08 12:03
我是新手,在ARCEngine 开发中,我用MapControl调入mxd文件,在mxd文件中有两个图层,一是点状图层,二是面状图层,问题是如何判定点图层中的某些点落在面图层中的某个区域,请高手指点!先谢了
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2006-01-08 14:44
<P>利用空间查询的接口就可以了</P>
<P>Description: <br><br>This sample builds a spatial query filter, gets a feature cursor based on the filter and then loops over all the features, totalling the number of points, lines, and areas, and reports these to the user. </P><br>
<P>The sample is part of the Illustrated Code Samples found in Appendix C of the ArcGIS Desktop Developer's Guide. These samples show you the fundementals of programming COM components in ArcObjects. </P>
<P>
<P>Start by entering the VBA environment in ArcMap or ArcCatalog and type in the code. Step through the code in the VBA debugger. Look at the sample in Appendix C of the ArcGIS Desktop Developer's Guide and study the relationships between coclasses and interfaces. </P>
<P>
<P>A careful reading of the samples in the appendix gives you all the important concepts you need for developing with ArcObjects, as well as an introduction to the most important ArcObjects components. Products: <br>
<P>ArcView: VBA</P>
<P>
<P>Platforms: Windows <br>
<P>Minimum ArcGIS Release: 9.0</P><br>How to use:
<br>
<P>VBA </P>Add this to the Click event of a UIButtonControl in ArcMap:   Dim pMxDoc As IMxDocument<br>  Set pMxDoc = ThisDocument<br>  <br>  Dim pEnv As IEnvelope<br>  Dim pRubber As IRubberBand<br>  Set pRubber = New RubberEnvelope<br>  <br>  Dim pActiveView As IActiveView<br>  Set pActiveView = pMxDoc.FocusMap<br>  Set pEnv = pRubber.TrackNew(pActiveView.ScreenDisplay, Nothing)<br>  <br>  Dim pSpatialFilter As ISpatialFilter<br>  Set pSpatialFilter = New SpatialFilter<br>  Set pSpatialFilter.Geometry = pEnv<br>  pSpatialFilter.SpatialRel = esriSpatialRelIntersects<br><br>  Dim lPoints As Long, lPolygons As Long, lPolylines As Long<br>  Dim pLayer As IFeatureLayer<br>  Dim pFeatureCursor As IFeatureCursor<br>  Dim pFeature As IFeature<br>  Dim i As Long<br>  For i = 0 To pMxDoc.FocusMap.LayerCount - 1<br>    If (TypeOf pMxDoc.FocusMap.Layer(i) Is IGeoFeatureLayer) Then<br>      Set pLayer = pMxDoc.FocusMap.Layer(i)<br>      pSpatialFilter.GeometryField = pLayer.FeatureClass.ShapeFieldName<br>      Set pFeatureCursor = pLayer.Search(pSpatialFilter, True)<br>      Set pFeature = pFeatureCursor.NextFeature<br>      Do Until (pFeature Is Nothing)<br>        Select Case pFeature.Shape.GeometryType<br>          Case esriGeometryPoint<br>            lPoints = lPoints + 1<br>          Case esriGeometryPolyline<br>            lPolylines = lPolylines + 1<br>          Case esriGeometryPolygon<br>            lPolygons = lPolygons + 1<br>        End Select<br>        Set pFeature = pFeatureCursor.NextFeature<br>      Loop<br>    End If<br>  Next i<br>  MsgBox "Features Found:" ; vbCrLf ; lPoints ; " Points " ; vbCrLf ; lPolylines ; " Polylines " ; vbCrLf ; lPolygons ; " Polygons "
<P><br></P><br>
[此贴子已经被作者于2006-1-8 14:45:06编辑过]
举报 回复(0) 喜欢(0)     评分
jxtan
路人甲
路人甲
  • 注册日期2004-08-26
  • 发帖数4
  • QQ
  • 铜币137枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-01-08 18:29
楼上的VBA和VB不一样呀,在VB环境下如何做呀
楼上的VBA和VB不一样呀,在VB环境下如何做呀
举报 回复(0) 喜欢(0)     评分
zhousky
论坛版主
论坛版主
  • 注册日期2003-08-01
  • 发帖数281
  • QQ
  • 铜币1027枚
  • 威望3点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-01-09 09:10
难道要把源代码全部写出来给你吗?VB和VBA有多大的差别?
不要看我噢
举报 回复(0) 喜欢(0)     评分
wanilyer
路人甲
路人甲
  • 注册日期2004-12-29
  • 发帖数43
  • QQ
  • 铜币60枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-01-12 20:49
<P>顶</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部