Exemple #1
0
        /// <summary> 用修正参数获取临时数据 endPosition 碰到此修正参数退出 </summary>
        public void RefreshCacheTable(CARFIN carfin, List <ModifyKey> modifys, IModifyModel endPosition = null)
        {
            if (!IsModifyChanged)
            {
                return;
            }

            this.InitCacheTables();

            IsModifyChanged = false;


            //  构造全网格范围
            RegionParam tempRegion = new RegionParam();

            tempRegion.XFrom = 1;
            tempRegion.XTo   = carfin.X;
            tempRegion.YFrom = 1;
            tempRegion.YTo   = carfin.Y;
            tempRegion.ZFrom = 1;
            tempRegion.ZTo   = carfin.Z;

            foreach (ModifyKey m in modifys)
            {
                //  是空则用临时范围
                if (m.DefautRegion == null)
                {
                    m.DefautRegion = tempRegion;
                }
                else
                {
                    //  不是空赋值临时范围
                    tempRegion = m.DefautRegion;
                }

                List <IModifyModel> models = new List <IModifyModel>();
                //  加载本修改模型中关键字
                models.AddRange(m.ObsoverModel);

                //  加载子修改模型中关键字 如BOX
                List <ModifyKey> ms = m.FindAll <ModifyKey>();

                ms.Remove(m);

                ms.ForEach(l => models.AddRange(l.ObsoverModel));

                foreach (IModifyModel md in models)
                {
                    //  读取到结束标记处退出
                    if (endPosition != null && md == endPosition)
                    {
                        return;
                    }

                    //  是空则用临时范围
                    if (md.Region == null)
                    {
                        md.Region = tempRegion;
                    }
                    else
                    {
                        //  不是空赋值临时范围
                        tempRegion = md.Region;
                    }

                    if (md.KeyName != this.Name)
                    {
                        continue;
                    }

                    if (md is ModifyApplyModel)
                    {
                        ModifyApplyModel app = md as ModifyApplyModel;

                        app.RunModify(this.CacheTable);
                    }
                    else if (md is ModifyCopyModel)
                    {
                        ModifyCopyModel copy = md as ModifyCopyModel;

                        //  查找关键字模型
                        ModifyBoxModel boxModel = carfin.ObsoverModel.Find(l => l is ModifyBoxModel && l.KeyName == copy.Value) as ModifyBoxModel;

                        TableKey copyKey = null;

                        if (boxModel != null)
                        {
                            copyKey = boxModel.Key;
                        }

                        if (copyKey == null)
                        {
                            //  没有则创建关键字
                            copyKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Value, this.BaseFile.SimKeyType) as TableKey;

                            m.ParentKey.Add(copyKey);
                        }

                        copyKey.Build(this.Z, this.X, this.Y);

                        copyKey.RefreshCacheTable(carfin, modifys, copy);

                        copyKey.IsModifyChanged = true;

                        copy.RunModify(this.CacheTable, copyKey.CacheTable);

                        copyKey.IsModifyChanged = true;
                    }
                    else if (md is ModifyBoxModel)
                    {
                        ModifyBoxModel app = md as ModifyBoxModel;

                        app.RunModify(this.CacheTable);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary> 用修正参数获取临时数据 endPosition 碰到此修正参数退出 </summary>
        public void RefreshCacheTable(EclipseData _eclData, List <ModifyKey> modifys, IModifyModel endPosition = null)
        {
            if (!IsModifyChanged)
            {
                return;
            }

            this.InitCacheTables();

            //  查找所有修改关键字
            //List<ModifyKey> modifys = _eclData.Key.FindAll<ModifyKey>();

            ////  获取当前关键字关联的修改关键字
            //List<ModifyKey> thisModify = modifys.FindAll(l => l.ObsoverModel.Exists(k => k.KeyName == this.Name));

            DIMENS d = _eclData.Key.Find <DIMENS>();

            if (d == null)
            {
                return;
            }

            IsModifyChanged = false;

            //  构造全网格范围
            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 modifys)
            {
                //  是空则用临时范围
                if (m.DefautRegion == null)
                {
                    m.DefautRegion = tempRegion;
                }
                else
                {
                    //  不是空赋值临时范围
                    tempRegion = m.DefautRegion;
                }



                foreach (IModifyModel md in m.ObsoverModel)
                {
                    //  读取到结束标记处退出
                    if (endPosition != null && md == endPosition)
                    {
                        return;
                    }

                    //  是空则用临时范围
                    if (md.Region == null)
                    {
                        md.Region = tempRegion;
                    }
                    else
                    {
                        //  不是空赋值临时范围
                        tempRegion = md.Region;
                    }

                    if (md.KeyName != this.Name)
                    {
                        continue;
                    }

                    if (md is ModifyApplyModel)
                    {
                        ModifyApplyModel app = md as ModifyApplyModel;

                        app.RunModify(this.CacheTable);
                    }
                    else if (md is ModifyCopyModel)
                    {
                        ModifyCopyModel copy = md as ModifyCopyModel;

                        TableKey copyKey = _eclData.Key.Find <TableKey>(l => l.Name == copy.Value);

                        ////  取到当前位置
                        //List<ModifyKey> modifysCopyPosition = modifys.TakeWhile(l => l == m).ToList();

                        ////  取当前model位置
                        //List<IModifyModel> modelCopyPosition = m.ObsoverModel.TakeWhile(l => l == md).ToList();

                        //modifysCopyPosition.rem

                        if (copyKey == null)
                        {
                            //  没有则创建关键字
                            copyKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Value, this.BaseFile.SimKeyType) as TableKey;

                            m.ParentKey.Add(copyKey);
                        }

                        copyKey.Build(this.Z, this.X, this.Y);

                        copyKey.RefreshCacheTable(_eclData, modifys, copy);

                        copyKey.IsModifyChanged = true;

                        copy.RunModify(this.CacheTable, copyKey.CacheTable);
                    }
                    else if (md is ModifyBoxModel)
                    {
                        ModifyBoxModel app = md as ModifyBoxModel;

                        app.RunModify(this.CacheTable);
                    }
                }
            }
        }