sparrow009
路人甲
路人甲
  • 注册日期2006-08-03
  • 发帖数27
  • QQ
  • 铜币200枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1100回复:0

[求助]如何用VBA向Polyline数据属性表中一个字段赋值

楼主#
更多 发布于:2007-12-06 22:52
<P>Polyline数据属性表中有个Angle的字段,现在已经计算出Angle的值,比如说变量dAngle是在VBA中代表字段Angle的值,下面是Gisempire一位朋友给的代码,小弟初学,不知道字段Angle的接口是什么,请问如何把dAngle的值赋给字段Angle?谢谢了!</P>
<P><FONT face="Times New Roman">Sub Gisempire_lineway()<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Dim pDoc As IMxDocument<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Dim pMap As IMap<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Dim pEnumFeat As IEnumFeature<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Dim pFeat As IFeature<p></p></FONT></P>
<P ><FONT face="Times New Roman">  <p></p></FONT></P>
<P ><FONT face="Times New Roman">  Set pDoc = ThisDocument<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Set pMap = pDoc.FocusMap<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Set pEnumFeat = pMap.FeatureSelection<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Set pFeat = pEnumFeat.Next<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Do While (Not pFeat Is Nothing)<p></p></FONT></P>
<P ><FONT face="Times New Roman">If pFeat.Shape.GeometryType = 3 Then<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Dim pline As IPolyline<p></p></FONT></P>
<P ><FONT face="Times New Roman">      Set pline = pFeat.Shape<p></p></FONT></P>
<P ><FONT face="Times New Roman">      Dim iline As iline<p></p></FONT></P>
<P ><FONT face="Times New Roman">      Set iline = New Line<p></p></FONT></P>
<P ><FONT face="Times New Roman">      iline.FromPoint = pline.FromPoint<p></p></FONT></P>
<P ><FONT face="Times New Roman">      iline.ToPoint = pline.ToPoint<p></p></FONT></P>
<P ><FONT face="Times New Roman">      Dim dAngle As Double<p></p></FONT></P>
<P ><FONT face="Times New Roman">      dAngle = (180 * iline.Angle) / (4 * Atn(1))<p></p></FONT></P>
<P ><FONT face="Times New Roman">      If dAngle < 0 Then<p></p></FONT></P>
<P ><FONT face="Times New Roman">        dAngle = dAngle + 360<p></p></FONT></P>
<P ><FONT face="Times New Roman">      End If<p></p></FONT></P>
<P ><FONT face="Times New Roman">      MsgBox dAngle<p></p></FONT></P>
<P ><FONT face="Times New Roman">    End If<p></p></FONT></P>
<P ><FONT face="Times New Roman">  Set pFeat = pEnumFeat.Next<p></p></FONT></P>
<P ><FONT face="Times New Roman">  <st1:place w:st="on">Loop</st1:place><p></p></FONT></P>
<P ><FONT face="Times New Roman">End Sub<p></p></FONT></P>
喜欢0 评分0
游客

返回顶部