/// <summary> 高填路堤 </summary> /// <param name="slp"></param> /// <param name="centerHight"> 道路中心填方高度</param> /// <param name="slopeHight"> 边坡高度</param> /// <returns></returns> public static bool IsHighFill(SlopeLine slp, out double centerHight, out double slopeHight) { centerHight = 0; slopeHight = 0; if (slp == null) { return(false); } var data = slp.XData; if (!data.FillCut) { return(false); } // slopeHight = data.TopElevation - data.BottomElevation; if (slopeHight < _criterion.填方最低高度) { return(false); } // var secData = slp.Section.XData; centerHight = secData.CenterElevation_Road - secData.CenterElevation_Ground; return(true); }
private Polyline GetSlopeLine(Editor ed, out bool cont) { var op = new PromptEntityOptions("\n选择一条边坡线以进行信息读写"); op.SetRejectMessage($"\n选择的多段线必须包含{SlopeData.AppName}的外部扩展数据"); op.AddAllowedClass(typeof(Polyline), exactMatch: true); var res = ed.GetEntity(op); cont = true; if (res.Status == PromptStatus.OK) { var pl = res.ObjectId.GetObject(OpenMode.ForRead) as Polyline; if (pl != null) { if (SlopeLine.IsSlopeLineLayer(pl.Layer, left: null)) { cont = true; return(pl); } } } else if (res.Status == PromptStatus.Cancel) { cont = false; } return(null); }
/// <summary> 深挖路堤 </summary> /// <param name="slp"></param> /// <param name="centerHight"> 道路中心挖方高度</param> /// <param name="slopeHight"> 边坡高度</param> /// <returns></returns> public static bool IsDeepCut(SlopeLine slp, out double centerHight, out double slopeHight) { centerHight = 0; slopeHight = 0; if (slp == null) { return(false); } var data = slp.XData; if (data.FillCut) { return(false); } // slopeHight = data.TopElevation - data.BottomElevation; if (data.SoilOrRock == SubgradeType.土质 && slopeHight < _criterion.土质挖方最低高度) { return(false); } else if (data.SoilOrRock == SubgradeType.岩质 && slopeHight < _criterion.岩质挖方最低高度) { return(false); } // var secData = slp.Section.XData; centerHight = secData.CenterElevation_Ground - secData.CenterElevation_Road; return(true); }
private void SetCurrentSlopeUI(SlopeLine spl) { var xdata = spl.XData; var s = SlopeData.Combine(xdata.Slopes, xdata.Platforms, true); SetDGVDataSource(spl, s); }
/// <summary> 检查边坡是否与指定的标高相交,并返回交点在 AutoCAD 中的几何坐标 </summary> /// <param name="slp"></param> /// <param name="ele"></param> /// <param name="intersPt">返回交点</param> /// <returns></returns> private static bool ValidateElevation(SlopeLine slp, CutMethod method, double ele, out Point2d intersPt, out Slope slopeSeg) { intersPt = Point2d.Origin; slopeSeg = null; var slpData = slp.XData; var sec = slp.Section; var cutY = GetCutY(slpData, sec, method, ele); // sec.GetYFromElev(ele); // 指定的标高在此断面中所对应的 AutoCAD 中的坐标Y值 const double tolerance = 0.01; foreach (var seg in slpData.Slopes) { bool within = (seg.TopPoint.Y - cutY >= tolerance) && (cutY - seg.BottomPoint.Y >= tolerance); if (within) // 说明此子边坡与指定的标高相交 { var l = new LineSegment2d(new Point2d(seg.BottomPoint.X, seg.BottomPoint.Y), new Point2d(seg.TopPoint.X, seg.TopPoint.Y)); var intersPts = l.IntersectWith(new Line2d(new Point2d(0, cutY), new Vector2d(1, 0))); if (intersPts != null) { slopeSeg = seg; intersPt = intersPts[0]; return(true); } } } return(false); }
private static List <SlopeLine> ConstructSlopeLinesFromPlines(DocumentModifier docMdf, List <Polyline> plines, bool sort) { var slpLines = new List <SlopeLine>(); string errMsg; foreach (var sl in plines) { var slpLine = SlopeLine.Create(docMdf, sl, out errMsg); if (slpLine != null) { // 将存储的数据导入边坡对象 slpLine.ImportSlopeData(slpLine.XData); // if (!slpLine.XData.FullyCalculated) { slpLine.CalculateXData(); } slpLines.Add(slpLine); } else { docMdf.WriteNow(errMsg); } } if (sort) { slpLines.Sort(CompareStation); } return(slpLines); }
/// <summary> 按标高将边坡对象进行分割,以实现同一级边坡中分别设置不同的防护形式 </summary> private void CutSlopes(DocumentModifier docMdf, SlopeLine[] selectedSlopes, CutMethod method, double elev, double waterLineLength) { // ProtectionUtils.SubgradeEnvironmentConfiguration(docMdf); // //var layer_Slope = Utils.GetOrCreateLayer(docMdf, ProtectionConstants.LayerName_ProtectionMethod_Slope); var layer_WaterLine = eZcad.SubgradeQuantity.Utility.SQUtils.GetOrCreateLayer_WaterLine(docMdf); //var layer_Platform = Utils.GetOrCreateLayer(docMdf, ProtectionConstants.LayerName_ProtectionMethod_Platform); var es = EditStateIdentifier.GetCurrentEditState(docMdf); es.CurrentBTR.UpgradeOpen(); // Point2d intersPt; Slope intersSlopeSeg; int cutCount = 0; docMdf.WriteLineIntoDebuger("被分割的边坡对象:"); var protLayers = ProtectionTags.MapProtectionLayers(_docMdf, selectedSlopes); foreach (var slp in selectedSlopes) { var inters = ValidateElevation(slp, method, elev, out intersPt, out intersSlopeSeg); if (inters) { // 将子边坡按指定的交点进行剪切 var newSegs = CutSlopeSegment(slp.XData, intersSlopeSeg, new Point3d(intersPt.X, intersPt.Y, 0)); slp.XData.Slopes = newSegs; // 将被剪切掉的子边坡所绑定的文字删除 SlopeLine.EraseText(intersSlopeSeg, docMdf.acDataBase); // 绘制水位线 var line = new Line(new Point3d(intersPt.X - waterLineLength / 2, intersPt.Y, 0), new Point3d(intersPt.X + waterLineLength / 2, intersPt.Y, 0)); line.LayerId = layer_WaterLine.Id; es.CurrentBTR.AppendEntity(line); docMdf.acTransaction.AddNewlyCreatedDBObject(line, true); slp.XData.Waterlines.Add(line.Handle); // 将刷新后的数据保存到 AutoCAD 文档与界面中 slp.Pline.UpgradeOpen(); SlopeConstructor.SetSlopeUI(slp); slp.PrintProtectionMethod(es.CurrentBTR, protLayers); slp.FlushXData(); slp.Pline.DowngradeOpen(); // cutCount += 1; docMdf.WriteLineIntoDebuger(slp); } } es.CurrentBTR.DowngradeOpen(); docMdf.WriteLineIntoDebuger($"总计:{cutCount} 个"); }
/// <summary> 将所有的边坡对象显示在列表中 </summary> /// <param name="slopeLines"></param> private void SetSlopeLinesData(List <SlopeLine> slopeLines) { listBox_slopes.DataSource = slopeLines; listBox_slopes.DisplayMember = "DataInfo"; // 在赋值到另一个控件中作为数据源之前,必须要先复制一份副本 var slopes = new SlopeLine[slopeLines.Count]; slopeLines.CopyTo(slopes); cbb_currentSlope.DataSource = slopes; cbb_currentSlope.DisplayMember = "DataInfo"; }
/// <summary> 陡坡路堤 </summary> /// <param name="sec"> 道路中心填方高度</param> /// <param name="treatedSide"> 哪一侧需要进行陡坡路堤处理 </param> /// <param name="treatedWidth"> 陡坡路堤处理宽度 </param> /// <param name="stairArea"> 挖台阶的面积 </param> /// <param name="reinforcementSide"> 哪一侧需要设置加筋结构,比如铺设三层土工格栅</param> /// <returns></returns> private bool IsSteepSlope(SubgradeSection sec, out SectionSide treatedSide, out double treatedWidth, out double stairArea, out SectionSide reinforcementSide) { bool isSteep = false; treatedWidth = 0; stairArea = 0; double sideTreatedWidth = 0; double sideStairArea = 0; treatedSide = SectionSide.无; reinforcementSide = SectionSide.无; bool leftSetReinforcement; bool rightSetReinforcement; var secData = sec.XData; // SlopeLine sideSlope = null; Polyline sideGround = null; if (secData.LeftRetainingWallType != RetainingWallType.路肩墙) { sideSlope = sec.GetSlopeLine(true); // 断面左侧边坡 sideGround = secData.LeftGroundSurfaceHandle.GetDBObject <Polyline>(_docMdf.acDataBase); if (IsSteepFill(secData, true, sideSlope, sideGround, out sideTreatedWidth, out sideStairArea, out leftSetReinforcement)) { isSteep = true; treatedSide = treatedSide | SectionSide.左; reinforcementSide = leftSetReinforcement ? reinforcementSide | SectionSide.左 : reinforcementSide; treatedWidth += sideTreatedWidth; stairArea += sideStairArea; } } if (secData.RightRetainingWallType != RetainingWallType.路肩墙) { sideSlope = sec.GetSlopeLine(false); // 断面右侧边坡 sideGround = secData.RightGroundSurfaceHandle.GetDBObject <Polyline>(_docMdf.acDataBase); if (IsSteepFill(secData, false, sideSlope, sideGround, out sideTreatedWidth, out sideStairArea, out rightSetReinforcement)) { isSteep = true; treatedSide = treatedSide | SectionSide.右; reinforcementSide = rightSetReinforcement ? reinforcementSide | SectionSide.右 : reinforcementSide; treatedWidth += sideTreatedWidth; stairArea += sideStairArea; } } return(isSteep); }
private static double GetCutY(SlopeLine slp, CutMethod method, double value) { double cutY = 0; switch (method) { case CutMethod.FromInner: break; default: // 按绝对标高 cutY = slp.Section.GetYFromElev(value); break; } return(cutY); }
private void SetDGVDataSource(SlopeLine spl, IList <ISlopeSeg> slopes) { dgv.Tag = spl; var Slopes = new BindingList <ISlopeSeg>(slopes) { AllowNew = false }; // if (!_uIConstructed) { ConstructeZDataGridView(dgv); _uIConstructed = true; } dgv.DataSource = Slopes; }
/// <summary> 将一侧边坡中的所有子边坡进行缝合 </summary> /// <param name="slpDt"></param> /// <param name="dir"></param> /// <returns>如果成功缝合,则返回 true,如果此侧边坡中原来就没有被分割,则返回 false</returns> private bool MergeSlope(SlopeData slpDt, MergeProtectionDirection dir) { bool merged = false; var newSlopes = new List <Slope>(); var lastSubSlopeSegs = new List <Slope>(); if (slpDt.Slopes.Count > 0) { int lastMainLevel = slpDt.Slopes[0].GetMainLevel(); foreach (var s in slpDt.Slopes) { if (s.GetMainLevel() != lastMainLevel) { // 先处理上一级子边坡中的所有更细子边坡 if (lastSubSlopeSegs.Count > 0) { var mergedSlope = MergeSubSlopes(lastSubSlopeSegs, slpDt.FillCut, dir); merged = true; newSlopes.Add(mergedSlope); lastSubSlopeSegs = new List <Slope>(); } // lastMainLevel = s.GetMainLevel(); } if (s.GetSubLevel() != 0) { SlopeLine.EraseText(s, _docMdf.acDataBase); lastSubSlopeSegs.Add(s); } else { // 将本级子边坡添加进来 newSlopes.Add(s); } } // 处理最后一级的多个细子边坡 if (lastSubSlopeSegs.Count > 0) { var mergedSlope = MergeSubSlopes(lastSubSlopeSegs, slpDt.FillCut, dir); merged = true; newSlopes.Add(mergedSlope); } } slpDt.Slopes = newSlopes; return(merged); }
/// <summary> 对边坡线的显示样式进行设置 </summary> /// <param name="slp"></param> public static void SetSlopeUI(SlopeLine slp) { return; if (slp.XData.FillCut) { // 填方边坡 // slp.CenterLine.DrawWaterLevel(WaterLevel, waterLevelLayer.Id); // 绘制水位线 slp.Pline.ColorIndex = 2; // 黄色 slp.Pline.LineWeight = LineWeight.LineWeight070; } else { // 挖方 slp.Pline.ColorIndex = 3; // 绿色 slp.Pline.LineWeight = LineWeight.LineWeight070; } }
private static int SlopeStationComparison(SlopeLine sl1, SlopeLine sl2) { if (sl1.XData.OnLeft ^ sl2.XData.OnLeft) { // 道路左侧的放在前面 if (sl1.XData.OnLeft) { return(-1); } else { return(1); } } else { // 都在道路的同一侧则比较桩号 return(sl1.Section.XData.Station.CompareTo(sl2.Section.XData.Station)); } }
// Determines if the inputPosition is above a given sloped line, going through the player position // compare = determine if to compare against the positive or negative sloped line bool AboveSlopeLine(SlopeLine compare, Vector2 inputPosition) { Vector2 playerPosition = gameObject.transform.position; Vector2 mousePosition = localCamera.ScreenToWorldPoint(inputPosition); float slopeOfLineToCompare = compare == SlopeLine.Positive ? positiveSlope : negativeSlope; // "Draw" (virtually) a line which goes through the player position, and has the same slope as the slopeOfLineToCompare // Calculate where this line intercepts the y-axis float yIntercept = playerPosition.y - (slopeOfLineToCompare * playerPosition.x); // Calculate a second line, which runs through the mouse-click position and is parallel to the player line float inputIntercept = mousePosition.y - (slopeOfLineToCompare * mousePosition.x); // Compare where the mouse line and player lines cross the y-axis to determine if mouse line is above player line return(inputIntercept > yIntercept); // Alternate method: // For a given point (x, y), if 𝑦 > m𝑥 + 𝑏, then the point is above the line // m = slope of the line, and b = the point where the line crosses the y-axis // return mousePosition.y > slopeOfLineToCompare * mousePosition.x + yIntercept; }
/// <summary> 从边坡线所绑定的防护方式的文字对象来设置防护 </summary> public ExternalCmdResult FlushProtection(DocumentModifier docMdf, SelectionSet impliedSelection) { _docMdf = docMdf; SQUtils.SubgradeEnvironmentConfiguration(docMdf); // var allSections = ProtectionUtils.GetAllSections(docMdf); var slopeLines = SQUtils.SelecteExistingSlopeLines(docMdf, left: null, sort: true); // 从文字中提取边坡防护方式的数据 foreach (var slp in slopeLines) { var xdata = slp.XData; var slpSegs = SlopeData.Combine(xdata.Slopes, xdata.Platforms, sort: false); foreach (var s in slpSegs) { SlopeLine.ExtractProtectionFromText(s, _docMdf.acDataBase); } // 将数据保存下来 slp.Pline.UpgradeOpen(); slp.FlushXData(); slp.Pline.DowngradeOpen(); } return(ExternalCmdResult.Commit); }
/// <summary> 构造函数 </summary> /// <param name="station"></param> /// <param name="slopeLine">此参数的值可能为 null ,表示此桩号断面上没有对应边坡 </param> public SlopeExpands(double station, SlopeLine slopeLine, bool onLeft) { // Station = station; SlopeInfo = new Dictionary <double, SlopeSegInfo>(); PlatformInfo = new Dictionary <double, SlopeSegInfo>(); if (slopeLine != null) { XData = slopeLine.XData; } else { XData = new SlopeData(station, onLeft); } // ConstructSlopeSegInfo(); foreach (var sd in XData.Slopes) { SlopeInfo.Add(sd.Index, new SlopeSegInfo(0, 0, 0, 0)); } foreach (var sd in XData.Platforms) { PlatformInfo.Add(sd.Index, new SlopeSegInfo(0, 0, 0, 0)); } }
/// <summary> /// 判断某一侧边坡的填方边坡类型 /// </summary> /// <param name="slp">某一侧边坡,其值可能为null,表示此侧没有边坡线 </param> /// <param name="ground">边坡所对应的自然地面线</param> /// <param name="treatedWidth"></param> /// <param name="stairArea">某一侧边坡所挖台阶面积</param> /// <returns></returns> private FillSlopeType GetFillSlopeType(SectionInfo sec, bool left, SlopeLine slp, Polyline ground, out double treatedWidth, out double stairArea) { treatedWidth = 0; stairArea = 0.0; double edgeXleft; double edgeXright; var cGround = ground.Get2dLinearCurve(); var succ = sec.GetFillSlopeXRange(left, slp, cGround, _docMdf.acDataBase, out edgeXleft, out edgeXright); if (!succ) { return(FillSlopeType.Other); } // 必须是填方边坡 if ((left && (sec.LeftSlopeFill == null || !sec.LeftSlopeFill.Value)) || (!left && (sec.RightSlopeFill == null || !sec.RightSlopeFill.Value))) { return(FillSlopeType.Other); } // 有路肩墙 if ((left && sec.LeftRetainingWallType == RetainingWallType.路肩墙) || (!left && sec.RightRetainingWallType == RetainingWallType.路肩墙)) { return(FillSlopeType.Other); } // var segCounts = (int)Math.Ceiling((edgeXright - edgeXleft) / _criterion.最小迭代宽度); // 其值最小为1 var xInterval = (edgeXright - edgeXleft) / segCounts; var xYs = new List <double[]>(); for (int i = 0; i <= segCounts; i++) { var x = edgeXleft + i * xInterval; double yGround; var inters = new CurveCurveIntersector2d(cGround, new Line2d(new Point2d(x, 0), new Vector2d(0, 1))); // 没有交点的情况一般不会出现,因为自然地面线的范围很广 yGround = inters.NumberOfIntersectionPoints == 0 ? 0 : inters.GetIntersectionPoint(0).Y; // xYs.Add(new double[] { x, yGround }); } // 开始求斜率(集合中至少有两个元素)。每个元素为三分量向量,分别为 X 坐标、X对应的自然地面的Y坐标,X对应的边坡的Y坐标 double maxRatio = 0; bool hasStairExcav = false; var lastX = xYs[0]; for (int i = 1; i < xYs.Count; i++) { var thisX = xYs[i]; var segRatio = Math.Abs((thisX[1] - lastX[1]) / (thisX[0] - lastX[0])); if ((segRatio > 1 / _criterion.填方坡比下限) && (segRatio > 1 / _criterion.填方坡比下限)) { hasStairExcav = true; } maxRatio = Math.Max(maxRatio, segRatio); // lastX = thisX; } if (!hasStairExcav) { return(FillSlopeType.Other); } else { // 判断是否为陡坡路堤,如果是,则不计入挖台阶工程量表中(因为在陡坡路堤工程量表中已经计入) if (maxRatio >= (1 / _criterion.陡坡坡比)) { treatedWidth = 0; return(FillSlopeType.SteepSlope); } else { // treatedWidth = edgeXright - edgeXleft; stairArea = Exporter_SteepSlope.CalculateStairArea(xYs, edgeXleft, edgeXright); return(FillSlopeType.StairExcav); } } }
private List <SlopeLine> FilterSlopeLines() { // 左右侧 bool?leftOnly = null; if (radioButton_right.Checked) { leftOnly = false; } else if (radioButton_left.Checked) { leftOnly = true; } // 设置区间 var slps = new List <SlopeLine>(); if (checkBox_ChooseRangeOnUI.Checked) { // 通过界面选择边坡 slps = SQUtils.SelecteExistingSlopeLines(_docMdf, left: leftOnly, sort: true); } else { // 通过指定的桩号区间选择边坡 var startStation = textBoxNum_RangeStart.ValueNumber; var endStation = textBoxNum_RangeEnd.ValueNumber; if (startStation >= endStation) { MessageBox.Show(@"起始桩号必须小于结尾桩号"); return(null); } var secs = SQUtils.GetAllSections(_docMdf, sort: true); SectionInfo data; SlopeLine slp = null; foreach (var sec in secs) { data = sec.XData; if (data.Station >= startStation && data.Station <= endStation) { if (leftOnly.HasValue) { slp = sec.GetSlopeLine(leftOnly.Value); if (slp != null) { slps.Add(slp); } } else { slp = sec.GetSlopeLine(left: true); if (slp != null) { slps.Add(slp); } slp = sec.GetSlopeLine(left: false); if (slp != null) { slps.Add(slp); } } } } } // 检查填挖方 if (radioButton_fill.Checked) { slps = slps.Where(r => r.XData.FillCut).ToList(); } else if (radioButton_cut.Checked) { slps = slps.Where(r => !r.XData.FillCut).ToList(); } // return(slps); }
/// <summary> 根据边坡多段线进行道路边坡的筛选、信息提取、防护方式的设置等操作 </summary> public void ConfigerSlopes(IList <Polyline> slopeLines, bool justModifyCalculated) { if (slopeLines == null || slopeLines.Count == 0) { return; } // var app = SymbolTableUtils.GetOrCreateAppName(_docMdf.acDataBase, _docMdf.acTransaction, SlopeData.AppName); var selectedSlpLines = new List <SlopeLine>(); string errMsg; foreach (var sl in slopeLines) { var slpLine = SlopeLine.Create(_docMdf, sl, out errMsg); if (slpLine != null) { // 将存储的数据导入边坡对象 slpLine.ImportSlopeData(slpLine.XData); // if (!slpLine.XData.FullyCalculated || !justModifyCalculated) { slpLine.CalculateXData(); } selectedSlpLines.Add(slpLine); } else { _docMdf.WriteNow(errMsg); } } if (selectedSlpLines.Count == 0) { return; } var slopesWithSlopesegs = new List <SlopeLine>(); var slopesWithoutSlopesegs = new List <SlopeLine>(); foreach (var slp in selectedSlpLines) { if (slp.XData.Slopes.Count + slp.XData.Platforms.Count > 0) { slopesWithSlopesegs.Add(slp); } else { slopesWithoutSlopesegs.Add(slp); } } // var es = EditStateIdentifier.GetCurrentEditState(_docMdf); es.CurrentBTR.UpgradeOpen(); //var layer_Slope = Utils.GetOrCreateLayer(_docMdf, ProtectionConstants.LayerName_ProtectionMethod_Slope); //var layer_Platform = Utils.GetOrCreateLayer(_docMdf, ProtectionConstants.LayerName_ProtectionMethod_Platform); // _docMdf.acDataBase.Clayer = layer_Slope.ObjectId; // // 1. 对有子边坡的边坡对象进行操作:显示界面,以进行填挖方与防护设置 var listerForm = new SlopeSegLister(slopesWithSlopesegs); listerForm.ShowDialog(null); if (listerForm.ValueChanged) { var protLayers = ProtectionTags.MapProtectionLayers(_docMdf, slopesWithSlopesegs); foreach (var slp in slopesWithSlopesegs) { slp.Pline.UpgradeOpen(); SetSlopeUI(slp); slp.PrintProtectionMethod(es.CurrentBTR, protLayers); // slp.FlushXData(); slp.Pline.DowngradeOpen(); if (slp.XDataToBeCleared) { slp.ClearXData(); } } } // 2. 对没有子边坡的边坡对象进行操作 foreach (var slp in slopesWithoutSlopesegs) { slp.Pline.UpgradeOpen(); SetSlopeUI(slp); slp.FlushXData(); slp.Pline.DowngradeOpen(); } es.CurrentBTR.DowngradeOpen(); }
/// <summary> /// 判断某一侧边坡是否为陡坡路堤 /// </summary> /// <param name="slp">某一侧边坡,其值可能为null,表示此侧没有边坡线 </param> /// <param name="ground">边坡所对应的自然地面线</param> /// <param name="treatedWidth"></param> /// <param name="setReinforcement">是否要设置加筋结构,比如铺设三层土工格栅</param> /// <returns></returns> private bool IsSteepFill(SectionInfo sec, bool left, SlopeLine slp, Polyline ground, out double treatedWidth, out double stairArea, out bool setReinforcement) { treatedWidth = 0; stairArea = 0; setReinforcement = false; var slopeFill = (slp == null) || slp.XData.FillCut; // ---------------------------------------------------------------------------------------- // 确定进行搜索的左右边界:路基边缘(或边坡脚) 到 道路中线 var cGround = ground.Get2dLinearCurve(); double edgeXleft; double edgeXright; var succ = sec.GetFillSlopeXRange(left, slp, cGround, _docMdf.acDataBase, out edgeXleft, out edgeXright); if (!succ) { return(false); } // ---------------------------------------------------------------------------------------- // ---------此时 [edgeXleft ~ edgeXright] 区间内应该都是填方区域 -------------------------- // var segCounts = (int)Math.Ceiling((edgeXright - edgeXleft) / _criterion.最小迭代宽度); // 其值最小为1 var xInterval = (edgeXright - edgeXleft) / segCounts; var xYs = new List <double[]>(); var cSlope = slp?.Pline.Get2dLinearCurve(); for (int i = 0; i <= segCounts; i++) { var x = edgeXleft + i * xInterval; double yGround; var inters = new CurveCurveIntersector2d(cGround, new Line2d(new Point2d(x, 0), new Vector2d(0, 1))); // 没有交点的情况一般不会出现,因为自然地面线的范围很广 yGround = inters.NumberOfIntersectionPoints == 0 ? 0 : inters.GetIntersectionPoint(0).Y; double ySlope; if (cSlope == null) // 表示没有边坡线 { ySlope = 0; } else { inters = new CurveCurveIntersector2d(cSlope, new Line2d(new Point2d(x, 0), new Vector2d(0, 1))); // 没有交点的情况必然会出现,即x对应路基位置,而不是对应边坡位置,比如当路基下的自然地面线是向路基中心倾斜时。 ySlope = inters.NumberOfIntersectionPoints == 0 ? sec.CenterY : inters.GetIntersectionPoint(0).Y; } // xYs.Add(new double[3] { x, yGround, ySlope }); } // 每隔x间距时,自然地面的Y值 var xyGround = xYs.Select(r => new double[] { r[0], r[1] }).ToList(); // 开始求斜率(集合中至少有两个元素)。每个元素为三分量向量,分别为 X 坐标、X对应的自然地面的Y坐标,X对应的边坡的Y坐标 double maxRatio = 0; double maxYFill; var lastX = xYs[0]; maxYFill = lastX[2] - lastX[1]; for (int i = 1; i < xYs.Count; i++) { var thisX = xYs[i]; maxRatio = Math.Max(maxRatio, Math.Abs((thisX[1] - lastX[1]) / (thisX[0] - lastX[0]))); maxYFill = Math.Max(maxYFill, Math.Abs(thisX[2] - thisX[1])); // lastX = thisX; } // 判断是否为陡坡路堤 if (maxRatio >= (1 / _criterion.陡坡坡比)) { // 道路中心与边坡均为填方 treatedWidth = edgeXright - edgeXleft; stairArea = CalculateStairArea(xyGround, edgeXleft, edgeXright); if (slopeFill && treatedWidth > 0 && maxYFill >= _criterion.加筋体对应填方段最小高度) { setReinforcement = true; } return(true); } // return(false); }
/// <summary> 桩号小的在前面 </summary> public static int CompareStation(SlopeLine slopeline1, SlopeLine slopeline2) { return(slopeline1.Station.CompareTo(slopeline2.Station)); }