======================================================== 怎样在buffer里面选择要素:
======================================================== 1. Dim pSpFilter As ISpatialFilter 2. Set pSpFilter = New SpatialFilter 3.
4. Dim pTopOper As ITopologicalOperator 5. Set pTopOper = pfeature.Shape 6. Dim pGeometry As IGeometry 7. Set pGeometry = pTopOper.Buffer(1) 8.
9. Set pSpFilter.Geometry = pGeometry
10. pSpFilter.SpatialRel = esriSpatialRelContains
11. '(esriSpatialRelContains是ISpatialFilter里面SpatialRel的一种参数
esriSpatialRelEnum,值为8,代表在这个区域内包含的要素) 12. 13. Set m_pSelGW_D = pLyr_D
14. m_pSelGW_D.SelectFeatures pSpFilter, esriSelectionResultNew, False 15. '(m_pSelGW_D是IfeatureSelection类型的变量) 16. pSpFilter.SpatialRel = esriSpatialRelIntersects 17.
18. Set m_pSelGW_X = pLyr
19. m_pSelGW_X.SelectFeatures pSpFilter, esriSelectionResultNew, False
25. Merge要素Union要素
1. Private Sub UnionSelected() 2. Dim pMxDoc As IMxDocument 3. Dim pFtrLyr As IFeatureLayer 4. Dim pFtrCls As IFeatureClass 5. Dim pFtrSel As IFeatureSelection
6. Dim pFtr As IFeature
7. Dim pEnumGeom As IEnumGeometry 8. Dim pEnumGeomBind As IEnumGeometryBind 9. Dim pTopOp As ITopologicalOperator 10. Dim pUnionedPolylines As IPolyline 11.
12. ' Get a ref to the selected polylines in the 1st layer 13. Set pMxDoc = ThisDocument
14. Set pFtrLyr = pMxDoc.FocusMap.Layer(0) 15. Set pFtrSel = pFtrLyr
16. Set pFtrCls = pFtrLyr.FeatureClass 17.
18. ' Create an enumeration of the selected polyines 19. Set pEnumGeom = New EnumFeatureGeometry 20. Set pEnumGeomBind = pEnumGeom
21. pEnumGeomBind.BindGeometrySource Nothing, pFtrSel.SelectionSet 22. pEnumGeom.Reset 23.
24. ' Union the polylines
25. Set pUnionedPolylines = New Polyline 26. Set pTopOp = pUnionedPolylines 27. pTopOp.ConstructUnion pEnumGeom 28.
29. ' Add this new unioned polyline to the featureclass 30. Set pFtr = pFtrCls.CreateFeature 31. Set pFtr.Shape = pUnionedPolylines 32. pFtr.Store 33. 34. End Sub C#语言
1. if (pFC.ShapeType ==
ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon) 2. {
3. IEnumGeometry pEnumGeom;
4. IEnumGeometryBind pEnumGeomBind = new EnumFeatureGeometryClass(); 5. IFeatureLayer pLyr = new FeatureLayerClass(); 6. pLyr.FeatureClass = pFC;
7. IFeatureSelection pFeatSel = (IFeatureSelection)pLyr; 8.
9. IQueryFilter pQfliter = new QueryFilterClass(); 10. pQfliter.WhereClause = this.SQLText.Text; 11. 12.
pFeatSel.SelectFeatures(pQfliter,
esriSelectionResultEnum.esriSelectionResultNew, false); 13.
14. pEnumGeomBind.BindGeometrySource(null, pFeatSel.SelectionSet); 15. pEnumGeom = (IEnumGeometry)pEnumGeomBind; 16. ITopologicalOperator pTopo = new PolygonClass(); 17. pTopo.ConstructUnion(pEnumGeom); 18. pGeom = (IGeometry)pTopo; 19. }
20. return pGeom;
26. 怎样从Table中获取具体需求值的Row
1. ITable pTable = (ITable)pFC; 2.
int
index
=
pTable.Fields.FindField(\
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 == \13. {
14. pAnswerRow = pRow; 15. break; 16. }
17. pRow = pCur.NextRow(); 18. }
27. 怎样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.
8. Set pMxDocument = Application.Document 9. Set pActiveView = pMxDocument.FocusMap 10. Set
pDisplayTransform
=
pActiveView.ScreenDisplay.DisplayTransformation 11. Set pEnvelope = pDisplayTransform.VisibleBounds
12. 'In this case, we could have set pEnvelope to IActiveView::Extent 13. 'Set pEnvelope = pActiveView.Extent 14. Set pCenterPoint = New Point
15.
16. pCenterPoint.x = ((pEnvelope.XMax - pEnvelope.XMin) / 2) + pEnvelope.XMin 17. pCenterPoint.y = ((pEnvelope.YMax - pEnvelope.YMin) / 2) + pEnvelope.YMin 18. pEnvelope.width = pEnvelope.width / 2 19. pEnvelope.height = pEnvelope.height / 2 20. pEnvelope.CenterAt pCenterPoint
21. pDisplayTransform.VisibleBounds = pEnvelope 22. pActiveView.Refresh 23. End Sub
28. 怎样读取一个字段内的所有值 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(theFieldVa
lue);
12. pArr.Add(theFieldValue); 13. }
14. pFeature = pFeaCur.NextFeature();
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库ArcEngine - 开发接口集(10)在线全文阅读。
相关推荐: