ImageVerifierCode 换一换
格式:DOC , 页数:22 ,大小:463KB ,
资源ID:6201657      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-6201657.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(ArcEngine实现空间拓扑空间关联空间距离运算.doc)为本站会员(hyngb9260)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

ArcEngine实现空间拓扑空间关联空间距离运算.doc

1、【051】 ArcEngine 实现空间分析1.熟悉 ITopologicalOperator 接口(用于空间拓扑运算) 的使用2.熟悉 IRelationalOperator 接口( 用于空间关联运算 )的使用3.熟悉 IProximityOperator 接口(用于空间距离运算)的使用 目录:A1 ITopologicalOperator5 接口 公共方法: Buffer 方法: Boundary 方法: Clip 方法 : ConvexHull 方法: Cut 方法: Union 方法: Intersect 方法: Difference 方法:A2 IRelationalOperator

2、 接口 公共方法: Contains 方法: Overlaps 方法:A3 IPoint 接口A4 ICurve3 接口A5 ISegment 接口A6 ICircularArc 接口 -写在前面:使用空间分析的时候,会提示这样的错误“异常来自 HRESULT:0x80040215”,其原因就是:在使用 ITopologicalOperator 求交集等操作的时候,有时会出现“ HRESULT:0x80040215”这个异常,原来是空间参考不一样所致。因此只要 SpatialReference 属性设为同一空间参考就不会出现“ HRESULT:0x80040215”异常。所以在进行空间分析之前

3、,要保证所建立的 shapefile 文件具有相同的SpatialReference!- 第 A1 个 ITopologicalOperator5 接口:1. Provides additional information on non-simple geometries.【拓扑操作】MembersDescriptionBoundary返回值:IGeometryThe boundary of this geometry. A polygons boundary is a polyline. A polylines boundary is a multipoint. A point or mul

4、tipoints boundary is an empty point or multipoint.Buffer(double distance)返回值:IGeometry Constructs a polygon that is the locus of points at a distance less than or equal to a specified distance from this geometry.通过给定距离,得到操作图形的缓冲区,返回得到缓冲区几何图形!但是这里面的距离很是蹊跷,同时实验发现,我写入 0.01 的时候,大约表示 1km,所以大约是 1:100 000

5、的关系!Clip(IEnvelope clipperEnvelope)Constructs the intersection of this geometry and the specified envelope.返回矩形部分的要素,直接作用在要素上面!ClipDense Constructs the intersection of this geometry and the specified envelope; densifies lines in output contributed by the clipping envelope.ClipEx Constructs the inter

6、section of this geometry and the specified envelope.ClipToDomain Clips the geometry to the domain of the spatial reference. Useful for ensuring that buffers can be fit within the spatial domain of the feature class to which they are being added.ConstructUnion Defines this geometry to be the union of

7、 the inputs. More efficient for unioning multiple geometries than calling Union repeatedly.ConvexHull Constructs the convex hull of this geometry.Cut Splits this geometry into a part left of the cutting polyline, and a part right of it.Cut2 Divides a geometry into multiple partsDifference Constructs

8、 the geometry containing points from this geometry but not the other geometry.GeoNormalizeEx Shifts longitudes, if need be, into a continuous range of 360 degrees.Intersect Constructs the geometry that is the set-theoretic intersection of the input geometries. Use different resultDimension values to

9、 generate results of different dimensions.IntersectMultidimension Constructs the set-theoretic intersection of the inputs. The results are returned in a geometry bag with one element per result dimension.IsKnownSimple Indicates whether this geometry is known (or assumed) to be topologically correct.

10、IsKnownSimple Indicates whether this geometry is known (or assumed) to be topologically correct.IsSimple Indicates whether this geometry is known (or assumed) to be topologically correct, after explicitly determining this if the geometry is not already known (or assumed) to be simple.IsSimpleEx Dete

11、rmines why a geometry is not simple. Currently only implemented for polygons.QueryClipped Redefines clippedGeometry to be the intersection of this geometry and the clipping envelope.QueryClippedDense Redefines clippedGeometry to be the intersection of this geometry and the clipping envelope; densifi

12、es lines in the output contributed by the clipping envelope.Simplify Makes this geometry topologically correct.SymmetricDifference Constructs the geometry that contains points from either but not both input geometries.Union Constructs the geometry that is the set-theoretic union of the input geometr

13、ies.CoClasses that implement ITopologicalOperatorCoClasses and Classes DescriptionGeoEllipse (esriDefenseSolutions)Its a spheroidal ellipse.GeometryBag An ordered collection of objects that support the IGeometry interface.GeoPolygon (esriDefenseSolutions)Its a spheroidal polygon.GeoPolyline (esriDef

14、enseSolutions)This is a spheroidal polyline.MultiPatch A collection of surface patches.Multipoint An ordered collection of points; optionally has measure, height and ID attributes.Point A two dimensional point, optionally with measure, height, and ID attributes.Polygon A collection of rings ordered

15、by their containment relationship; optionally has measure, height and ID attributes.Polyline An ordered collection of paths; optionally has measure, height and ID attributes. | 公共代码部分:/公共变量!IMap pMap;IActiveView pActiveView;IEnvelope pEnv;ISelectionEnvironment pSelectionEnv;IEnumFeature pEnumFeature

16、;IGraphicsContainer pGraphicsContainer;IFeature pFeature;IGeometry pGeometry;IEnvelope pEnvClip;IPolyline pLineCut;IPolygon pFirstPolygon;/鼠标点击事件!private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)axMapControl1.MousePointer = esriControlsMousePointer.esriPoin

17、terCrosshair;if (isClip) /此时要拉 Clip 框pEnvClip = axMapControl1.TrackRectangle();isClip = false;else if (isCut)pLineCut = axMapControl1.TrackLine() as IPolyline;isCut = false;else if (isFirstIn)pMap = axMapControl1.Map;pActiveView = pMap as IActiveView;pEnv = axMapControl1.TrackRectangle();pSelectionE

18、nv = new SelectionEnvironment();pSelectionEnv.DefaultColor = GetColor(0, 255, 0);pMap.SelectByShape(pEnv, pSelectionEnv, false);pActiveView.Refresh();pEnumFeature = axMapControl1.Map.FeatureSelection as IEnumFeature;elsepMap = axMapControl1.Map;pActiveView = pMap as IActiveView;pEnv = axMapControl1.

19、TrackRectangle();pSelectionEnv = new SelectionEnvironment();pSelectionEnv.DefaultColor = GetColor(255, 0, 0);pMap.SelectByShape(pEnv, pSelectionEnv, false);pActiveView.Refresh();pEnumFeature = axMapControl1.Map.FeatureSelection as IEnumFeature;/RGB 颜色!private IRgbColor GetColor(int r, int g, int b)I

20、RgbColor pColor = new RgbColor();pColor.Red = r;pColor.Green = g;pColor.Blue = b;return pColor; | Buffer:private void button1_Click(object sender, EventArgs e)while (true)pGraphicsContainer = pMap as IGraphicsContainer; /定义容器pFeature = pEnumFeature.Next(); /遍历要素if (pFeature = null) /若不存在要素,则推出循环brea

21、k;pGeometry = pFeature.Shape; /获取要素的 GeometryITopologicalOperator pTopoOperator = pGeometry as ITopologicalOperator; /QI 到拓扑操作IGeometry pBufferGeo = pTopoOperator.Buffer(2); /缓冲区分析IElement pElement = new PolygonElement();pElement.Geometry = pBufferGeo; /获取得到的缓冲区pGraphicsContainer.AddElement(pElement

22、, 0); /显示缓冲区pActiveView.Refresh(); | Boundary:private void button2_Click(object sender, EventArgs e)while (true)pGraphicsContainer = pMap as IGraphicsContainer; /定义容器pFeature = pEnumFeature.Next(); /遍历要素if (pFeature = null) /若不存在要素,则推出循环break;pGeometry = pFeature.Shape; /获取要素的 GeometryITopologicalOp

23、erator pTopoOperator = pGeometry as ITopologicalOperator; /QI 到拓扑操作IGeometry pBoundary = pTopoOperator.Boundary; /获取边界ILineElement pLineEle = new LineElementClass();ISimpleLineSymbol pSLS = new SimpleLineSymbol();IRgbColor pColor = GetColor(0, 255, 0);pSLS.Color = pColor;pSLS.Width = 5;pLineEle.Symb

24、ol = pSLS;IElement pElement = pLineEle as IElement;pElement.Geometry = pBoundary;pGraphicsContainer.AddElement(pElement, 0); /显示边界pActiveView.Refresh(); | Clip:bool isClip = false;private void button3_Click(object sender, EventArgs e)isClip = true;private void button4_Click(object sender, EventArgs

25、e)while (true)pGraphicsContainer = pMap as IGraphicsContainer; /定义容器pFeature = pEnumFeature.Next(); /遍历要素if (pFeature = null) /若不存在要素,则推出循环break;pGeometry = pFeature.Shape; /获取要素的 GeometryITopologicalOperator pTopoOperator = pGeometry as ITopologicalOperator; /QI 到拓扑操作pTopoOperator.Clip(pEnvClip);IE

26、lement pElement = new PolygonElement();pElement.Geometry = pGeometry; /获取得到的缓冲区pGraphicsContainer.AddElement(pElement, 0); /显示缓冲区pActiveView.Refresh(); | ConvexHull:private void button5_Click(object sender, EventArgs e)while (true)pGraphicsContainer = pMap as IGraphicsContainer; /定义容器pFeature = pEnu

27、mFeature.Next(); /遍历要素if (pFeature = null) /若不存在要素,则推出循环break;pGeometry = pFeature.Shape; /获取要素的 GeometryITopologicalOperator pTopoOperator = pGeometry as ITopologicalOperator; /QI 到拓扑操作IGeometry pBufferGeo = pTopoOperator.ConvexHull();IElement pElement = new PolygonElement();pElement.Geometry = pBu

28、fferGeo; /获取得到的缓冲区pGraphicsContainer.AddElement(pElement, 0); /显示缓冲区pActiveView.Refresh(); | Cut:bool isCut = false;private void button6_Click(object sender, EventArgs e)isCut = true;private void button7_Click(object sender, EventArgs e)while (true)pGraphicsContainer = pMap as IGraphicsContainer; /定

29、义容器pFeature = pEnumFeature.Next(); /遍历要素if (pFeature = null) /若不存在要素,则推出循环break;pGeometry = pFeature.Shape; /获取要素的 GeometryITopologicalOperator pTopoOperator = pGeometry as ITopologicalOperator; /QI 到拓扑操作 ryIGeometry pGeoRight = new PolygonClass();IGeometry pGeoLeft = new PolygonClass();pTopoOperato

30、r.Cut(pLineCut, out pGeoLeft, out pGeoRight);IElement pElement = new PolygonElement();IFillShapeElement pFillEle = pElement as IFillShapeElement;ISimpleFillSymbol pSFS = new SimpleFillSymbol();pSFS.Color = GetColor(255, 255, 0);pFillEle.Symbol = pSFS;pElement.Geometry = pGeoLeft; /获取得到的缓冲区pGraphicsC

31、ontainer.AddElement(pElement, 0); /显示缓冲区pSFS = new SimpleFillSymbol();pSFS.Color = GetColor(255, 0, 255);pFillEle.Symbol = pSFS;pElement = new PolygonElement();pElement.Geometry = pGeoRight; /获取得到的缓冲区pGraphicsContainer.AddElement(pElement, 0); /显示缓冲区pActiveView.Refresh(); | Union:private void button

32、8_Click(object sender, EventArgs e)IGeometry pUnionGeo = new PolygonClass();pGraphicsContainer = pMap as IGraphicsContainer; /定义容器while (true)pFeature = pEnumFeature.Next(); /遍历要素if (pFeature = null) /若不存在要素,则推出循环break;pGeometry = pFeature.Shape; /获取要素的 GeometryITopologicalOperator pTopoOperator = p

33、UnionGeo as ITopologicalOperator; /QI 到拓扑操作 rypUnionGeo = pTopoOperator.Union(pGeometry);IElement pElement = new PolygonElement();IFillShapeElement pFillEle = pElement as IFillShapeElement;ISimpleFillSymbol pSFS = new SimpleFillSymbol();pSFS.Color = GetColor(255, 255, 0);pFillEle.Symbol = pSFS;pElem

34、ent.Geometry = pUnionGeo; /获取得到的缓冲区pGraphicsContainer.AddElement(pElement, 0); /显示缓冲区pActiveView.Refresh(); | Intersect:bool isFirstIn = false;private void button10_Click(object sender, EventArgs e)isFirstIn = true;private void button11_Click(object sender, EventArgs e)isFirstIn = false;pFirstPolygo

35、n = new PolygonClass();while (true)pFeature = pEnumFeature.Next();if (pFeature = null)break;pGeometry = pFeature.Shape;ITopologicalOperator pTopoOperator = pFirstPolygon as ITopologicalOperator;pFirstPolygon = pTopoOperator.Union(pGeometry) as IPolygon;private void button12_Click(object sender, Even

36、tArgs e)IGeometry pIntersectGeo = new PolygonClass();IGeometry pSecondPolygon = new PolygonClass();pGraphicsContainer = pMap as IGraphicsContainer;while (true)pFeature = pEnumFeature.Next();if (pFeature = null)break;pGeometry = pFeature.Shape;ITopologicalOperator pTopoOperator = pSecondPolygon as IT

37、opologicalOperator;pSecondPolygon = pTopoOperator.Union(pGeometry) as IPolygon;ITopologicalOperator pTopo = pSecondPolygon as ITopologicalOperator;pIntersectGeo = pTopo.Intersect(pFirstPolygon, esriGeometryDimension.esriGeometry2Dimension) as IPolygon;IElement pElement = new PolygonElementClass();pE

38、lement.Geometry = pIntersectGeo;pGraphicsContainer.AddElement(pElement, 0);IFeatureLayer pFeatureLayer = pMap.get_Layer(0) as IFeatureLayer;pFeatureLayer.Visible = false;pFeatureLayer = pMap.get_Layer(1) as IFeatureLayer;pFeatureLayer.Visible = false;pActiveView.Refresh(); | Difference:(需要前面两部分)priv

39、ate void button13_Click(object sender, EventArgs e)IGeometry pIntersectGeo = new PolygonClass();IGeometry pSecondPolygon = new PolygonClass();pGraphicsContainer = pMap as IGraphicsContainer;while (true)pFeature = pEnumFeature.Next();if (pFeature = null)break;pGeometry = pFeature.Shape;ITopologicalOp

40、erator pTopoOperator = pSecondPolygon as ITopologicalOperator;pSecondPolygon = pTopoOperator.Union(pGeometry) as IPolygon;ITopologicalOperator pTopo = pSecondPolygon as ITopologicalOperator;pIntersectGeo = pTopo.Difference(pFirstPolygon) as IPolygon;IElement pElement = new PolygonElementClass();pEle

41、ment.Geometry = pIntersectGeo;pGraphicsContainer.AddElement(pElement, 0);IFeatureLayer pFeatureLayer = pMap.get_Layer(0) as IFeatureLayer;pFeatureLayer.Visible = false;pFeatureLayer = pMap.get_Layer(1) as IFeatureLayer;pFeatureLayer.Visible = false;pActiveView.Refresh();- 第 A2 个 IRelationalOperator

42、接口:1. Provides access to members that determine if a certain spatial relationship exists between two geometries.MembersDescriptionContains Indicates if this geometry contains the other geometry.前者是否包含后者!Crosses Indicates if the two geometries intersect in a geometry of lesser dimension.Disjoint Indi

43、cates if the two geometries share no points in common. Negate this result to compute the Intersect relation.Equals Indicates if the two geometries are of the same type and define the same set of points in the plane.Overlaps Indicates if the intersection of the two geometries has the same dimension a

44、s one of the input geometries.前者和后者是否有重叠!不包括包含关系!Relation Indicates if the defined relationship exists.Touches Indicates if the boundaries of the geometries intersect.Within Indicates if this geometry is contained (is within) another geometry.前者是否在后者内部!CoClasses that implement IRelationalOperatorCoC

45、lasses and Classes DescriptionEnvelope A rectangle with sides parallel to a coordinate system defining the extent of another geometry; optionally has min and max measure, height and ID attributes.GeometryBag An ordered collection of objects that support the IGeometry interface.MultiPatch A collectio

46、n of surface patches.Multipoint An ordered collection of points; optionally has measure, height and ID attributes.Point A two dimensional point, optionally with measure, height, and ID attributes.Polygon A collection of rings ordered by their containment relationship; optionally has measure, height

47、and ID attributes.Polyline An ordered collection of paths; optionally has measure, height and ID attributes. | 公共代码部分:IMap pMap;IActiveView pActiveView;IEnvelope pEnv;ISelectionEnvironment pSelectionEnv;IEnumFeature pEnumFeature;IFeature pFeature;IGeometry pGeometry;IGeometry pBasicGeo;private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)axMapControl1.MousePointer = esriControlsMousePointer.e

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报