阅读:2216回复:6
[求助]ArcGIS里怎样求圆心的坐标?
<P>ArcGIS里怎样求圆心的坐标?</P>
<P>就是知道一个圆。代码应该怎么写啊?谢谢大家了</P> |
|
1楼#
发布于:2006-05-25 09:05
怎么没有人回复啊?
|
|
2楼#
发布于:2006-05-25 09:50
听别人说有个centerid属性,改怎么用啊?
|
|
3楼#
发布于:2006-05-25 16:16
<P>C#中:</P>
<P>IArea area = obj as IArea</P> <P>然后调用area.Centroid</P> <P>obj为圆对象 </P> <P>同样方法可以求出其他图形的中心(质心),详见AO</P> |
|
|
4楼#
发布于:2006-05-25 16:20
<H1>Area Example</H1><PRE><PRE><CODE><PRE>' The example shows how to get the properties for a selected polygon in
' an ArcMap edit session. Public Sub t_IArea_polygon() Dim pID As New UID pID = "esriEditor.editor" Dim pEditor As IEditor Dim pApp As IApplication Set pApp = Application Set pEditor = pApp.FindExtensionByCLSID(pID) If pEditor.SelectionCount <> 1 Then MsgBox "select one polygon" Exit Sub End If Dim pEnumFeat As IEnumFeature Dim pFeature As IFeature Dim i As Long Set pEnumFeat = pEditor.EditSelection Dim pArea As IArea Dim pCenter As IPoint Dim pLabel As IPoint Set pCenter = New Point Set pLabel = New Point Set pFeature = pEnumFeat.Next While Not pFeature Is Nothing If pFeature.Shape.GeometryType = esriGeometryPolygon Then Set pArea = pFeature.Shape MsgBox "+++Polygon::IArea properties..." ; vbCrLf _ ; "Area = " ; pArea.Area ; vbCrLf _ ; "Center.X = " ; pArea.Centroid.X ; vbCrLf _ ; "Center.Y = " ; pArea.Centroid.Y ; vbCrLf _ ; pArea.LabelPoint.X ; vbCrLf _ ; "LabelPoint.Y = " ; pArea.LabelPoint.Y pArea.QueryCentroid pCenter pArea.QueryLabelPoint pLabel MsgBox "+++Polygon::IArea Queries..." ; vbCrLf _ ; "Center = " ; pCenter.X ; "," ; pCenter.Y ; vbCrLf _ ; "Label = " ; pLabel.X ; "," ; pLabel.Y ; vbCrLf End If Set pFeature = pEnumFeat.Next Wend End Sub</PRE></CODE></PRE></PRE> |
|
|
5楼#
发布于:2006-05-26 11:43
<P>呵呵,非常感谢<a href="http://www.gisempire.com/bbs/dispuser.asp?name=xxhhoddity" target="_blank" ><FONT color=#000000>xxhhoddity</FONT></A></P>
<P>那圆要是线状的呢?我是从CAD图里倒过来的,本来是点,却变成了一个小圈,我想再把点还原回去,只能是找圆心坐标了!谢谢啊!</P> |
|
6楼#
发布于:2006-05-29 00:08
线状的,你去获得IEnvelop接口(包络矩形)
|
|
|