private void SetProtectionMethods(List <SlopeLine> slopeLines, string protMethod, int[] slopeLevels) { // 提取规则 var fp = new ForceProtection(protMethod, slopeLevels); 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); // 先修改内存中的防护 foreach (var slp in slopeLines) { slp.ForceProtect(fp); } // 再刷新到 AutoCAD 文档与界面中 var protLayers = ProtectionTags.MapProtectionLayers(_docMdf, slopeLines); foreach (var slp in slopeLines) { // 将数据刷新到界面与边坡线中 slp.Pline.UpgradeOpen(); slp.PrintProtectionMethod(es.CurrentBTR, protLayers); slp.FlushXData(); slp.Pline.DowngradeOpen(); } _docMdf.acEditor.UpdateScreen(); }
public void ForceProtect(ForceProtection criterion) { var data = XData; if (criterion.SlopeLevels == null) { foreach (var s in data.Slopes) { s.ProtectionMethod = criterion.ProtMethod; } } else { foreach (var s in data.Slopes) { if (criterion.SlopeLevels.Contains(s.GetMainLevel())) { s.ProtectionMethod = criterion.ProtMethod; } } } }