ArcEngine中Geometry对象浅析.docVIP

  • 19
  • 0
  • 约8.94千字
  • 约 9页
  • 2017-06-10 发布于北京
  • 举报
ArcEngine 中Geometry对象浅析 本帖最后由 shisanshao 于 2011-4-13 00:12 编辑 ArcEngine Geometry库定义了基本几何图形的矢量表达形式,顶级的几何图形有Points、Multipoints、Polylines、Polygons、 Multipatches,Geodatabase和绘图系统使用这些几何图形来定义其他各种形状的特征和图形,提供了编辑图形的操作方法和地图符号系统符号化特征数据的途径。   Geometry库中几个核心类和接口构成了Geometry对象的基本框架。   GeometryEnvironment提供了从不同的输入、设置或获取全局变量来创建几何图形的方法,以便控制geometry方法的行为。GeometryEnvironment对象是一个单例对象。 以下为引用的内容: public IPolyline TestGeometryEnvironment() { ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); //Create a projected coordinate system and define its domain, resolution, and x,y tolerance. IspatialReferenceResolution spatialReferenceResolution = spatialReferenceFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983UTM_11N) as ISpatialReferenceResolution; spatialReferenceResolution.ConstructFromHorizon(); ISpatialReferenceTolerance spatialReferenceTolerance = spatialReferenceResolution as ISpatialReferenceTolerance; spatialReferenceTolerance.SetDefaultXYTolerance(); ISpatialReference spatialReference = spatialReferenceResolution as ISpatialReference; C //Create an array of WKSPoint structures starting in the middle of the x,y domain of the //projected coordinate system. double xMin; double xMax; double yMin; double yMax; spatialReference.GetDomain(out xMin, out xMax, out yMin, out yMax); double xFactor = (xMin + xMax) * 0.5; double yFactor = (yMin + yMax) * 0.5; WKSPoint[] wksPoints = new WKSPoint[10]; for (int i = 0; i wksPoints.Length; i++) { wksPoints.X = xFactor + i; wksPoints.Y = yFactor + i; } IPointCollection4 pointCollection = new PolylineClass(); IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass(); geometryBridge.AddWKSPoints(pointCollection, ref wksPoints); IPolyline polyline = pointCollection as IPolyline; polyline.SpatialReference = spatialReference; return polyline; } 复制代码 new GeometryEnvironmentClass仅仅是创建了一个指向已存在的GeometryEnvironmentClass的引用。注意 IGeometryBridge2接口的使用,addWKSPoints方法将WKSPoint二

文档评论(0)

1亿VIP精品文档

相关文档