ElementSpNeighborhood.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using Autodesk.Revit.UI;
  3. using DrawData;
  4. using SAGA.GplotDrawData;
  5. using SAGA.GplotRelationComputerManage;
  6. using SAGA.Models;
  7. using SAGA.RevitUtils.Extends;
  8. using SAGA.RevitUtils.Windows;
  9. namespace SAGA.GplotManage.UploadRelated
  10. {
  11. public abstract class SpaceRelated : Gplot
  12. {
  13. protected SpaceRelated()
  14. {
  15. IsSpace = true;
  16. }
  17. }
  18. public class ElementSpNeighborhood : SpaceRelated
  19. {
  20. public override GraphTypeEnum GraphType => GraphTypeEnum.ElementSpNeighborhood;
  21. public override Type DataType => typeof(SpaceData);
  22. public override void Computer()
  23. {
  24. ReadSpaceCommand cmd = new ReadSpaceCommand();
  25. cmd.Computer();
  26. // DrawDataServer.SaveAsFile(new SpaceData());
  27. }
  28. [CheckAndKeepGplotLaster]
  29. public override void Show(GplotShowType showType)
  30. {
  31. var win = new WinDrawSpace_Web(showType);//
  32. win.ComputerAction += () => ExecuteCmd.ExecuteCommand(() =>
  33. {
  34. Computer();
  35. return Result.Succeeded;
  36. });
  37. win.Show();
  38. }
  39. [CheckAndKeepGplotLaster]
  40. protected override void DealUploadData()
  41. {
  42. var spaces = DrawDataServer.GetSpaceData(SpaceRelatedEnum.Adjacent);
  43. foreach (var spacesFloorData in spaces.FloorDatas)
  44. {
  45. foreach (var space in spacesFloorData.EndPoints)
  46. {
  47. space.AdjacentSpaces.AddRange(space.UpElements);
  48. foreach (var adjacentSpace in space.AdjacentSpaces)
  49. {
  50. var rdata = GetReleateData(space.Id, adjacentSpace.Space.Id, ((int)GetRelationType(adjacentSpace.RelatedEnum)) + "");
  51. this.Criterias.criterias.Add(rdata);
  52. }
  53. }
  54. }
  55. }
  56. SpaceRelationType GetRelationType(SpaceRelatedEnum sre)
  57. {
  58. switch (sre)
  59. {
  60. case SpaceRelatedEnum.Adjacent:
  61. return SpaceRelationType.Throught;//虚拟墙
  62. case SpaceRelatedEnum.Radiation | SpaceRelatedEnum.Ventilation:
  63. return SpaceRelationType.Window;//窗
  64. case SpaceRelatedEnum.Crossing | SpaceRelatedEnum.Ventilation:
  65. return SpaceRelationType.Door;
  66. default: return SpaceRelationType.None;
  67. }
  68. }
  69. enum SpaceRelationType
  70. {
  71. None = 1,
  72. Door = 2,
  73. Window = 3,
  74. DoorAndWindow = 4,
  75. Throught = 5//连同
  76. }
  77. }
  78. }