|
@@ -21,6 +21,7 @@ namespace SAGA.GplotManage
|
|
|
public static List<ReleateData> BuildRelations(LoadRelationData relationData)
|
|
|
{
|
|
|
#region 说明
|
|
|
+
|
|
|
/*
|
|
|
* 数据关联项:
|
|
|
* 机房设备---特殊阀门
|
|
@@ -28,11 +29,15 @@ namespace SAGA.GplotManage
|
|
|
* 立管--立管
|
|
|
* 立管---平面设备;由此=》机房设备---平面设备
|
|
|
*/
|
|
|
+
|
|
|
#endregion
|
|
|
+
|
|
|
List<ReleateData> result = new List<ReleateData>();
|
|
|
List<BinaryRelationItem> roomRelations = new List<BinaryRelationItem>();
|
|
|
List<BinaryRelationItem> floorRelations = new List<BinaryRelationItem>();
|
|
|
+
|
|
|
#region 机房关系数据
|
|
|
+
|
|
|
var machineRoomData = relationData.MachineRoomRelationRecords;
|
|
|
foreach (var machineRelation in machineRoomData)
|
|
|
{
|
|
@@ -48,8 +53,11 @@ namespace SAGA.GplotManage
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
+
|
|
|
#region 平面关系数据
|
|
|
+
|
|
|
foreach (var floorRelation in relationData.FloorRelationRecords)
|
|
|
{
|
|
|
foreach (var item in floorRelation.RelationItems)
|
|
@@ -60,26 +68,34 @@ namespace SAGA.GplotManage
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- roomRelations.Add(item);
|
|
|
+ floorRelations.Add(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
var verticalSets = relationData.VerticalRelationRecords;
|
|
|
|
|
|
#region 机房和平面关联
|
|
|
+
|
|
|
/*
|
|
|
* 前提不是全设备
|
|
|
+ * 产生关系方式 源--端--立管--源--端,源--端--立管--端,源--端
|
|
|
*/
|
|
|
foreach (var roomRelation in roomRelations)
|
|
|
{
|
|
|
EquipmentNode equipmentNode, linkNode;
|
|
|
- if(!roomRelation.From.IsRealEquipment&&!roomRelation.To.IsRealEquipment)
|
|
|
+ var systemName = roomRelation.RelationType;
|
|
|
+
|
|
|
+ #region 源
|
|
|
+
|
|
|
+ if (!roomRelation.From.IsRealEquipment && !roomRelation.To.IsRealEquipment)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
- if(roomRelation.From.IsRealEquipment)
|
|
|
+
|
|
|
+ if (roomRelation.From.IsRealEquipment)
|
|
|
{
|
|
|
equipmentNode = roomRelation.From;
|
|
|
linkNode = roomRelation.To;
|
|
@@ -89,38 +105,113 @@ namespace SAGA.GplotManage
|
|
|
equipmentNode = roomRelation.To;
|
|
|
linkNode = roomRelation.From;
|
|
|
}
|
|
|
- List<string> useLinks = new List<string>();
|
|
|
- var useSet = verticalSets.FirstOrDefault(s => s.RelationItems.Any(item => item == linkNode.BimId));
|
|
|
- if(useSet==null)
|
|
|
- {
|
|
|
- useLinks.Add(linkNode.BimId);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- useLinks.AddRange(useSet.RelationItems);
|
|
|
- }
|
|
|
- foreach (var useLink in useLinks)
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 端
|
|
|
+
|
|
|
+ foreach (var endRelation in floorRelations)
|
|
|
{
|
|
|
- var floorRelation= floorRelations.FirstOrDefault(c => c.From.BimId == useLink || c.To.BimId == useLink);
|
|
|
- BinaryRelationItem newRelationItem = new BinaryRelationItem();
|
|
|
- newRelationItem.From = equipmentNode;
|
|
|
- newRelationItem.To = floorRelation.From.BimId != useLink ? floorRelation.From : floorRelation.To;
|
|
|
- newRelationItem.RelationType = floorRelation.RelationType;
|
|
|
-
|
|
|
- //加入关系数据
|
|
|
- result.Add(CreateRelationData(newRelationItem));
|
|
|
+ var mathFlag = endRelation.TryGetNode(n => n.BimId == linkNode.BimId, out EquipmentNode refNode);
|
|
|
+ if (mathFlag > -1)
|
|
|
+ {
|
|
|
+ var anotherNode = endRelation.GetAnotherNode(n => n.BimId == refNode.BimId);
|
|
|
+ if (anotherNode.IsRealEquipment)
|
|
|
+ {
|
|
|
+ //第三种情况
|
|
|
+ BinaryRelationItem newRelationItem = new BinaryRelationItem();
|
|
|
+ newRelationItem.From = equipmentNode;
|
|
|
+ newRelationItem.To = anotherNode;
|
|
|
+ newRelationItem.RelationType = systemName;
|
|
|
+ result.Add(CreateRelationData(newRelationItem));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var verticalSet = verticalSets.FirstOrDefault(s =>
|
|
|
+ s.RelationItems.Any(item => item == anotherNode.BimId));
|
|
|
+ if (verticalSet == null)
|
|
|
+ continue;
|
|
|
+ var verticalIds = new List<string>(verticalSet.RelationItems);
|
|
|
+ foreach (var verticalId in verticalIds)
|
|
|
+ {
|
|
|
+ bool findV = false;
|
|
|
+
|
|
|
+ #region 立管找端
|
|
|
+
|
|
|
+ foreach (var vEndRelation in floorRelations)
|
|
|
+ {
|
|
|
+ var vAnother = vEndRelation.GetAnotherNode(n => n.BimId == verticalId);
|
|
|
+ if (vAnother == null || !vAnother.IsRealEquipment)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //第二种情况
|
|
|
+ BinaryRelationItem newRelationItem = new BinaryRelationItem();
|
|
|
+ newRelationItem.From = equipmentNode;
|
|
|
+ newRelationItem.To = vAnother;
|
|
|
+ newRelationItem.RelationType = systemName;
|
|
|
+ result.Add(CreateRelationData(newRelationItem));
|
|
|
+ findV = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (findV)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 立管找源
|
|
|
+
|
|
|
+ foreach (var vSourceRelation in roomRelations)
|
|
|
+ {
|
|
|
+ var vAnother = vSourceRelation.GetAnotherNode(n => n.BimId == verticalId);
|
|
|
+ if (vAnother == null)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 源找端
|
|
|
+
|
|
|
+ foreach (var floorRelation in floorRelations)
|
|
|
+ {
|
|
|
+ var sa = floorRelation.GetAnotherNode(n => n.BimId == vAnother.BimId);
|
|
|
+ if (sa == null || !sa.IsRealEquipment)
|
|
|
+ {
|
|
|
+ //第一种情况
|
|
|
+ BinaryRelationItem newRelationItem = new BinaryRelationItem();
|
|
|
+ newRelationItem.From = equipmentNode;
|
|
|
+ newRelationItem.To = sa;
|
|
|
+ newRelationItem.RelationType = systemName;
|
|
|
+ result.Add(CreateRelationData(newRelationItem));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
}
|
|
|
- #endregion
|
|
|
+
|
|
|
return result;
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
- /// 创建上传关系数据
|
|
|
- /// </summary>
|
|
|
- /// <param name="relationType"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public static List<ReleateData> BuildRelations(string relationType)
|
|
|
+ /// 创建上传关系数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="relationType"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static List<ReleateData> BuildRelations(string relationType)
|
|
|
{
|
|
|
LoadRelationData data = new LoadRelationData(relationType);
|
|
|
data.LoadData();
|
|
@@ -139,6 +230,7 @@ namespace SAGA.GplotManage
|
|
|
relation.from_id = relationItem.From.MbiId;
|
|
|
relation.to_id = relationItem.To.MbiId;
|
|
|
relation.rel_type = relationItem.RelationType;
|
|
|
+ relation.infos = new Info() {info1 = relationItem.From.BimId, info2 = relationItem.To.BimId};
|
|
|
return relation;
|
|
|
}
|
|
|
#endregion
|