object o=Type.Missing;
//通过ISegmentCollection接口为Path对象添加Segment对象
pPath.AddSegment(pSegment,ref o,ref o);
//创建一个Polyline对象
IGeometryCollection pPolyline = new PolylineClass();
//通过IGeometryCollection为Polyline对象添加Path对象
pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);
2.4.4.2Polylgon几何对象
2Polylgon对象是由一个或多个Ring对象的有序集合,它可以是由单个Ring 对象构成,也可以使用多个Ring组成如下图所示。其中Ring可以分为Outer Ring(外环)和Inner Ring(内环)之分。外环和内环都是有方向的,它们的区别是外环的方向是顺时针的,内环的方向是逆时针。Polygon通常用来代表有面积的多边形矢量对象,如行政区,建筑物等。
图7
以下代码片段演示如何构建一个Polygon:
//创建一个Ring对象,通过ISegmentCollection接口向其中添加Segment对象
ISegmentCollection pSegCollection = new RingClass();
object o = Type.Missing;
pSegCollection.AddSegment(pSegment1, ref o, ref o);
pSegCollection.AddSegment(pSegment2, ref o, ref o);
//QI到IRing接口封闭Ring对象,使其有效
IRing pRing = pSegCollection as IRing;
pRing.Close();
//使用Ring对象构建Polygon对象
IGeometryCollection pGeometryColl = new PolygonClass();
pGeometryColl.AddGeometry(pRing, ref o, ref o);
2.4.5Envelope几何对象
Envelope是所有几何对象的外接矩形,用于表示几何对象的最小边框,所有的几何对象都有一个Envelope对象,IEnvelope是Envelope对象的主要接口,通过它可以获取几何对象的XMax,XMin,YMax,YMin,Height,Width属性。通过IEnvelope的Expand方法还可以按比
例缩放Envelope对象的范围,如下图所示:
2.4.6Curve对象几何对象
除去Point,MultiPoint和Envelope外,其他所有的几何体都可以看做是Curve(曲线)。Line,Polyline,Polygon,CircularArc,BezierCurve,EllipticArc和CircularArc都是曲线
的一种,它们都实现了ICurve接口。
ICurve接口的Length属性用于返回一个Curve对象的长度。 ICurve接口的FromPoint和ToPoint属性可以获得Curve对象的起止点。
ICurve接口的Reverseorientation方法可以改变一个Curve对象的