IPointCollection.AddPoint Method的用法

补充指出官方帮助的一个问题。

该方法用于向环、线。面等几何中添加节点。官方帮助里是这样描述的:Adds a vertex to a Path, Ring, Polyline, or Polygon; or adds a reference to the input point to a Multipoint, TriangleFan, or TriangleStrip.

官方给的方法说明如下:


[C#]

public void AddPoint (
    IPoint inPoint,
    ref object before,
    ref object after
);
[C#]

Optional Values

before   To indicate that this parameter is undefined, first define a variable object Missing = Type.Missing; then pass this in as ref Missing.
after   To indicate that this parameter is undefined, first define a variable object Missing = Type.Missing; then pass this in as ref Missing.

 
官网示例与网上的分享案例无一例外的只使用了第一个参数,而后两个可选参数被省略或者使用Type.Missing,这样新加的节点添加到几何的最后一个节点之后。能否把第2、3参利用起来,使新加的节点到指定的位置?博主研究了这个可能,得出下面结论。
1、参数类型应为int,其实就是一个index;
2、before意指在给定index指向的节点前加节点,after反之;
3、ref关键字是不需要的。
//before 在这个索引之前加
pointCollection.AddPoint(point,index,Type.Missing);
 
原文地址:https://www.cnblogs.com/yzhyingcool/p/11102493.html