private List <DBText> FilterDeletedTexts(List <DBText> selectedTexts) { // 子边坡等级 int[] slopeLevels = null; if (checkBox_AllSlopeLevels.Checked) { slopeLevels = null; } else { try { var levelStr = textBox_SlopeLevels.Text.Split(','); slopeLevels = levelStr.Select(r => Convert.ToInt32(r)).ToArray(); } catch (Exception) { MessageBox.Show($"不同坡级之间请通过“,”进行分隔"); return(null); } } // 边坡还是平台 var slopePlatform = IsSlopeOrPlatform(); var filterd2 = new List <DBText>(); foreach (var txt in selectedTexts) { var buff = txt.GetXDataForApplication(ProtTextData.RegAppName_SlopeText); if (buff != null) { // 过滤 var protData = ProtTextData.FromResultBuffer(buff); if (protData != null) { // 桩号区间 // if (!anyStation && !(protData.Station >= startStation && protData.Station <= endStation)) { continue; } // 子边坡等级 if (slopeLevels != null && !slopeLevels.Contains(Slope.GetMainLevel(protData.Index))) { continue; } // 满足所有过滤条件 filterd2.Add(txt); } } } return(filterd2); }
private List <DBText> FilterProtTexts(List <DBText> selectedTexts) { // 边坡还是平台 bool?slopePlatform = IsSlopeOrPlatform(); // 左右侧 bool?left = null; if (radioButton_left.Checked) { left = true; } else if (radioButton_right.Checked) { left = false; } var filtered = new List <DBText>(); // 过滤 foreach (var txt in selectedTexts) { var buff = txt.GetXDataForApplication(ProtTextData.RegAppName_SlopeText); if (buff != null) { var protData = ProtTextData.FromResultBuffer(buff); if (protData != null) { // 比较过滤条件 if (slopePlatform != null && slopePlatform.Value != protData.SlopePlatform) { continue; } if (left != null && left.Value != protData.Left) { continue; } // 满足所有过滤条件 filtered.Add(txt); } } } return(filtered); }