阅读:1522回复:2
急!!!!! 需要线选的代码~或者缓冲查询的代码
有这样的代码,借过看一下.万分谢谢了!!
|
|
1楼#
发布于:2005-11-07 15:36
<P>利用IMap中的SelectByShape方法,在设置<EM>Shape参数时将</EM>IGeometry 就口的<a href="ms-its:D:\Program target="_blank" ><STRONG>GeometryType</STRONG></A>设置为<STRONG>esriGeometryLine</STRONG> 试一试看!</P>
|
|
2楼#
发布于:2005-11-07 15:37
<P> 开发帮助里的,对红色的地方坐些修改就可以了,下面的是对polygon的buffer</P>
<P> Public Sub BufferFeatures()<BR> Dim pMxDoc As IMxDocument<BR> Dim pActiveView As IActiveView<BR> Dim pGraphicsContainer As IGraphicsContainer<BR> Dim pEnumFeature As IEnumFeature<BR> Dim pFeature As IFeature<BR> Dim pTopoOp As ITopologicalOperator<BR> Dim pElement As IElement<BR> Dim strBufferDistance As String<BR> <BR> Set pMxDoc = Application.Document<BR> Set pActiveView = pMxDoc.FocusMap<BR> Set pGraphicsContainer = pMxDoc.FocusMap<BR> <BR> 'Verify there is a feature selection<BR> If pMxDoc.FocusMap.SelectionCount = 0 Then Exit Sub<BR> <BR> 'Get a buffer distance from the user<BR> strBufferDistance = InputBox("Enter Distance:", "Buffer")<BR> If strBufferDistance = "" Or Not IsNumeric(strBufferDistance) Then Exit Sub<BR> <BR> 'Buffer all the selected features by the BufferDistance<BR> 'and create a new polygon element from each result<BR> Set pEnumFeature = pMxDoc.FocusMap.FeatureSelection<BR> pEnumFeature.Reset<BR> Set pFeature = pEnumFeature.Next<BR> Do While Not pFeature Is Nothing<BR><FONT color=#ff3300> Set pTopoOp = pFeature.Shape<BR> Set pElement = New PolygonElement</FONT><BR> pElement.Geometry = pTopoOp.Buffer(CInt(strBufferDistance))<BR> pGraphicsContainer.AddElement pElement, 0<BR> Set pFeature = pEnumFeature.Next<BR> Loop<BR> <BR> 'Redraw the graphics<BR> pActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing<BR>End Sub<BR></P> |
|
|