ArcEngine接口大全.doc_第1页
ArcEngine接口大全.doc_第2页
ArcEngine接口大全.doc_第3页
ArcEngine接口大全.doc_第4页
ArcEngine接口大全.doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

转载ArcEngine接口大全(四)转自ESRI中国社区(2010-11-14 14:58:22) 转载原文标签: 转载分类: AE开发 原文地址:ArcEngine接口大全(四)转自ESRI中国社区作者:GisEr27.怎样从Table中获取具体需求值的Row:1. ITable pTable = (ITable)pFC; 2. int index = pTable.Fields.FindField(FieldName); 3. IQueryFilter pQFilter = new QueryFilterClass(); 4. ICursor pCur; 5. pCur = pTable.Search(pQFilter, false); 6. IRow pRow = new Row(); 7. IRow pAnswerRow = new Row(); 8. pRow = pCur.NextRow(); 9. while (pRow != null) 10. 11. string Value = pRow.get_Value(index).ToString(); 12. if (Value = Value) 13. 14. pAnswerRow = pRow; 15. break; 16. 17. pRow = pCur.NextRow(); 18. 28.怎样ZoomInCenter:1. Public Sub ZoomInCenter() 2. Dim pMxDocument As IMxDocument 3. Dim pActiveView As IActiveView 4. Dim pDisplayTransform As IDisplayTransformation 5. Dim pEnvelope As IEnvelope 6. Dim pCenterPoint As IPoint 7. Set pMxDocument = Application.Document 8. Set pActiveView = pMxDocument.FocusMap 9. Set pDisplayTransform = pActiveView.ScreenDisplay.DisplayTransformation 10. Set pEnvelope = pDisplayTransform.VisibleBounds 11. In this case, we could have set pEnvelope to IActiveView:Extent 12. Set pEnvelope = pActiveView.Extent 13. Set pCenterPoint = New Point 14. 15. pCenterPoint.x = (pEnvelope.XMax - pEnvelope.XMin) / 2) + pEnvelope.XMin 16. pCenterPoint.y = (pEnvelope.YMax - pEnvelope.YMin) / 2) + pEnvelope.YMin 17. pEnvelope.width = pEnvelope.width / 2 18. pEnvelope.height = pEnvelope.height / 2 19. pEnvelope.CenterAt pCenterPoint 20. pDisplayTransform.VisibleBounds = pEnvelope 21. pActiveView.Refresh 22. End Sub 29.怎样读取一个字段内的所有值:1. IFeatureClass pFC = m_SDEQuery.getFeatureClass(); 2. IFeatureCursor pFeaCur = pFC.Search(null, false); 3. IFeature pFeature = pFeaCur.NextFeature(); 4. int pFieldIndex = pFC.Fields.FindField(this.m_cboQryFld.SelectedItem.Value.ToString(); 5. System.Collections.ArrayList pArr = new System.Collections.ArrayList(); 6. while (pFeature != null) 7. 8. string theFieldValue = pFeature.get_Value(pFieldIndex).ToString(); 9. if (!pArr.Contains(theFieldValue) & (theFieldValue.Trim() != ) 10. 11. m_cboQryText.Items.Add(theFieldValue); 12. pArr.Add(theFieldValue); 13. 14. pFeature = pFeaCur.NextFeature(); 15. 30怎样编辑更改属性字段的值:1. IRow prow = (IRow)bendiFeatureC.GetFeature(1); 2. MessageBox.Show(prow.Table.Fields.FieldCount.ToString(); 3. ITable ptable = (ITable)bendiFeatureC; 4. IQueryFilter pqfilter = new QueryFilterClass(); 5. pqfilter.WhereClause = dkmc = 北江路南郊一公里; 6. IFeatureCursor pfeatcur; 7. pfeatcur = bendiFeatureC.Search(pqfilter, false); 8. IFeature pfff = pfeatcur.NextFeature(); 9. while (pfff != null) 10. 11. IRow prrr = (IRow)pfff; 12. prrr.set_Value(prrr.Fields.FindField(dkmc), 北江路南郊二公里); 13. pfff = (IFeature)prrr; 14. pfff.Store(); 15. pfff = pfeatcur.NextFeature(); 16. 31怎样将MapControl中的Map复制到PageLayoutControl中1. Public Sub CopyAndOverwriteMap() 2. On Error GoTo CopyAndOverwriteMap_err 3. Dim pObjectCopy As IObjectCopy 4. pObjectCopy = New ObjectCopy 5. Dim pToCopyMap As Object 6. pToCopyMap = frmMap.AxMapControl1.Map 7. Dim pCopiedMap As Object 8. pCopiedMap = pObjectCopy.Copy(pToCopyMap) 9. Dim pToOverwriteMap As Object 10. pToOverwriteMap = PrintPageLayout.AxPageLayoutControl1.ActiveView.FocusMap 11. pObjectCopy.Overwrite(pCopiedMap, pToOverwriteMap) 12. frmMap.AxMapControl1.MousePointer 13. =ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerArrow 14. frmMain.StatusMessage.Text = 15. PrintPageLayout.ShowDialog() 16. Exit Sub 17. CopyAndOverwriteMap_err: 18. MsgBox(Err.Number & - & Err.Description, MsgBoxStyle.Critical, Application.ProductName & -Copy Map) 19. Exit Sub 20. End Sub 32怎样判断是否出于编辑状态:1. If m_pEditor.EditState = esriStateEditing Then 2. m_pEditor.StartOperation 3. 删除冗余节点 4. DelSubPoint pMap 5. m_pEditor.StopOperation OK 6. End If 33。怎样用点创建一个Polygon:1. Dim pPnt0 as IPoint, pPnt1 as IPoint, pPnt2 as IPoint 2. Set pPnt0 = New Point 3. Set pPnt1 = New Point 4. Set pPnt2 = New Point 5. pPnt0.PutCoords x1, y1 6. pPnt1.PutCoords x2, y2 7. pPnt2.PutCoords x3, y3 8. Dim pPolygon as IPointCollection(注意,这里的polygon是设置为点集的) 9. Set pPolygon =New Polygon 10. pPolygon.AddPoint pPnt0 11. pPolygon.AddPoint pPnt1 12. pPolygon.AddPoint pPnt2 13. pPolygon.AddPoint pPnt0(注意,这里一定要闭合回到pPnt0才能形成一个Polygon) 14. Set pFeature.Shape = pPolygon 15. pFeature.Store 16. (用这种方法可以创建一个Polyline: 17. Dim pPolyline as IPointCollection 18. Set pPolyline =New Line 19. pPolyline.AddPoint pPnt0 20. pPolyline.AddPoint pPnt1 21. pPolyline.AddPoint pPnt2(这时就是一个polyline,不是闭合的) 22. 还可以用另外一种方法,画一条两点之间的线段: 23. Dim pLine As ILine 24. Set pLine = New esriGeometry.Line 25. pLine.PutCoords pPnt0, pPnt1(第一个为from点,第二个为to点) 26. ) 34样运用属性来计算总面积:1. Dim pDoc As IMxDocument2. Dim pMap As IMap3. Dim pFeatureLayer As IFeatureLayer4. Dim pFeatureClass As IFeatureClass5.6. Set pDoc = m_pApplication.Document7. Set pMap = pDoc.ActiveView.FocusMap8. Set pFeatureLayer = pMap.Layer(0)9. Set pFeatureClass = pFeatureLayer.FeatureClass10.11. + create the query filter, and give12. + it a where clause13. Dim pQueryFilt As IQueryFilter14. Dim pFeatureCursor As IFeatureCursor15.16. Set pQueryFilt = New QueryFilter17. pQueryFilt.WhereClause = subtype = COM18. Set pFeatureCursor = pFeatureClass.Search(pQueryFilt, False)19.20. + get the area field21. Dim pFields As IFields22. Dim pField As IField23. Dim lAIndex As Long24.25. Set pFields = pFeatureClass.Fields26. lAIndex = pFields.FindField(Area)27. Set pField = pFields.Field(lAIndex)28.29. + a variable to hold the total area30. Dim dtotArea As Double31. dtotArea = 0#32.33. + loop through all of the features and34. + calculate the sum of all of the areas35. Dim pFeature As IFeature36. Set pFeature = pFeatureCursor.NextFeature37. Do38. dtotArea = dtotArea + pFeature.Value(lAIndex)39. Set pFeature = pFeatureCursor.NextFeature40. Loop Until pFeature Is Nothing41.42. + send the total area to a message box43. MsgBox dtotArea 35关于属性域的一些心得1. Dim pField As IField2. Dim pFields As IFields3. Dim pFieldEdit As IFieldEdit4. Dim pFieldsEdit As IFieldsEdit5. Dim pGeometryDef As IGeometryDef6. Dim pGeometryDefEdit As IGeometryDefEdit7. 8. Set pFields = New Fields9. Set pFieldsEdit = pFields10. pFieldsEdit.FieldCount = 3511. 12. Set pField = New Field13. Set pFieldEdit = pField14. With pFieldEdit15. .Name = OBJECTID16. .AliasName = OBJECTID17. .Type = esriFieldTypeOID18. End With19. Set pFieldsEdit.Field(0) = pField20. 21. Set pField = New Field22. Set pFieldEdit = pField23. pFieldEdit.Name = SHAPE24. pFieldEdit.Type = esriFieldTypeGeometry25. 26. Set pGeometryDef = New GeometryDef27. Set pGeometryDefEdit = pGeometryDef28. With pGeometryDefEdit29. .GeometryType = esriGeometryPolygon30. Set .SpatialReference = New UnknownCoordinateSystem31. End With32. Set pFieldEdit.Geom

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论