|
@@ -76,7 +76,7 @@ namespace SAGA.GplotManage
|
|
|
#endregion
|
|
|
|
|
|
var verticalSets = relationData.VerticalRelationRecords;
|
|
|
- var cacheFloorDatas = new List<BinaryRelationItem>(floorRelations);
|
|
|
+
|
|
|
List < StringFlag <VerticalRelationRecord>> verticalNodes = new List<StringFlag<VerticalRelationRecord>>();
|
|
|
#region 初始化立管节点
|
|
|
foreach (var verticalRelationRecord in verticalSets)
|
|
@@ -87,10 +87,13 @@ namespace SAGA.GplotManage
|
|
|
}
|
|
|
#endregion
|
|
|
#region 构建端部临时边集
|
|
|
+ var cacheFloorDatas = new List<BinaryRelationItem>(floorRelations);
|
|
|
var endGraph = CreateGraph(verticalNodes, cacheFloorDatas);
|
|
|
#endregion
|
|
|
- var roomItems = machineRoomData.SelectMany(c => c.RelationItems).ToList();
|
|
|
- var sourceGraph = CreateGraph(verticalNodes, roomItems);
|
|
|
+ #region 构建源部临时边集
|
|
|
+ var cacheSourceDatas = new List<BinaryRelationItem>(roomRelations);
|
|
|
+ var sourceGraph = CreateGraph(verticalNodes, cacheSourceDatas);
|
|
|
+ #endregion
|
|
|
//连接类型,以机房端类型为基准;
|
|
|
#region 描述
|
|
|
/*
|
|
@@ -100,10 +103,55 @@ namespace SAGA.GplotManage
|
|
|
* 根据立管数据,在机房里找到机房设备数据,在平面找到平面数据
|
|
|
*/
|
|
|
#endregion
|
|
|
+
|
|
|
#region 机房和平面关联
|
|
|
- foreach (var verticalNode in verticalNodes)
|
|
|
+ //合并分界点
|
|
|
+ #region 合并分界点
|
|
|
+ /*
|
|
|
+ * 1、取出所有立管,和特殊阀门
|
|
|
+ * 2、将产生关联的立管和特殊阀门合并
|
|
|
+ * 3、按分组去遍历源或端信息
|
|
|
+ */
|
|
|
+ List<List<string>> groupIds = new List<List<string>>();
|
|
|
+ //处理端部
|
|
|
+ foreach (var binaryRelationItem in cacheSourceDatas)
|
|
|
{
|
|
|
- var startNode = sourceGraph.FindVertex(verticalNode.Flag);
|
|
|
+ #region 描述
|
|
|
+ /*
|
|
|
+ * 如果为空,就将其房屋groopIds
|
|
|
+ */
|
|
|
+ #endregion
|
|
|
+ var nodes= new List<EquipmentNode>() {binaryRelationItem.From, binaryRelationItem.To};
|
|
|
+ foreach (var equipmentNode in nodes)
|
|
|
+ {
|
|
|
+ if (!equipmentNode.IsRealEquipment)
|
|
|
+ {
|
|
|
+ var useId = equipmentNode.BimId;
|
|
|
+ var verticalId = verticalNodes.FirstOrDefault(c => c.Instance.RelationItems.Contains(useId));
|
|
|
+ if (verticalId != null)
|
|
|
+ {
|
|
|
+ useId = verticalId.Flag;
|
|
|
+ }
|
|
|
+ var group = groupIds.FirstOrDefault(c => c.Any(id => id == useId));
|
|
|
+ if (group != null)
|
|
|
+ {
|
|
|
+ group.Add(useId);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ groupIds.Add(new List<string>(){ useId });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ foreach (var groupId in groupIds)
|
|
|
+ {
|
|
|
+ var startNode = sourceGraph.Vertexes.FirstOrDefault(v => groupId.Any(id => id == v.Id));
|
|
|
+ if (startNode == null)
|
|
|
+ continue;
|
|
|
#region 源路径
|
|
|
var sourcePathNodes = sourceGraph.GetPaths2(startNode, end =>
|
|
|
{
|
|
@@ -153,11 +201,17 @@ namespace SAGA.GplotManage
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ bool noResvse = useEdge.Path.ContainVertex(useEdge.NextNode.Id) == 0;
|
|
|
foreach (var equipmentNode in endNodes)
|
|
|
{
|
|
|
+ if (!equipmentNode.IsRealEquipment)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
BinaryRelationItem item = new BinaryRelationItem();
|
|
|
item.RelationType = (useEdge.Path.Data as string) ?? string.Empty;
|
|
|
- if (useEdge.Path.ContainVertex(useEdge.NextNode.Id) == 0)
|
|
|
+ if (noResvse)
|
|
|
{
|
|
|
item.From = useNode;
|
|
|
item.To = equipmentNode;
|
|
@@ -183,8 +237,14 @@ namespace SAGA.GplotManage
|
|
|
private static SimpleObjectGraph CreateGraph(List<StringFlag<VerticalRelationRecord>> verticalNodes, List<BinaryRelationItem> sourceRelations)
|
|
|
{
|
|
|
SimpleObjectGraph graph = new SimpleObjectGraph();
|
|
|
+ for (int j = 0; j < verticalNodes.Count; j++)
|
|
|
+ {
|
|
|
+ var currentVertical = verticalNodes[j];
|
|
|
+ graph.AddVertex(new SimpleVertex<object>(currentVertical.Instance) { Id = currentVertical.Flag });
|
|
|
+ }
|
|
|
+
|
|
|
#region 构建临时边集
|
|
|
- for (int i = sourceRelations.Count - 1; i >= 0; i--)
|
|
|
+ for (int i = sourceRelations.Count - 1; i >= 0; i--)
|
|
|
{
|
|
|
var currentRecord = sourceRelations[i];
|
|
|
var startId = currentRecord.From.BimId;
|
|
@@ -198,15 +258,15 @@ namespace SAGA.GplotManage
|
|
|
if (replaceStart != null && replaceEnd != null)
|
|
|
break;
|
|
|
var currentVertical = verticalNodes[j];
|
|
|
- if (currentVertical.Instance.RelationItems.Contains(startId))
|
|
|
+ if (replaceStart == null&¤tVertical.Instance.RelationItems.Contains(startId))
|
|
|
{
|
|
|
replaceStart = currentVertical.Flag;
|
|
|
}
|
|
|
- if (currentVertical.Instance.RelationItems.Contains(endId))
|
|
|
+ if (replaceEnd == null && currentVertical.Instance.RelationItems.Contains(endId))
|
|
|
{
|
|
|
replaceEnd = currentVertical.Flag;
|
|
|
}
|
|
|
- graph.AddVertex(new SimpleVertex<object>(currentVertical.Instance) { Id = currentVertical.Flag });
|
|
|
+ //graph.AddVertex(new SimpleVertex<object>(currentVertical.Instance) { Id = currentVertical.Flag });
|
|
|
}
|
|
|
replaceStart = replaceStart ?? startId;
|
|
|
replaceEnd = replaceEnd ?? endId;
|