|
@@ -1,4 +1,6 @@
|
|
|
-using System;
|
|
|
+using SAGA.GplotRelationComputerManage;
|
|
|
+using SAGA.Models;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
@@ -16,16 +18,73 @@ namespace SAGA.GplotManage
|
|
|
public override void Upload()
|
|
|
{
|
|
|
//计算数据
|
|
|
-
|
|
|
+ SpaceComputerHandler spaceHandler = new SpaceComputerHandler();
|
|
|
+ spaceHandler.ComputerWidthCache();
|
|
|
//加载数据
|
|
|
- var data = string.Empty;
|
|
|
-
|
|
|
+ var data = SpaceComputerDataUtil.LoadData();
|
|
|
//使用数据
|
|
|
Upload(data);
|
|
|
}
|
|
|
+
|
|
|
public override void Upload(object loadData)
|
|
|
{
|
|
|
+ SpaceData spaces = loadData as SpaceData;
|
|
|
+ if (spaces == null) return;
|
|
|
+ spaces = GetSpaceData(spaces, GetRelatedEnum());
|
|
|
+ foreach (var floorSpaceData in spaces.FloorDatas)
|
|
|
+ {
|
|
|
+ foreach (var space in floorSpaceData.EndPoints)
|
|
|
+ {
|
|
|
+ List<AdjacentSpace> relationSpaces = new List<AdjacentSpace>(space.AdjacentSpaces);
|
|
|
+ relationSpaces.AddRange(space.UpElements);
|
|
|
+ foreach (var adjacentSpace in relationSpaces)
|
|
|
+ {
|
|
|
+ //var rdata = GetReleateData(space.Id, adjacentSpace.Space.Id, ((int)GetRelationType(adjacentSpace.RelatedEnum)) + "");
|
|
|
+ //this.Criterias.criterias.Add(rdata);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ #region 准备数据
|
|
|
+ public SpaceRelatedEnum GetRelatedEnum()
|
|
|
+ {
|
|
|
+ #region 获取关联信息
|
|
|
+ switch (RelationType)
|
|
|
+ {
|
|
|
+ case "a":
|
|
|
+ {
|
|
|
+ return SpaceRelatedEnum.Adjacent;
|
|
|
+ }
|
|
|
+ case "b":
|
|
|
+ {
|
|
|
+ return SpaceRelatedEnum.Crossing;
|
|
|
+ }
|
|
|
+ case "c":
|
|
|
+ {
|
|
|
+ return SpaceRelatedEnum.Radiation;
|
|
|
+ }
|
|
|
+ case "d":
|
|
|
+ {
|
|
|
+ return SpaceRelatedEnum.Ventilation;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return SpaceRelatedEnum.Adjacent;
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ public SpaceData GetSpaceData(SpaceData spaces,SpaceRelatedEnum spaceRelated)
|
|
|
+ {
|
|
|
+ foreach (var fd in spaces.FloorDatas)
|
|
|
+ {
|
|
|
+ foreach (var space in fd.EndPoints)
|
|
|
+ {
|
|
|
+ space.AdjacentSpaces = space.AdjacentSpaces.Where(s=>s.RelatedEnum.HasFlag(spaceRelated)).ToList();
|
|
|
+ space.UpElements = space.UpElements.Where(s => s.RelatedEnum.HasFlag(spaceRelated)).ToList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return spaces;
|
|
|
}
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|