private void ExpandSlopes() { // 整个道路的所有左边边坡 _allLeftSlopeExpands = new SlopeExpands[AllSectionDatas.Length]; for (int i = 0; i < AllSectionDatas.Length; i++) { _allLeftSlopeExpands[i] = new SlopeExpands(AllSectionDatas[i].Station, _allLeftSlopes[i], onLeft: true); } for (int i = 0; i < _allLeftSlopes.Length - 1; i++) { var bs = _allLeftSlopeExpands[i]; var fs = _allLeftSlopeExpands[i + 1]; var backSlopeInfo = bs.SlopeInfo; var backPlatformInfo = bs.PlatformInfo; var frontSlopeInfo = fs.SlopeInfo; var frontPlatformInfo = fs.PlatformInfo; ExpandSlope(bs.Station, bs.XData, fs.Station, fs.XData, ref backSlopeInfo, ref backPlatformInfo, ref frontSlopeInfo, ref frontPlatformInfo); } CutByBlocks(_allLeftSlopeExpands); ExpandEdge(_allLeftSlopeExpands); // 整个道路的所有右边边坡 _allRightSlopeExpands = new SlopeExpands[AllSectionDatas.Length]; for (int i = 0; i < AllSectionDatas.Length; i++) { _allRightSlopeExpands[i] = new SlopeExpands(AllSectionDatas[i].Station, _allRightSlopes[i], onLeft: false); } for (int i = 0; i < _allRightSlopes.Length - 1; i++) { var bs = _allRightSlopeExpands[i]; var fs = _allRightSlopeExpands[i + 1]; var backSlopeInfo = bs.SlopeInfo; var backPlatformInfo = bs.PlatformInfo; var frontSlopeInfo = fs.SlopeInfo; var frontPlatformInfo = fs.PlatformInfo; ExpandSlope(bs.Station, bs.XData, fs.Station, fs.XData, ref backSlopeInfo, ref backPlatformInfo, ref frontSlopeInfo, ref frontPlatformInfo); } CutByBlocks(_allRightSlopeExpands); ExpandEdge(_allRightSlopeExpands); }
/// <summary> 某一个断面边坡中,与指定防护相匹配的子边坡的信息 </summary> /// <param name="sd"></param> /// <param name="se"></param> /// <param name="protectionMethod"></param> /// <param name="matchedSlopes">在此断面中,与指定防护相匹配的子边坡的 Index</param> /// <param name="matchedPlatforms">在此断面中,与指定防护相匹配的子平台的 Index</param> /// <param name="backEdgeStation">在此断面中,指定防护方式所占据的最小的桩号位置</param> /// <param name="frontEdgeStation">在此断面中,指定防护方式所占据的最大的桩号位置</param> /// <param name="area">在此断面中,指定防护方式在断面左右所占据的总面积</param> /// <returns></returns> private ProtectionRange IdentifyProtectionRange(SlopeData sd, SlopeExpands se, string protectionMethod, out List <double> matchedSlopes, out List <double> matchedPlatforms, out double backEdgeStation, out double frontEdgeStation, out double area) { var rg = ProtectionRange.None; matchedSlopes = new List <double>(); matchedPlatforms = new List <double>(); frontEdgeStation = AllStations[0]; backEdgeStation = AllStations[AllStations.Length - 1]; area = 0; // bool allSlopes = sd.Slopes.Count > 0; foreach (var s in sd.Slopes) { if (s.ProtectionMethod != protectionMethod) { allSlopes = false; } else { var ssinfo = se.SlopeInfo[s.Index]; backEdgeStation = Math.Min(backEdgeStation, ssinfo.BackStation); frontEdgeStation = Math.Max(frontEdgeStation, ssinfo.FrontStation); area += ssinfo.BackArea + ssinfo.FrontArea; matchedSlopes.Add(s.Index); } } bool allPlatform = sd.Platforms.Count > 0; foreach (var p in sd.Platforms) { if (p.ProtectionMethod != protectionMethod) { allPlatform = false; } else { var ssinfo = se.PlatformInfo[p.Index]; backEdgeStation = Math.Min(backEdgeStation, ssinfo.BackStation); frontEdgeStation = Math.Max(frontEdgeStation, ssinfo.FrontStation); area += ssinfo.BackArea + ssinfo.FrontArea; matchedPlatforms.Add(p.Index); } } if (allSlopes) { if (allPlatform) { rg = ProtectionRange.AllSection; } else if (matchedPlatforms.Count > 0) { rg = ProtectionRange.AllSlopes | ProtectionRange.PartialPlatforms; } else { rg = ProtectionRange.AllSlopes; } } else if (allPlatform) { if (allSlopes) { rg = ProtectionRange.AllSection; } else if (matchedSlopes.Count > 0) { rg = ProtectionRange.AllPlatforms | ProtectionRange.PartialSlopes; } else { rg = ProtectionRange.AllPlatforms; } } // 说明既没有全边坡,也没有全平台 else if (matchedSlopes.Count > 0 && matchedPlatforms.Count == 0) { rg = ProtectionRange.PartialSlopes; } else if (matchedPlatforms.Count > 0 && matchedSlopes.Count == 0) { rg = ProtectionRange.PartialPlatforms; } else if (matchedPlatforms.Count > 0 && matchedSlopes.Count > 0) { rg = ProtectionRange.PartialPlatforms | ProtectionRange.PartialSlopes; } else { rg = ProtectionRange.None; } return(rg); }