zoukankan      html  css  js  c++  java
  • arcgis 线转面

    /// <summary>
    /// 由线转为面
    /// </summary>
    /// <param name="pPolyline"></param>
    /// <returns></returns>
    private IPolygon PolyLineToPolygon(IPolyline pPolyline)
    {
        object obj = Type.Missing;
    
        IClone pClonepPolyline = pPolyline as IClone;
    
        try
        {
            // 闭合线
            if (pPolyline.IsClosed)
            {
                ISegmentCollection pPolylineSegment = pClonepPolyline.Clone()
                    as ISegmentCollection;
                ISegmentCollection pPolygonSegment = new PolygonClass();
    
                for (int i = 0; i < pPolylineSegment.SegmentCount; i++)
                {
                    pPolygonSegment.AddSegment(
                        pPolylineSegment.get_Segment(i), ref obj, ref obj);
                }
    
                return pPolygonSegment as IPolygon;
            }
            // 非闭合线
            else
            {
                IPointCollection pPolylinePoint = pClonepPolyline.Clone()
                    as IPointCollection;
                IPointCollection pPolygonPoint = new PolygonClass();
    
                for (int i = 0; i < pPolylinePoint.PointCount; i++)
                {
                    pPolygonPoint.AddPoint(
                        pPolylinePoint.get_Point(i), ref obj, ref obj);
                }
    
                IPolygon pPolygon = pPolygonPoint as IPolygon;
                //pPolygon.Close();
    
                return pPolygonPoint as IPolygon;
            }
        }
        catch (Exception exc)
        {
            Console.WriteLine(exc.Message);
            return null;
        }
    }
  • 相关阅读:
    C#的HttpWebRequest编程,支持带ViewState的网页POST请求
    maven添加jar包依赖
    linux操作命令
    xshell常用命令
    一些重要 Docker 命令的简单介绍
    Linux 如何显示一个文件的某几行
    Docker进阶使用1
    【Mac】Docker安装及基础使用
    Docker 中的一些概念
    Docker初步了解
  • 原文地址:https://www.cnblogs.com/jiguixin/p/2575057.html
Copyright © 2011-2022 走看看