当前位置: 首页>>代码示例>>C#>>正文


C# PolylineClass.QueryPointAndDistance方法代码示例

本文整理汇总了C#中PolylineClass.QueryPointAndDistance方法的典型用法代码示例。如果您正苦于以下问题:C# PolylineClass.QueryPointAndDistance方法的具体用法?C# PolylineClass.QueryPointAndDistance怎么用?C# PolylineClass.QueryPointAndDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PolylineClass的用法示例。


在下文中一共展示了PolylineClass.QueryPointAndDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getCoordinates

        public Dictionary<string, List<IPoint>> getCoordinates(IPolygon polygon, IPolyline plin1, IPolyline plin2, IPolyline plin3, double hdwid1, double hdwid2)
        {
            Dictionary<string, List<IPoint>> res = new Dictionary<string, List<IPoint>>();
            IPointCollection pnts = polygon as IPointCollection;
            int index = 1;
            for (int i = 0; i < pnts.PointCount - 1; i++)
            {
                IPolyline plinnew = new PolylineClass();
                plinnew.SpatialReference = Global.spatialref;
                plinnew.FromPoint = new PointClass() { X = pnts.get_Point(i).X, Y = pnts.get_Point(i).Y };
                plinnew.ToPoint = new PointClass() { X = pnts.get_Point(i + 1).X, Y = pnts.get_Point(i + 1).Y };

                ITopologicalOperator top1 = plin1 as ITopologicalOperator;
                IGeometry geom1 = top1.Buffer(hdwid1);
                IRelationalOperator relationOp1 = geom1 as IRelationalOperator;
                bool bres1 = relationOp1.Contains(plinnew);
                if (bres1)
                    continue;

                ITopologicalOperator top2 = plin2 as ITopologicalOperator;
                IGeometry geom2 = top2.Buffer(hdwid2);
                IRelationalOperator relationOp2 = geom2 as IRelationalOperator;
                bool bres2 = relationOp2.Contains(plinnew);
                if (bres2)
                    continue;
                List<IPoint> curpnts = new List<IPoint>();
                curpnts.Add(pnts.get_Point(i));
                curpnts.Add(pnts.get_Point(i + 1));
                res.Add(index.ToString(), curpnts);

                index++;
            }
            //处理顺序
            IPoint pntCenter = new PointClass() { X = (plin3.Envelope.XMax + plin3.Envelope.XMin) / 2, Y = (plin3.Envelope.YMax + plin3.Envelope.YMin) / 2 };
            IPolyline plin0 = new PolylineClass();
            plin0.SpatialReference = Global.spatialref;
            plin0.FromPoint = res["1"][0];
            plin0.ToPoint = res["1"][1];
            double dist0 = 0.0, dist1 = 0.0;
            bool isrightside = false;
            IPoint pntquery = null;
            plin0.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pntCenter, false, pntquery, ref dist0, ref dist1, ref isrightside);

            IPolyline plin00 = new PolylineClass();
            plin00.SpatialReference = Global.spatialref;
            plin00.FromPoint = res["2"][0];
            plin00.ToPoint = res["2"][1];
            double dist00 = 0.0, dist10 = 0.0;
            bool isrightside0 = false;
            IPoint pntquery0 = null;
            plin00.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pntCenter, false, pntquery0, ref dist00, ref dist10, ref isrightside0);

            if (dist10 > dist1)
            {
                List<IPoint> tmppnts = res["2"];
                res["2"] = res["1"];
                res["1"] = tmppnts;
            }
            return res;
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:60,代码来源:CommonClass.cs


注:本文中的PolylineClass.QueryPointAndDistance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。