Bläddra i källkod

xls:修改信息点名称

xulisong 6 år sedan
förälder
incheckning
1bf207baed

+ 4 - 0
MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj

@@ -136,9 +136,13 @@
     <Compile Include="SystemRelation\Data\SystemDrawItems.cs" />
     <Compile Include="SystemRelation\Data\SystemPointItem.cs" />
     <Compile Include="SystemRelation\FloorSystemItem.cs" />
+    <Compile Include="SystemRelation\ServerData\MachineRoomDrawRecord.cs" />
+    <Compile Include="SystemRelation\ServerData\MachineRoomRelationRecord.cs" />
+    <Compile Include="SystemRelation\ServerData\VerticalDrawRecord.cs" />
     <Compile Include="SystemRelation\ServerData\FloorDrawRecord.cs" />
     <Compile Include="SystemRelation\ServerData\FloorRecord.cs" />
     <Compile Include="SystemRelation\ServerData\FloorRelationRecord.cs" />
+    <Compile Include="SystemRelation\ServerData\VerticalRelationRecord.cs" />
     <Compile Include="SystemRelation\SystemComputerContext.cs" />
     <Compile Include="SystemRelation\SystemComputerHandler.cs" />
   </ItemGroup>

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemCalcUtil.cs

@@ -39,7 +39,7 @@ namespace SAGA.GplotRelationComputerManage
                var name = element.GetFamily().Name;
                return Regex.IsMatch(name, AppSetting.FamilyStartFlag);
            }
-           return element.GetParameterString(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS) == AppSetting.StartFlag;
+           return (element.GetParameterString(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS)??string.Empty).StartsWith(AppSetting.StartFlag);
         }
 
         /// <summary>

+ 150 - 13
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemParseManager.cs

@@ -8,9 +8,12 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Windows.Media.Media3D;
 using Autodesk.Revit.DB;
 using Autodesk.Revit.DB.Mechanical;
 using Autodesk.Revit.DB.Plumbing;
+using SAGA.Models;
+using SAGA.Models.Graphs;
 using SAGA.RevitUtils;
 using SAGA.RevitUtils.Extends;
 using SAGA.RevitUtils.MEP;
@@ -300,15 +303,30 @@ namespace SAGA.GplotRelationComputerManage
         #endregion
 
         #region 创建关系数据相关
-        public static List<EquipmentNode> CreateRelation(ElementTreeNode etn)
+        public static List<BinaryRelationItem> CreateRelation(ElementTreeNode etn)
         {
+            List<BinaryRelationItem> result = new List<BinaryRelationItem>();
             #region 描述
             /*
-             * 1、将树形结构初步处理,修剪成存留设备之间的关系
+             * 1、将树形结构初步处理,修剪成存留设备之间的关系;
+             * 2、处理成二维关系
              */
             #endregion
-
-            return ConvertEquipmentNodes(etn);
+            var equipmentNodes= ConvertEquipmentNodes(etn);
+            var loopNodes = new List<EquipmentNode>(equipmentNodes);
+            for (int i = 0; i < loopNodes.Count; i++)
+            {
+                var currentNode = loopNodes[i];
+                foreach (var childNode in currentNode.Nodes)
+                {
+                    BinaryRelationItem relation = new BinaryRelationItem();
+                    relation.From = currentNode.CloneCurrentNode();
+                    relation.To = childNode.CloneCurrentNode();
+                    result.Add(relation);
+                    loopNodes.Add(childNode);
+                }
+            }
+            return result;
         }
 
         /// <summary>
@@ -319,14 +337,22 @@ namespace SAGA.GplotRelationComputerManage
         private static List<EquipmentNode> ConvertEquipmentNodes(ElementTreeNode etn)
         {
             List<EquipmentNode> nodes = new List<EquipmentNode>();
-            if (TryGetNode(etn.Current,out EquipmentNode outNode))
-            {
-                nodes.Add(outNode);
-                return nodes;
-            }
-            foreach (var elementTreeNode in etn.Nodes)
+            List<ElementTreeNode> loopNodes = new List<ElementTreeNode>(){ etn };
+            for (int i = 0; i < loopNodes.Count; i++)
             {
-                nodes.AddRange(ConvertEquipmentNodes(elementTreeNode));
+                var currentNode = loopNodes[i];
+                if (TryGetNode(currentNode.Current, out EquipmentNode outNode))
+                {
+                    foreach (var currentNodeNode in currentNode.Nodes)
+                    {
+                        outNode.AddChildren(ConvertEquipmentNodes(currentNodeNode));
+                    }                  
+                    nodes.Add(outNode);
+                }
+                else
+                {
+                    loopNodes.AddRange(currentNode.Nodes);
+                }
             }
             return nodes;
         }
@@ -340,8 +366,7 @@ namespace SAGA.GplotRelationComputerManage
         {
             bool flag = false;
             EquipmentNode node = new EquipmentNode();
-            node.RevitId = element.Id.IntegerValue;
-            node.BimId = element.GetBimId();
+        
             if (element is Space space)
             {
                 node.Category = PointItemType.Space.ToString();
@@ -363,8 +388,120 @@ namespace SAGA.GplotRelationComputerManage
             }
             flag = !string.IsNullOrEmpty(node.Category);
             outNode = flag ? node : null;
+            #region 确定返回之后进行后初始化处理
+            if (outNode != null)
+            {
+                outNode.RevitId = element.Id.IntegerValue;
+                outNode.BimId = element.GetBimId();
+            } 
+            #endregion
             return flag;
         }
         #endregion
+
+        #region 创建立面绘图和关系数据
+        /// <summary>
+        /// 计算立面数据
+        /// </summary>
+        public static void ComputerVerticalData(List<VerticalPipe> pipeDatas, List<LevelData> levelDatas)
+        {
+
+            List<VerticalDrawRecord> drawRecords = new List<VerticalDrawRecord>();
+            List<VerticalRelationRecord> relationRecords = new List<VerticalRelationRecord>();
+            #region 标高绘图数据整理
+            List<VFloor> floors = new List<VFloor>();
+            for (int i = 0; i < levelDatas.Count; i++)
+            {
+                var tempFloor = new VFloor();
+                tempFloor.Name = levelDatas[i].Name;
+                if (tempFloor.Name == "F1")
+                {
+                    tempFloor.ValueDescription = "G";
+                }
+                tempFloor.Index = i;
+                tempFloor.FloorId = i.ToString();
+                tempFloor.LinkId = levelDatas[i].Id;
+                floors.Add(tempFloor);
+
+            }
+            #endregion
+
+
+            #region 立管或相当于立管的空间处理
+            /*
+             * 按系统分组,[一个空间会不会对应多个系统]
+             */
+            var comparer = new VpComparer();
+         
+            int groupId = 0;
+            //按系统分组
+            var goupSystems = pipeDatas.GroupBy(p => p.PipeSytemType);
+            foreach (var groupSystem in goupSystems)
+            {
+                //按坐标分组
+                foreach (var groupPosition in groupSystem.GroupBy(p=>p.DownPoint3D, comparer))
+                {
+                    var currentGroupdId = groupId + 1;
+                    SetRelationItem set = new SetRelationItem();
+                    #region 处理绘图数据
+                    foreach (var groupFloor in groupPosition.GroupBy(p => p.LevelName))
+                    {
+                        var verData = groupFloor.FirstOrDefault();
+                        string floorId = floors.FirstOrDefault(c => c.Name == groupFloor.Key)?.FloorId;
+                        #region 生成存储核心数据
+                        VPipe pipe = new VPipe();
+                        pipe.LinkId = verData.Id;
+                        pipe.Name = string.Join(",", groupFloor.Select(v => v.Display));//verData.Display;
+                        pipe.Tip = verData.DisplayTip;
+                        pipe.PipeSystemType = verData.PipeSytemType;
+                        pipe.FloorId = floorId;
+                        #endregion
+                        VerticalDrawRecord drawRecord = new VerticalDrawRecord();
+                        drawRecord.GroupId = currentGroupdId.ToString();
+                        drawRecord.RefPipe = pipe;
+                        drawRecord.SystemName = groupSystem.Key;
+                        drawRecords.Add(drawRecord);
+                        set.AddRange(groupFloor.Select(v => string.Format("{0}:{1}", floorId, v.Id)));
+                    }
+                    #endregion
+
+                    #region 处理关系数据
+
+                    VerticalRelationRecord relationRecord = new VerticalRelationRecord();
+                    relationRecord.SystemName = groupSystem.Key;
+                    relationRecord.RelationItems = set;
+                    relationRecords.Add(relationRecord);
+                    #endregion
+                }
+            }
+
+            #endregion
+
+        }
+        #endregion
+    }
+
+    /// <summary>
+    /// 点位置比较相关
+    /// </summary>
+    public class VpComparer : IEqualityComparer<Point3D>
+    {
+        /// <summary>
+        ///  立管左右错开小于2Cm
+        /// 
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <returns></returns>
+        public bool Equals(Point3D x, Point3D y)
+        {//数据为英寸
+            var diff = 2 * 10d / 304.8;
+            return Math.Abs(x.X - y.X) <= diff && Math.Abs(x.Y - y.Y) <= diff;
+        }
+
+        public int GetHashCode(Point3D obj)
+        {
+            return 0;
+        }
     }
 }

+ 10 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Data/BinaryRelationItem.cs

@@ -26,5 +26,15 @@ namespace SAGA.GplotRelationComputerManage
         /// 结束节点
         /// </summary>
         public EquipmentNode To { get; set; }
+
+        /// <summary>
+        /// 反转关系
+        /// </summary>
+        public void Reverse()
+        {
+            var temp = To;
+            To = From;
+            From = temp;
+        }
     }
 }

+ 14 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Data/EquipmentNode.cs

@@ -35,5 +35,19 @@ namespace SAGA.GplotRelationComputerManage
         /// 设备分类
         /// </summary>
         public string Category { get; set; }
+
+        /// <summary>
+        /// 复制当前节点信息
+        /// </summary>
+        /// <returns></returns>
+        public EquipmentNode CloneCurrentNode()
+        {
+            EquipmentNode node = new EquipmentNode();
+            node.MbiId = this.MbiId;
+            node.BimId = this.BimId;
+            node.RevitId = this.RevitId;
+            node.Category = this.Category;
+            return node;
+        }
     }
 }

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Data/SetRelationItem.cs

@@ -16,7 +16,7 @@ namespace SAGA.GplotRelationComputerManage
     /// <summary>
     /// 集合关系类,其中的元素两两进行相关
     /// </summary>
-    public class SetRelationItem :List<EquipmentNode>
+    public class SetRelationItem :List<string>
     {
         /*
          * 目前,将立管之间的关系整理成集合关系

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/FloorSystemItem.cs

@@ -324,7 +324,7 @@ namespace SAGA.GplotRelationComputerManage
             var floorRelation = new FloorRelationRecord();
             floorRelation.SetFloorLevel(UseLevel);
             floorRelation.RelationType = relationShell.RelationItem.Type;
-            floorRelation.EquipmentItems = SystemParseManager.CreateRelation(node)??new List<EquipmentNode>();
+            floorRelation.RelationItems = SystemParseManager.CreateRelation(node)??new List<BinaryRelationItem>();
             return floorRelation;
         }
         #endregion

+ 4 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/FloorDrawRecord.cs

@@ -13,7 +13,10 @@ using System.Threading.Tasks;
 
 namespace SAGA.GplotRelationComputerManage
 {
-    public class FloorDrawRecord : FloorFlag
+    /// <summary>
+    /// 平面绘图数据
+    /// </summary>
+    public class FloorDrawRecord : FloorRecord
     {
         /// <summary>
         /// 系统名称信息

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/FloorRecord.cs

@@ -21,7 +21,7 @@ namespace SAGA.GplotRelationComputerManage
     /// <summary>
     /// 楼层信息记录
     /// </summary>
-    public class FloorFlag
+    public class FloorRecord
     {
         public string FloorName { get; set; }
         public string FloorIndex { get; set; }

+ 5 - 2
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/FloorRelationRecord.cs

@@ -13,11 +13,14 @@ using System.Threading.Tasks;
 
 namespace SAGA.GplotRelationComputerManage
 {
-   public  class FloorRelationRecord: FloorFlag
+    /// <summary>
+    /// 平面关系数据
+    /// </summary>
+   public  class FloorRelationRecord: FloorRecord
     {
         /// <summary>
         /// 关联数据
         /// </summary>
-        public List<EquipmentNode> EquipmentItems { get; set; }
+        public List<BinaryRelationItem> RelationItems { get; set; }
     }
 }

+ 22 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/MachineRoomDrawRecord.cs

@@ -0,0 +1,22 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:MachineRoomDrawRecord
+ * 作者:xulisong
+ * 创建时间: 2019/1/23 15:54:20
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 机房绘图数据
+    /// </summary>
+    public class MachineRoomDrawRecord
+    {
+    }
+}

+ 22 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/MachineRoomRelationRecord.cs

@@ -0,0 +1,22 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:MachineRoomRelationRecord
+ * 作者:xulisong
+ * 创建时间: 2019/1/23 15:55:00
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 机房关系数据
+    /// </summary>
+    public class MachineRoomRelationRecord
+    {
+    }
+}

+ 35 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/VerticalDrawRecord.cs

@@ -0,0 +1,35 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:DerticalDrawRecord
+ * 作者:xulisong
+ * 创建时间: 2019/1/23 15:50:53
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.Models.Graphs;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 立面绘图数据
+    /// </summary>
+    public class VerticalDrawRecord:FloorRecord
+    {
+        /// <summary>
+        /// 系统名称信息
+        /// </summary>
+        public string SystemName { get; set; }
+        /// <summary>
+        /// 竖向分组Id
+        /// </summary>
+        public string GroupId { get; set; }
+        /// <summary>
+        /// 关联管道信息
+        /// </summary>
+        public VPipe RefPipe{ get; set; }
+    }
+}

+ 30 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/VerticalRelationRecord.cs

@@ -0,0 +1,30 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:VerticalRelationRecord
+ * 作者:xulisong
+ * 创建时间: 2019/1/23 15:51:47
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 立面关系数据
+    /// </summary>
+    public class VerticalRelationRecord
+    {
+        /// <summary>
+        /// 系统名称
+        /// </summary>
+        public string SystemName { get; set; }
+        /// <summary>
+        /// 关联数据信息
+        /// </summary>
+        public SetRelationItem RelationItems { get; set; }
+    }
+}

+ 12 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerContext.cs

@@ -96,5 +96,17 @@ namespace SAGA.GplotRelationComputerManage
         /// </summary>
         public List<string> Relations { get;private set; }
         #endregion
+
+        #region 根据立面数据缓存结果,生成全局的立面绘图数据和关系数据
+        /// <summary>
+        /// 计算立面数据
+        /// </summary>
+        public void ComputerVerticalData()
+        {
+            /*
+             * 1、
+             */
+        }
+        #endregion
     }
 }

+ 1 - 1
MBI/SAGA.MBI/RevitModelHandle/ParameterDefinitionFactory.cs

@@ -22,7 +22,7 @@ namespace SAGA.MBI.RevitModelHandle
 
         static ParameterDefinitionFactory()
         {
-            m_InnerMap[MBIBuiltInParameter.EquipLocalID] = new ParameterDefinition("设备本地编");
+            m_InnerMap[MBIBuiltInParameter.EquipLocalID] = new ParameterDefinition("设备本地编");
             m_InnerMap[MBIBuiltInParameter.EquipLocalName] = new ParameterDefinition("设备本地名称");
             m_InnerMap[MBIBuiltInParameter.RoomLocalName] = new ParameterDefinition(BuiltInParameter.ROOM_NAME){CanUpdate=
                 (e, value) =>