Ejemplo n.º 1
0
        //public void UpdateBlockName(int index, string name)
        //{
        //    Blocks[index].Name = name;
        //    if (Blocks[index].ImplementationInfo.IsSettled)
        //    {
        //        Blocks[index].ImplementationInfo.Unsettle();
        //    }
        //}
        public override void Commit(EarthworkBlockingForm storage)
        {
            BlockIdIndexMapper = new Dictionary <int, int>();
            int index = 0;

            foreach (var block in Blocks)
            {
                BlockIdIndexMapper.Add(block.Id, index);
                index++;
                if (block.IsChanged)
                {
                    block.Commit(storage);
                }
            }
            FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), storage.m_Doc);
            var jsonObj = JsonConvert.SerializeObject(this);

            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking_Size, 1), jsonObj.Length.ToString());
            recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking, 1), jsonObj);
            foreach (var block in Deletes)
            {
                //TODO ???Block的删除或需优化 Block总是新增节点,会造成数据量一致增加
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock_Size, block.Id), "");
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock, block.Id), "");
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings_Size, block.Id), "");
                recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings, block.Id), "");
            }
            Adds.Clear();
            Deletes.Clear();
        }
Ejemplo n.º 2
0
 public override void Rollback()
 {
     Blocks = new List <EarthworkBlock>();
     Blocks.AddRange(Memo.Blocks);
     BlockIdIndexMapper = Memo.BlockIdIndexMapper;
     foreach (var Block in Blocks)
     {
         Block.Rollback();
     }
     Adds.Clear();
     Deletes.Clear();
 }
Ejemplo n.º 3
0
 public override void Rollback()
 {
     Name = Memo.Name;
     Adds.Clear();
     Deletes.Clear();
 }