Ejemplo n.º 1
0
        IPoint IntersectPointExtendedTo(IPolyline pPolyline, IPolygon pCirclePoly)
        {
            ICurve               pCurve;
            ILine                pLine;
            IPolyline            pPLine;
            ITopologicalOperator pTopoOpt;
            IGeometryCollection  pGeoCol;

            pCurve = pPolyline;
            pLine  = new Line();
            double gridWidth = _mapTemplate.Width * _scale / 100.0;

            pCurve.QueryTangent(esriSegmentExtension.esriExtendTangentAtTo, 1, true, gridWidth * 1.1, pLine);
            pPLine = new Polyline() as IPolyline;
            IPointCollection pPnts  = pPLine as IPointCollection;
            IClone           pClone = pLine.FromPoint as IClone;

            pPnts.AddPoint(pClone.Clone() as IPoint);
            pClone = pLine.ToPoint as IClone;
            pPnts.AddPoint(pClone.Clone() as IPoint);
            pTopoOpt = pPLine as ITopologicalOperator;
            pGeoCol  = new GeometryBag() as IGeometryCollection;
            pGeoCol  =
                pTopoOpt.Intersect(pCirclePoly, esriGeometryDimension.esriGeometry0Dimension) as IGeometryCollection;
            if (pGeoCol.GeometryCount == 0)
            {
                return(null);
            }
            return(pGeoCol.Geometry[0] as IPoint);
        }
Ejemplo n.º 2
0
        private static void QueryTangent([NotNull] IPolyline polyline,
                                         double distanceAlong,
                                         [NotNull] ILine templateLine)
        {
            const bool   asRatio = true;
            const double length  = 1.0;

            polyline.QueryTangent(esriSegmentExtension.esriNoExtension, distanceAlong,
                                  asRatio, length, templateLine);
        }
Ejemplo n.º 3
0
        private double GetAngle(IPolyline pPolyline)
        {
            //IPolycurve pPolycurve;  
            ILine pTangentLine = new ESRI.ArcGIS.Geometry.Line();
            pPolyline.QueryTangent(esriSegmentExtension.esriNoExtension, 0.5, true, pPolyline.Length, pTangentLine);
            Double radian = pTangentLine.Angle;
            //Double angle = radian * 180 / Math.PI;  
            //// 如果要设置正角度执行以下方法  
            //while (angle < 0)  
            //{  
            //    angle = angle + 360;  
            //}  
            //// 返回角度  
            //return angle;  

            // 返回弧度  
            return radian;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取线的角度(弧度)
        /// </summary>
        /// <params name="pPolyline">线</params>
        /// <returns></returns>
        private static double GetAngle(IPolyline pPolyline)
        {
            //IPolycurve pPolycurve;
            ILine pTangentLine = new Line();

            pPolyline.QueryTangent(esriSegmentExtension.esriNoExtension, 0.5, true, pPolyline.Length, pTangentLine);
            Double radian = pTangentLine.Angle;

            //Double angle = radian * 180 / Math.PI;
            //// 如果要设置正角度执行以下方法
            //while (angle < 0)
            //{
            //    angle = angle + 360;
            //}
            //// 返回角度
            //return angle;

            // 返回弧度
            return(radian);
        }