阅读:1956回复:4
ARCEngine 开发中,如何判定点图层中的点落在面图层上某个区域
我是新手,在ARCEngine 开发中,我用MapControl调入mxd文件,在mxd文件中有两个图层,一是点状图层,二是面状图层,问题是如何判定点图层中的某些点落在面图层中的某个区域,请高手指点!先谢了
|
|
1楼#
发布于:2006-01-12 20:49
<P>顶</P>
|
|
2楼#
发布于:2006-01-09 09:10
难道要把源代码全部写出来给你吗?VB和VBA有多大的差别?
|
|
|
3楼#
发布于:2006-01-08 18:29
楼上的VBA和VB不一样呀,在VB环境下如何做呀
楼上的VBA和VB不一样呀,在VB环境下如何做呀 |
|
4楼#
发布于: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编辑过]
|
|
|