wuyue521_0
路人甲
路人甲
  • 注册日期2006-06-22
  • 发帖数47
  • QQ
  • 铜币272枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1434回复:2

请教:怎么给feature做BUFF?

楼主#
更多 发布于:2006-07-03 20:26
<P>我要做desktop里的功能select by loction,查都可以查了</P>
<P>就是不知道BUFF怎么写。求帮忙</P><img src="images/post/smile/dvbbs/em12.gif" /><img src="images/post/smile/dvbbs/em12.gif" />
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2006-07-04 08:29
<P>看开发帮助里的例子BufferFeatures Sample</P>
<P>也可以看下面的</P>
<DIV><B>Description:</B><BR><BR><TEXT>This sample buffers each selected feature in the focus map and stores the results as polygon graphic elements in the map's basic graphics layer. </TEXT>
<TABLE bgColor=#edf6fd>

<TR>
<TD><B>Products:</B>
<DIV 15px; POSITION: relative">
<P>ArcView: VBA</P></DIV>
<P>
<P><B>Platforms:</B> Windows
<P><B>Minimum ArcGIS Release:</B> 9.0 </P></TD></TR></TABLE><BR><B>How to use:</B>
<DIV>
<OL>
<LI>Paste the code into VBA.
<LI>Load one or more feature layers.
<LI>Select some features.
<LI>From the Macros dialog, run the BufferFeatures macro.</LI></OL></DIV><BR>
<DIV><PRE><CODE><FONT color=#0000ff>Public Sub</FONT></CODE> BufferFeatures()
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pMxDoc <CODE><FONT color=#0000ff>As</FONT></CODE> IMxDocument
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pActiveView <CODE><FONT color=#0000ff>As</FONT></CODE> IActiveView
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pGraphicsContainer <CODE><FONT color=#0000ff>As</FONT></CODE> IGraphicsContainer
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pEnumFeature <CODE><FONT color=#0000ff>As</FONT></CODE> IEnumFeature
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pFeature <CODE><FONT color=#0000ff>As</FONT></CODE> IFeature
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pTopoOp <CODE><FONT color=#0000ff>As</FONT></CODE> ITopologicalOperator
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pElement <CODE><FONT color=#0000ff>As</FONT></CODE> IElement
  <CODE><FONT color=#0000ff>Dim</FONT></CODE> strBufferDistance <CODE><FONT color=#0000ff>As String
  
  Set</FONT></CODE> pMxDoc = Application.Document
  <CODE><FONT color=#0000ff>Set</FONT></CODE> pActiveView = pMxDoc.FocusMap
  <CODE><FONT color=#0000ff>Set</FONT></CODE> pGraphicsContainer = pMxDoc.FocusMap
  
  <CODE><FONT color=#008000>'Verify there is a feature selection</FONT></CODE>
  <CODE><FONT color=#0000ff>If</FONT></CODE> pMxDoc.FocusMap.SelectionCount = 0 <CODE><FONT color=#0000ff>Then Exit Sub</FONT></CODE>
  
  <CODE><FONT color=#008000>'Get a buffer distance from the user</FONT></CODE>
  strBufferDistance = InputBox("Enter Distance:", "Buffer")
  <CODE><FONT color=#0000ff>If</FONT></CODE> strBufferDistance = "" <CODE><FONT color=#0000ff>Or Not</FONT></CODE> IsNumeric(strBufferDistance) <CODE><FONT color=#0000ff>Then Exit Sub</FONT></CODE>
  
  <CODE><FONT color=#008000>'Buffer all the selected features by the BufferDistance</FONT></CODE>
  <CODE><FONT color=#008000>'and create a new polygon element from each result</FONT></CODE>
  <CODE><FONT color=#0000ff>Set</FONT></CODE> pEnumFeature = pMxDoc.FocusMap.FeatureSelection
  pEnumFeature.Reset
  <CODE><FONT color=#0000ff>Set</FONT></CODE> pFeature = pEnumFeature.Next
  <CODE><FONT color=#0000ff>Do While Not</FONT></CODE> pFeature <CODE><FONT color=#0000ff>Is Nothing
    Set</FONT></CODE> pTopoOp = pFeature.Shape
    <CODE><FONT color=#0000ff>Set</FONT></CODE> pElement = <CODE><FONT color=#0000ff>New</FONT></CODE> PolygonElement
    pElement.Geometry = pTopoOp.Buffer(<CODE><FONT color=#0000ff>CInt</FONT></CODE>(strBufferDistance))
    pGraphicsContainer.AddElement pElement, 0
    <CODE><FONT color=#0000ff>Set</FONT></CODE> pFeature = pEnumFeature.Next
  <CODE><FONT color=#0000ff>Loop</FONT></CODE>
  
  <CODE><FONT color=#008000>'Redraw the graphics</FONT></CODE>
  pActiveView.PartialRefresh esriViewGraphics, <CODE><FONT color=#0000ff>Nothing</FONT></CODE>, <CODE><FONT color=#0000ff>Nothing
End Sub</FONT></CODE>
</PRE></DIV></DIV>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
wuyue521_0
路人甲
路人甲
  • 注册日期2006-06-22
  • 发帖数47
  • QQ
  • 铜币272枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-07-04 18:25
<P>3q</P>
<P>发现还是gis解答的多啊</P>
<P>难道这就是传说中的能者多劳么?</P>
<P>给我们多培训培训,以后我们也能回答问题了哈哈</P><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部