Пример #1
0
        /// <summary> 搜索边坡线 </summary>
        /// <param name="leftFill">左边边坡为填方还是挖方</param>
        /// <param name="rightFill">右边边坡为填方还是挖方</param>
        private bool FindSlopes(Extents3d extSection, out Polyline leftSlope, out bool leftFill, out Polyline rightSlope, out bool rightFill)
        {
            leftSlope  = null;
            rightSlope = null;
            leftFill   = false;
            rightFill  = false;

            var res = DocMdf.acEditor.SelectCrossingWindow(
                pt1: extSection.MinPoint,
                pt2: extSection.MaxPoint,
                filter: SlopeLine.Filter);

            if (res.Status == PromptStatus.OK)
            {
                var lines = res.Value.GetObjectIds().Select(id => id.GetObject(OpenMode.ForRead)).OfType <Polyline>().ToList();
                var lefts =
                    lines.Where(l => SlopeLine.IsSlopeLineLayer(l.Layer, left: true)).ToArray();
                if (lefts.Length > 0)
                {
                    // 从多个边坡线中搜索某个端点距离中轴线中心最近的那一条
                    var slp = GetClosestPolyLine(lefts, _MiddlePt);

                    // 当界面图形缩得太小时,有可以会把其他断面中的挡墙误加进来,
                    // 此时通过挡墙多段线中的某点是否位于此断面的Extends范围之内来确定它是否真是本断面的挡墙
                    if (slp != null && extSection.Contains(slp.StartPoint))
                    {
                        leftSlope = slp as Polyline;
                        leftFill  = slp.Layer == Options_LayerNames.LayerName_Slope_Left_Fill;
                    }
                }
                var rights =
                    lines.Where(l => SlopeLine.IsSlopeLineLayer(l.Layer, left: false)).ToArray();
                if (rights.Length > 0)
                {
                    // 从多个边坡线中搜索某个端点距离中轴线中心最近的那一条
                    var slp = GetClosestPolyLine(rights, _MiddlePt);
                    if (slp != null && extSection.Contains(slp.StartPoint))
                    {
                        rightSlope = slp as Polyline;
                        rightFill  = slp.Layer == Options_LayerNames.LayerName_Slope_Right_Fill;
                    }
                }
            }
            // 对于一个横断面而言,可以没有边坡线,即不进行挖填
            return(true);
        }
Пример #2
0
        /// <summary> 搜索挡土墙对象 </summary>
        private bool FindRetainingWall(Extents3d extSection, out Polyline leftRetainingWall, out Polyline rightRetainingWall)
        {
            leftRetainingWall  = null;
            rightRetainingWall = null;
            var hasRetainingWall = false;
            // 请求在图形区域选择对象
            var res = DocMdf.acEditor.SelectCrossingWindow(pt1: extSection.MinPoint, pt2: extSection.MaxPoint,
                                                           filter: RetainingWall.Filter);

            if (res.Status == PromptStatus.OK)
            {
                var lines =
                    res.Value.GetObjectIds().Select(id => id.GetObject(OpenMode.ForRead)).OfType <Polyline>().Where(r => r.Closed).ToList();

                // 从多个挡墙线中搜索某个端点距离中轴线中心最近的那一条
                var lefts = lines.Where(r => r.Layer == Options_LayerNames.LayerName_RetainingWall_Left);
                var slp   = GetClosestPolyLine(lefts, _MiddlePt) as Polyline;

                // 当界面图形缩得太小时,有可以会把其他断面中的挡墙误加进来,
                // 此时通过挡墙多段线中的某点是否位于此断面的Extends范围之内来确定它是否真是本断面的挡墙
                if (slp != null && extSection.Contains(slp.StartPoint))
                {
                    leftRetainingWall = slp;
                    hasRetainingWall  = true;
                }
                //
                var rights = lines.Where(r => r.Layer == Options_LayerNames.LayerName_RetainingWall_Right);
                slp = GetClosestPolyLine(rights, _MiddlePt) as Polyline;
                if (slp != null && extSection.Contains(slp.StartPoint))
                {
                    rightRetainingWall = slp;
                    hasRetainingWall   = true;
                }
            }
            return(hasRetainingWall);
        }