IGeometry 中取指定的点

时间:2022-02-27 23:06:09

private static IGeometryCollection MakeMultiPoint(IGeometry geometry,int pointcount)



         IGeometryCollection g=new MultipointClass();

         if(geometry.GeometryType==esriGeometryType.esriGeometryPolyline)



        IConstructGeometryCollection cc=new GeometryBagClass();

        cc.ConstructDivideEqual(geometry as IPolyline ,pointCount,esriConstructDivideEnum.esriDivideIntoPolylines);

        var enumGeometry=cc as IEnumGeometry;

         var polyline=enumGeometry as IPolyline;

          object o=Type.Missing;

          if(polyline!=null)

          {     

                   g.AddGeometry(poyline.FromPoint,ref o,ref o);

        while(polyline!=null)

        {

                  g.AddGeometry(poyline.ToPoint,ref o,ref o);

                polyline=enumGeometry.Next() as IPolyline;

        }

          }



     return g;