gaoguosheng
路人甲
路人甲
  • 注册日期2005-08-02
  • 发帖数38
  • QQ18087249
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2834回复:8

angine有没办法计算面积

楼主#
更多 发布于:2005-08-06 23:50
刚开始学习angine,做了点东西,都是抄这抄那,这个计算面的面积或者是线的长度等,好像找不到,希望大侠可以指点一下,最好能奉献出源码,感激!!
喜欢0 评分0
zhangxw521
路人甲
路人甲
  • 注册日期2006-09-22
  • 发帖数11
  • QQ
  • 铜币213枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2008-02-16 20:33
xiexie,i love you
举报 回复(0) 喜欢(0)     评分
zhangxw521
路人甲
路人甲
  • 注册日期2006-09-22
  • 发帖数11
  • QQ
  • 铜币213枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-06-24 17:13
xiexie
举报 回复(0) 喜欢(0)     评分
dingdinghao
路人甲
路人甲
  • 注册日期2005-08-17
  • 发帖数16
  • QQ
  • 铜币189枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-10-13 09:27
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em05.gif" /><img src="images/post/smile/dvbbs/em07.gif" /><img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
dingdinghao
路人甲
路人甲
  • 注册日期2005-08-17
  • 发帖数16
  • QQ
  • 铜币189枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2005-08-20 14:22
<img src="images/post/smile/dvbbs/em01.gif" />好同志。<img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
gaoguosheng
路人甲
路人甲
  • 注册日期2005-08-02
  • 发帖数38
  • QQ18087249
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-08-18 22:10
<P>已经调试成功!刚脆把代码贴出来一起分享.</P>
<P>Public Sub SelectMouseDown(x As Long, y As Long)<BR>  Dim pFeatureLayer As IFeatureLayer<BR>  Dim pFeatureClass As IFeatureClass<BR>  Dim pSpatialFilter As ISpatialFilter<BR>  Dim pFilter As IQueryFilter<BR>  Dim pActiveView As IActiveView<BR>  Dim pGeometry As IGeometry<BR>  Dim pPoint As IPoint<BR>  <BR>  <BR>  <BR>  On Error GoTo SelectMouseDown_err<BR>  <BR>  If m_pCurrentLayer Is Nothing Then Exit Sub<BR>  If Not TypeOf m_pCurrentLayer Is IGeoFeatureLayer Then Exit Sub<BR>  <BR>  ' Get the feature layer and class of the current layer<BR>  Set pFeatureLayer = m_pCurrentLayer<BR>  Set pFeatureClass = pFeatureLayer.FeatureClass<BR>   <BR>  If pFeatureClass Is Nothing Then Exit Sub<BR>  <BR>  ' Get the mouse down position in map coordinates<BR>  Set pActiveView = m_pMap<BR>  Set pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)<BR>  Set pGeometry = pPoint<BR>  <BR>  ' Use a four pixel buffer around the cursor for feature search<BR>  Dim length As Double<BR>  length = ConvertPixelsToMapUnits(m_pMap, 4)<BR>  Dim pTopo As ITopologicalOperator<BR>  Set pTopo = pGeometry<BR>  Dim pBuffer As IGeometry<BR>  Set pBuffer = pTopo.Buffer(length)<BR>  Set pGeometry = pBuffer.Envelope<BR>  <BR>  ' Set up a Filter specific to this layer<BR>  Set pSpatialFilter = New SpatialFilter<BR>  Set pSpatialFilter.Geometry = pGeometry<BR>  Select Case pFeatureClass.ShapeType<BR>    Case esriGeometryPoint<BR>      pSpatialFilter.SpatialRel = esriSpatialRelContains<BR>    Case esriGeometryPolyline<BR>      pSpatialFilter.SpatialRel = esriSpatialRelCrosses<BR>    Case esriGeometryPolygon<BR>      pSpatialFilter.SpatialRel = esriSpatialRelIntersects<BR>      <BR>  End Select<BR>  pSpatialFilter.GeometryField = pFeatureClass.ShapeFieldName<BR>  Set pFilter = pSpatialFilter<BR> <BR>  ' Do the search<BR>  Dim pCursor As IFeatureCursor<BR>  Set pCursor = pFeatureLayer.Search(pFilter, False)<BR>  <BR>  ' and select the features on the map<BR>  Dim pFeature As iFeature<BR>  Set pFeature = pCursor.NextFeature<BR>  <BR>  Dim pArea As IArea '面积<BR>  Dim pCurve As ICurve '周长<BR>  Dim pCenter As IPoint<BR>  Dim pLabel As IPoint<BR>  Dim Pstr As String<BR>  Set pCenter = New Point<BR>  Set pLabel = New Point<BR>  <BR>  <BR>  <BR>  While Not pFeature Is Nothing<BR>    Select Case pFeature.Shape.GeometryType    '计算面积<BR>    Case esriGeometryPolygon<BR>      Set pArea = pFeature.Shape<BR>      Set pCurve = pFeature.Shape<BR>      Pstr = "长度:" + CStr(Abs(Round(pCurve.length, 3))) + " 面积:" + CStr(Abs(Round(pArea.Area, 3)))<BR>    Case esriGeometryPolyline<BR>      Set pCurve = pFeature.Shape<BR>      Pstr = "长度:" + CStr(Abs(Round(pCurve.length, 3)))<BR>    Case Else<BR>      Pstr = ""<BR>    End Select<BR>    <BR>    m_pMap.SelectFeature m_pCurrentLayer, pFeature<BR>    Set pFeature = pCursor.NextFeature<BR>  Wend<BR>  pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing<BR>   <BR>  frmMain.StatusBar1.Panels(2).Text = Pstr<BR>  <BR>  ClearSelect<BR>  Exit Sub<BR>SelectMouseDown_err:<BR>  MsgBox Err.Description<BR>End Sub</P>
<img src="images/post/smile/dvbbs/em04.gif" />
举报 回复(0) 喜欢(0)     评分
shijibao01
路人甲
路人甲
  • 注册日期2004-10-08
  • 发帖数44
  • QQ
  • 铜币250枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2005-08-16 22:19
area函数还要注意正负
举报 回复(0) 喜欢(0)     评分
gaoguosheng
路人甲
路人甲
  • 注册日期2005-08-02
  • 发帖数38
  • QQ18087249
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2005-08-08 15:46
多谢大侠!
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
8楼#
发布于:2005-08-08 15:33
<P>.length</P>
<P>.area</P>
<P>在帮助里查看下</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部