/// <summary> 对文件执行修改关键字修改 跟DataImportEcl对接方法 </summary> public static void RunModify_bak(this EclipseData ecl) { // 查找所有修改关键字 List <ModifyKey> modify = ecl.Key.FindAll <ModifyKey>(); DIMENS d = ecl.Key.Find <DIMENS>(); if (d == null) { return; } // 构造全网格范围 RegionParam tempRegion = new RegionParam(); tempRegion.XFrom = 1; tempRegion.XTo = d.X; tempRegion.YFrom = 1; tempRegion.YTo = d.Y; tempRegion.ZFrom = 1; tempRegion.ZTo = d.Z; foreach (ModifyKey m in modify) { ParentKey p = m.GetParentKey(); if (p != null && p.Name == "EDIT") { continue; } // 是空则用临时范围 if (m.DefautRegion == null) { m.DefautRegion = tempRegion; } else { // 不是空赋值临时范围 tempRegion = m.DefautRegion; } foreach (IModifyModel md in m.ObsoverModel) { // 是空则用临时范围 if (md.Region == null) { md.Region = tempRegion; } else { // 不是空赋值临时范围 tempRegion = md.Region; } if (md is ModifyApplyModel) { TableKey funKey = ecl.Key.Find <TableKey>(l => l.Name == md.KeyName); if (funKey == null) { // 没有则创建关键字 funKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(md.KeyName) as TableKey; m.ParentKey.Add(funKey); } funKey.Build(d.Z, d.X, d.Y); ModifyApplyModel app = md as ModifyApplyModel; app.RunModify(funKey); } else if (md is ModifyCopyModel) { ModifyCopyModel copy = md as ModifyCopyModel; TableKey copyKey = ecl.Key.Find <TableKey>(l => l.Name == copy.Key); if (copyKey == null) { // 没有则创建关键字 copyKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Key, ecl.SimKeyType) as TableKey; m.ParentKey.Add(copyKey); } TableKey funKey = ecl.Key.Find <TableKey>(l => l.Name == copy.Value); if (funKey == null) { // 没有则创建关键字 funKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Value) as TableKey; m.ParentKey.Add(funKey); } funKey.Build(d.Z, d.X, d.Y); copyKey.Build(d.Z, d.X, d.Y); copy.RunModify(copyKey, funKey); } else if (md is ModifyBoxModel) { TableKey funKey = ecl.Key.Find <TableKey>(l => l.Name == md.KeyName); if (funKey == null) { // 没有则创建关键字 funKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(md.KeyName) as TableKey; m.ParentKey.Add(funKey); } funKey.Build(d.Z, d.X, d.Y); ModifyBoxModel app = md as ModifyBoxModel; app.RunModify(funKey); } } } }
/// <summary> 清理父节点只保留INCLUDE </summary> public static void ClearParentKey(this ParentKey parentKey) { parentKey.DeleteAll <BaseKey>(l => !(l is INCLUDE || l is ParentKey)); }