123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using SAGA.GplotRelationComputerManage;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SAGA.GplotManage
- {
- public class RelationDataManager
- {
- private void InitRelationData(List<RelationUploader> uploaders)
- {
- bool containSpace = false;
- List<string> systems = new List<string>();
- foreach (var uploader in uploaders)
- {
- if(uploader is SystemRelationUploader)
- {
- systems.Add(uploader.RelationType);
- continue;
- }
- if(!containSpace&&uploader is SpaceRelationUploader)
- {
- containSpace = true;
- continue;
- }
- }
- //计算数据,以后可能合并
- #region 计算空间数据
- SpaceComputerHandler spaceHandler = new SpaceComputerHandler();
- spaceHandler.ComputerWidthCache();
- SpaceData=SpaceComputerDataUtil.LoadData();
- #endregion
- #region 计算管道数据
- SystemComputerHandler systemHandler = new SystemComputerHandler();
- systemHandler.ComputerWidthCache(systems);
- #endregion
- }
- /// <summary>
- /// 获取空间计算数据
- /// </summary>
- private object SpaceData { get; set; }
- public void CommitRelations(List<RelationUploader> uploaders)
- {
- InitRelationData(uploaders);
- foreach (RelationUploader uploader in uploaders)
- {
- if(uploader is SpaceRelationUploader)
- {
- uploader.Upload(SpaceData);
- }
- else
- {
- uploader.Upload();
- }
- }
- }
- }
- }
|