RelationDataManager.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using SAGA.GplotRelationComputerManage;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace SAGA.GplotManage
  8. {
  9. public class RelationDataManager
  10. {
  11. private void InitRelationData(List<RelationUploader> uploaders)
  12. {
  13. bool containSpace = false;
  14. List<string> systems = new List<string>();
  15. foreach (var uploader in uploaders)
  16. {
  17. if(uploader is SystemRelationUploader)
  18. {
  19. systems.Add(uploader.RelationType);
  20. continue;
  21. }
  22. if(!containSpace&&uploader is SpaceRelationUploader)
  23. {
  24. containSpace = true;
  25. continue;
  26. }
  27. }
  28. //计算数据,以后可能合并
  29. #region 计算空间数据
  30. #endregion
  31. #region 计算管道数据
  32. SystemComputerHandler systemHandler = new SystemComputerHandler();
  33. systemHandler.ComputerWidthCache(systems);
  34. #endregion
  35. }
  36. /// <summary>
  37. /// 获取空间计算数据
  38. /// </summary>
  39. private object SpaceData { get; set; }
  40. public void CommitRelations(List<RelationUploader> uploaders)
  41. {
  42. InitRelationData(uploaders);
  43. foreach (RelationUploader uploader in uploaders)
  44. {
  45. if(uploader is SpaceRelationUploader)
  46. {
  47. uploader.Upload(SpaceData);
  48. }
  49. else
  50. {
  51. uploader.Upload();
  52. }
  53. }
  54. }
  55. }
  56. }