alearner
路人甲
路人甲
  • 注册日期2006-09-11
  • 发帖数74
  • QQ
  • 铜币433枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1015回复:1

Area Example

楼主#
更多 发布于:2007-05-01 11:50
<P>Area Example<BR>' The example shows how to get the properties for a selected polygon in<BR>' an ArcMap edit session.</P>
<P>Public Sub t_IArea_polygon()<BR>   Dim pID As New UID<BR>   pID = "esriEditor.editor"<BR>   Dim pEditor As IEditor<BR>   Dim pApp As IApplication<BR>   Set pApp = Application<BR>   Set pEditor = pApp.FindExtensionByCLSID(pID)<BR>   <BR>   If pEditor.SelectionCount <>  1 Then<BR>     MsgBox "select one polygon"<BR>     Exit Sub<BR>   End If<BR>   <BR>   Dim pEnumFeat As IEnumFeature<BR>   Dim pFeature As IFeature<BR>   Dim i As Long</P>
<P>   Set pEnumFeat = pEditor.EditSelection</P>
<P>   Dim pArea As IArea<BR>   Dim pCenter As IPoint<BR>   Dim pLabel As IPoint<BR>   Set pCenter = New Point<BR>   Set pLabel = New Point</P>
<P>   Set pFeature = pEnumFeat.Next</P>
<P>   While Not pFeature Is Nothing<BR>     If pFeature.Shape.GeometryType = esriGeometryPolygon Then<BR>       Set pArea = pFeature.Shape<BR>       MsgBox "+++Polygon::IArea properties..." ; vbCrLf _<BR>       ; "Area = " ; pArea.Area ; vbCrLf _<BR>       ; "Center.X = " ; pArea.Centroid.X ; vbCrLf _<BR>       ; "Center.Y = " ; pArea.Centroid.Y ; vbCrLf _<BR>       ; pArea.LabelPoint.X ; vbCrLf _<BR>       ; "LabelPoint.Y = " ; pArea.LabelPoint.Y</P>
<P>       pArea.QueryCentroid pCenter<BR>       pArea.QueryLabelPoint pLabel<BR>       MsgBox "+++Polygon::IArea Queries..." ; vbCrLf _<BR>       ; "Center = " ; pCenter.X ; "," ; pCenter.Y ; vbCrLf _<BR>       ; "Label = " ; pLabel.X ; "," ; pLabel.Y ; vbCrLf</P>
<P>     End If<BR>     Set pFeature = pEnumFeat.Next<BR>   Wend</P>
<P>End Sub</P>
喜欢0 评分0
whmwxhanshan123
路人甲
路人甲
  • 注册日期2006-06-17
  • 发帖数3108
  • QQ
  • 铜币6445枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-05-01 19:01
谢谢!
举报 回复(0) 喜欢(0)     评分
游客

返回顶部