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); }
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); }
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; }
/// <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); }