Browse Source

xls:提交相关修改

xls 6 years ago
parent
commit
2227f57a24
28 changed files with 749 additions and 54 deletions
  1. 9 9
      MBI/Menu/SAGABIM.xml
  2. 82 0
      MBI/SAGA.GplotDrawData/DBView/FloorSystemGraphView.cs
  3. 31 0
      MBI/SAGA.GplotDrawData/DBView/VerticalSYstemGraphView.cs
  4. 6 8
      MBI/SAGA.GplotDrawData/SAGA.GplotDrawData.csproj
  5. 1 1
      MBI/SAGA.GplotDrawData/WinMachineRoomView-Web.xaml.cs
  6. 1 1
      MBI/SAGA.GplotDrawData/WinMachineRoomView.xaml.cs
  7. 173 0
      MBI/SAGA.GplotManage/Command.cs
  8. 1 3
      MBI/SAGA.GplotManage/Command/ColdGplot/ColdRoomSystemView.cs
  9. 1 6
      MBI/SAGA.GplotManage/Command/RoomShowHandler.cs
  10. 1 4
      MBI/SAGA.GplotManage/GplotManage/GplotView/GplotView.cs
  11. 1 0
      MBI/SAGA.GplotManage/SAGA.GplotManage.csproj
  12. 1 3
      MBI/SAGA.GplotRelationComputerManage/ColdRoom/ColdRoomManager.cs
  13. 21 0
      MBI/SAGA.GplotRelationComputerManage/Common/ComputerFileSetting.cs
  14. 51 0
      MBI/SAGA.GplotRelationComputerManage/Draw/DocumentNode.cs
  15. 99 0
      MBI/SAGA.GplotRelationComputerManage/Draw/DrawDocumentUtil.cs
  16. 26 0
      MBI/SAGA.GplotRelationComputerManage/Draw/DrawLine.cs
  17. 33 0
      MBI/SAGA.GplotRelationComputerManage/Draw/DrawText.cs
  18. 36 0
      MBI/SAGA.GplotRelationComputerManage/Draw/DrawVertex.cs
  19. 26 0
      MBI/SAGA.GplotRelationComputerManage/Draw/GplotNode.cs
  20. 15 0
      MBI/SAGA.GplotRelationComputerManage/Draw/IDraw.cs
  21. 43 0
      MBI/SAGA.GplotRelationComputerManage/Draw/PointExtension.cs
  22. 11 5
      MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj
  23. 6 2
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemParseManager.cs
  24. 23 0
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/VerticalResult.cs
  25. 2 2
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/FloorSystemItem.cs
  26. 30 0
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/VerticalDrawData.cs
  27. 18 10
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerContext.cs
  28. 1 0
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerHandler.cs

+ 9 - 9
MBI/Menu/SAGABIM.xml

@@ -411,11 +411,11 @@
   </Panel>
   <Panel PanelName="基于物理世界的拓扑计算" GroupFlag="True" GroupImage="" RevitVer="R15,R16,R17" ButtonStyles="Large">
     <Button ButtonStyles="Large">
-      <ButtonName>SAGA.GplotRelationComputerManage.DistributionRelationshipCommand</ButtonName>
+      <ButtonName>SAGA.GplotManage.DistributionRelationshipCommand</ButtonName>
       <ButtonText>配电柜拓扑关系</ButtonText>
       <ImageName>9、位置信标建模</ImageName>
-      <DllName>..\OutputDll\SAGA.GplotRelationComputerManage.dll</DllName>
-      <ClassName>SAGA.GplotRelationComputerManage.DistributionRelationshipCommand</ClassName>
+      <DllName>..\OutputDll\SAGA.GplotManage.dll</DllName>
+      <ClassName>SAGA.GplotManage.DistributionRelationshipCommand</ClassName>
       <ToolTip>配电柜与配电柜拓扑关系</ToolTip>
       <LongDescription>配电柜与配电柜拓扑关系</LongDescription>
       <ToolTipImage></ToolTipImage>
@@ -423,11 +423,11 @@
       <Modules>SJJC</Modules>
     </Button>
     <Button ButtonStyles="Large">
-      <ButtonName>SAGA.GplotRelationComputerManage.DistributionEqRelationshipCommand</ButtonName>
+      <ButtonName>SAGA.GplotManage.DistributionEqRelationshipCommand</ButtonName>
       <ButtonText>配电柜与设备</ButtonText>
       <ImageName>9、位置信标建模</ImageName>
-      <DllName>..\OutputDll\SAGA.GplotRelationComputerManage.dll</DllName>
-      <ClassName>SAGA.GplotRelationComputerManage.DistributionEqRelationshipCommand</ClassName>
+      <DllName>..\OutputDll\SAGA.GplotManage.dll</DllName>
+      <ClassName>SAGA.GplotManage.DistributionEqRelationshipCommand</ClassName>
       <ToolTip>配电柜与设备拓扑关系</ToolTip>
       <LongDescription>配电柜与设备拓扑关系</LongDescription>
       <ToolTipImage></ToolTipImage>
@@ -436,11 +436,11 @@
     </Button>
 
     <Button ButtonStyles="Large">
-      <ButtonName>SAGA.GplotRelationComputerManage.BelongEqRelationshipCommand</ButtonName>
+      <ButtonName>SAGA.GplotManage.BelongEqRelationshipCommand</ButtonName>
       <ButtonText>对象受控关系</ButtonText>
       <ImageName>9、位置信标建模</ImageName>
-      <DllName>..\OutputDll\SAGA.GplotRelationComputerManage.dll</DllName>
-      <ClassName>SAGA.GplotRelationComputerManage.BelongEqRelationshipCommand</ClassName>
+      <DllName>..\OutputDll\SAGA.GplotManage.dll</DllName>
+      <ClassName>SAGA.GplotManage.BelongEqRelationshipCommand</ClassName>
       <ToolTip>对象受控关系</ToolTip>
       <LongDescription>对象受控关系</LongDescription>
       <ToolTipImage></ToolTipImage>

+ 82 - 0
MBI/SAGA.GplotDrawData/DBView/FloorSystemGraphView.cs

@@ -0,0 +1,82 @@
+using SAGA.GplotRelationComputerManage;
+using SAGA.Models.Graphs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotDrawData.DBView
+{
+    public class FloorSystemGraphView : GraphDBView<List<FloorDrawRecord>>
+    {
+        public override GraphDB AppendDb(List<FloorDrawRecord> t, GraphDB db)
+        {
+            //var baseRecord = t.FirstOrDefault();
+            //if(baseRecord!=null)
+            //{
+              
+            //    #region 起点信息
+            //    if (fd.MEPCurveData != null)
+            //    {
+            //        try
+            //        {
+            //            foreach (var startData in fd.MEPCurveData)
+            //            {
+            //                if (startData.Current == null)
+            //                    continue;
+            //                GVertex node = new GVertex();
+            //                var planPoint = new Point(startData.Current.DownPoint3D.X, startData.Current.DownPoint3D.Y);
+            //                if (planPoint.X == 0 && planPoint.Y == 0)
+            //                {
+            //                    continue;
+            //                }
+
+            //                var useLocation = planPoint.ConvertINToMM().ConvertToPoint3D();
+            //                node.Location = new System.Windows.Media.Media3D.Point3D(useLocation.X, useLocation.Y, 0);
+            //                node.ElementColor = Colors.Red;
+            //                node.Name = "start";
+            //                node.Radius = 4;
+            //                db.Elements.Add(node);
+            //            }
+            //        }
+            //        catch (Exception)
+            //        {
+
+            //        }
+            //    }
+            //    #endregion
+            //    foreach (var pt in endPoints)
+            //    {
+            //        GVertex node = new GVertex();
+            //        node.Location = pt.Point.ConvertINToMM().ConvertToPoint3D();
+            //        node.ElementColor = Colors.Red;
+            //        //node.Name = pt.Name;
+            //        node.Radius = 5;
+            //        db.Elements.Add(node);
+            //    }
+            //    foreach (var line in lines)
+            //    {
+            //        GPath path = new GPath();
+            //        path.Data = line.Select(p => p.ConvertINToMM().ConvertToPoint3D()).ToList();
+            //        path.ElementColor = Colors.Red;
+            //        db.Elements.Add(path);
+            //    }
+            //}
+           
+            //#region 底图获取
+            //var floorName = fd.Id.Split('-')[1];
+            //try
+            //{
+            //    var jsObject = BaseMapManager.GetFloorInfo(floorName);
+            //    db.RefJObjects.Add(jsObject);
+            //}
+            //catch (Exception ex)
+            //{
+
+            //}
+            //#endregion
+            return db;
+        }
+    }
+}

+ 31 - 0
MBI/SAGA.GplotDrawData/DBView/VerticalSYstemGraphView.cs

@@ -0,0 +1,31 @@
+using SAGA.GplotRelationComputerManage;
+using SAGA.Models.Graphs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotDrawData.DBView
+{
+    /// <summary>
+    /// 解析立管数据
+    /// </summary>
+    public class VerticalSystemGraphView : GraphDBView<VerticalDrawData>
+    {
+        public override GraphDB AppendDb(VerticalDrawData t, GraphDB db)
+        {
+            var levaleData = t.LevelDatas;
+            db.Elements.AddRange(levaleData);
+            var records = t.DrawRecords ?? new List<VerticalDrawRecord>();
+            var groupRecords = records.GroupBy(r => r.GroupId);
+            foreach (var item in groupRecords)
+            {
+                VGroupPipe groupPipe = new VGroupPipe(item.Select(c=>c.RefPipe).ToList());
+                db.Elements.Add(groupPipe);
+            }
+         
+            return db;
+        }
+    }
+}

+ 6 - 8
MBI/SAGA.GplotDrawData/SAGA.GplotDrawData.csproj

@@ -69,22 +69,16 @@
     <Compile Include="Common\WebGplotSettings.cs" />
     <Compile Include="DBView\BaseMapManager.cs" />
     <Compile Include="DBView\EquipmentGraphView.cs" />
+    <Compile Include="DBView\FloorSystemGraphView.cs" />
     <Compile Include="DBView\IGraphDBView.cs" />
     <Compile Include="DBView\PipeEndGraphView.cs" />
     <Compile Include="DBView\RoomGraphView.cs" />
     <Compile Include="DBView\SpaceGraphView.cs" />
     <Compile Include="DBView\VerticalPipeGraphView.cs" />
+    <Compile Include="DBView\VerticalSystemGraphView.cs" />
     <Compile Include="DBView\ViewExtension.cs" />
     <Compile Include="DBView\VirticalSpaceGraphView.cs" />
-    <Compile Include="Draw\DocumentNode.cs" />
-    <Compile Include="Draw\DrawDocumentUtil.cs" />
     <Compile Include="DrawElementEdges.cs" />
-    <Compile Include="Draw\DrawLine.cs" />
-    <Compile Include="Draw\DrawText.cs" />
-    <Compile Include="Draw\DrawVertex.cs" />
-    <Compile Include="Draw\GplotNode.cs" />
-    <Compile Include="Draw\IDraw.cs" />
-    <Compile Include="Draw\PointExtension.cs" />
     <Compile Include="WinControlRelation-Web.xaml.cs">
       <DependentUpon>WinControlRelation-Web.xaml</DependentUpon>
     </Compile>
@@ -224,6 +218,10 @@
       <Project>{07b73c98-dcb0-4782-81fa-f50a30b563ab}</Project>
       <Name>SAGA.DotNetUtils</Name>
     </ProjectReference>
+    <ProjectReference Include="..\SAGA.GplotRelationComputerManage\SAGA.GplotRelationComputerManage.csproj">
+      <Project>{f77b7e95-15f0-4b67-947e-318b608fc27f}</Project>
+      <Name>SAGA.GplotRelationComputerManage</Name>
+    </ProjectReference>
     <ProjectReference Include="..\SAGA.MBI\SAGA.MBI.csproj">
       <Project>{F6216892-A198-4991-820A-4A2F2637103E}</Project>
       <Name>SAGA.MBI</Name>

+ 1 - 1
MBI/SAGA.GplotDrawData/WinMachineRoomView-Web.xaml.cs

@@ -1,5 +1,5 @@
 using CEFSharpWPF;
-using SAGA.GplotDrawData.Draw;
+using SAGA.GplotRelationComputerManage.Draw;
 using SAGA.Models;
 using SAGA.RevitUtils.Windows;
 using System;

+ 1 - 1
MBI/SAGA.GplotDrawData/WinMachineRoomView.xaml.cs

@@ -15,7 +15,7 @@ using System.Windows.Media.Imaging;
 using System.Windows.Shapes;
 using DrawData;
 using SAGA.DotNetUtils.Logger;
-using SAGA.GplotDrawData.Draw;
+using SAGA.GplotRelationComputerManage.Draw;
 using SAGA.Models;
 using SAGA.Models.GplotElement;
 using SAGA.RevitUtils.Windows;

+ 173 - 0
MBI/SAGA.GplotManage/Command.cs

@@ -0,0 +1,173 @@
+using DrawData;
+using System;
+using System.Linq;
+using Autodesk.Revit.Attributes;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.UI;
+using SAGA.GplotDrawData;
+using SAGA.GplotRelationComputerManage.PumpEnd;
+using SAGA.RevitUtils;
+using SAGA.RevitUtils.Extends;
+using MainWindow = SAGA.GplotDrawData.MainWindow;
+using SAGA.GplotRelationComputerManage;
+
+namespace SAGA.GplotManage
+{
+    /// <summary>
+    /// 供水管 回水管拓扑图
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class SupplyHydronicTopoGraph : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            base.Execute(commandData, ref message, elements);
+            using (Transaction trans = new Transaction(ExternalDataWrapper.Current.Doc, "读取风管系统"))
+            {
+                trans.Start();
+                try
+                {
+                    DuctTerminalBll.DrawPipePlane();
+
+                    trans.Commit();
+                }
+                catch (Exception e)
+                {
+                    trans.RollBack();
+                    MessageShow.Show(e);
+                }
+            }
+            return Result.Succeeded;
+        }
+    }
+
+    /// <summary>
+    /// 配电关系图--配电柜与配电柜
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class DistributionRelationshipCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            #region 核心
+            try
+            {
+                DistributionRelationshipHandler handler = new DistributionRelationshipHandler();
+                var re = handler.GetViewData(new PowerComputerContext());
+                if (re[0].Childrens.Any())
+                {
+                    WinEquipmentRelation_Web window =
+                        new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
+                    window.Title = "配电拓扑图:配电柜--配电柜";
+                    window.Show();
+                }
+
+            }
+            catch (Exception ex)
+            {
+
+                MessageShow.Show(ex);
+            } 
+            #endregion
+            return Result.Succeeded;
+        }
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+      
+    }
+
+
+
+    /// <summary>
+    /// 配电关系图--配电柜与配电设备
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class DistributionEqRelationshipCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            #region 核心处理
+            EquipPowerRelationshipHandler handler = new EquipPowerRelationshipHandler();
+            var re = handler.GetViewData(new PowerComputerContext());
+            if (re[0].Childrens.Any())
+            {
+                WinEquipmentRelation_Web window =
+                    new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
+                window.Title = "配电拓扑图:配电柜--末端";
+                window.Show();
+            } 
+            #endregion
+            return Result.Succeeded;
+        }    
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
+
+
+    /// <summary>
+    /// 对象受控关系
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class BelongEqRelationshipCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+
+            #region 核心处理
+            ObjectControlRelationshipHandler handler = new ObjectControlRelationshipHandler();
+            var re = handler.GetViewData(new PowerComputerContext());
+            if (re[0].Childrens.Any())
+            {
+                WinControlRelation_Web window =
+                    new WinControlRelation_Web(re[0].Childrens, re[1].Childrens);
+                window.Title = "对象受控关系图";
+                window.Show();
+            } 
+            #endregion
+
+            return Result.Succeeded;
+        }
+
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
+
+    /// <summary>
+    /// 空间关系查看
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class SpaceViewCommand : ExternalCommand
+    {
+        public SpaceViewCommand()
+        {
+            IsShowNoDocument = true;
+        }
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            try
+            {
+
+                var win = new WinDrawSpace();
+                win.ShowDialog();
+            }
+            catch (Exception e)
+            {
+
+                MessageShow.Show(e);
+            }
+
+            return Result.Succeeded;
+        }
+    }
+}

+ 1 - 3
MBI/SAGA.GplotManage/Command/ColdGplot/ColdRoomSystemView.cs

@@ -1,6 +1,4 @@
-using SAGA.GplotDrawData;
-using SAGA.GplotDrawData.Draw;
-using SAGA.GplotRelationComputerManage;
+
 using SAGA.GplotRelationComputerManage.ColdRoom;
 using SAGA.Models;
 using SAGA.RevitUtils;

+ 1 - 6
MBI/SAGA.GplotManage/Command/RoomShowHandler.cs

@@ -1,13 +1,8 @@
 using SAGA.GplotDrawData;
-using SAGA.GplotDrawData.Draw;
 using SAGA.GplotRelationComputerManage.ColdRoom;
+using SAGA.GplotRelationComputerManage.Draw;
 using SAGA.Models;
-using SAGA.RevitUtils;
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace SAGA.GplotManage
 {

+ 1 - 4
MBI/SAGA.GplotManage/GplotManage/GplotView/GplotView.cs

@@ -1,7 +1,4 @@
-using SAGA.GplotDrawData;
-using SAGA.GplotDrawData.Draw;
-using SAGA.GplotRelationComputerManage;
-using SAGA.GplotRelationComputerManage.ColdRoom;
+
 using SAGA.Models;
 using SAGA.Models.Graphs;
 using System;

+ 1 - 0
MBI/SAGA.GplotManage/SAGA.GplotManage.csproj

@@ -90,6 +90,7 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     <Compile Include="CheckAndKeepGplotLaster.cs" />
+    <Compile Include="Command.cs" />
     <Compile Include="Command\ColdGplot\ColdRoomSystemCompute.cs" />
     <Compile Include="Command\ColdGplot\ColdRoomSystemParse.cs" />
     <Compile Include="Command\ColdGplot\ColdRoomSystemView.cs" />

+ 1 - 3
MBI/SAGA.GplotRelationComputerManage/ColdRoom/ColdRoomManager.cs

@@ -5,9 +5,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
-using DrawData;
-using SAGA.GplotDrawData;
-using SAGA.GplotDrawData.Draw;
+using SAGA.GplotRelationComputerManage.Draw;
 using SAGA.Models;
 using SAGA.RevitUtils;
 using GriphicVertexType = SAGA.Models.GplotElement.VertexType;

+ 21 - 0
MBI/SAGA.GplotRelationComputerManage/Common/ComputerFileSetting.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+  //
+    /// </summary>
+    public class ComputerFileSetting
+    {
+        public const string FloorDraw = "FloorDraw";
+        public const string FloorRelation = "FloorRelation";
+        public const string VerticalDraw = "VerticalDraw";
+        public const string VerticalRelation = "VerticalRelation";
+        public const string MachineRoomDraw = "MechineRoomDraw";
+        public const string MachineRoomRelation = "MechineRoomRelation";
+    }
+}

+ 51 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/DocumentNode.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.Models;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public class DocumentNode:TNode<DocumentNode>,INotifyPropertyChanged
+    {
+        /// <summary>
+        /// 关联的文件
+        /// </summary>
+        public GplotDocument LinkDocument { get; set; }
+
+        private bool m_IsExpanded;
+
+        public bool IsExpanded
+        {
+            get { return this.m_IsExpanded; }
+            set
+            {
+                this.m_IsExpanded = value;
+                RaisePropertyChanged(nameof(IsExpanded));
+            }
+        }
+        private bool m_IsSelected;
+        /// <summary>
+        /// 是否选中
+        /// </summary>
+        public bool IsSelected
+        {
+            get { return this.m_IsSelected; }
+            set
+            {
+                this.m_IsSelected = value;
+                RaisePropertyChanged(nameof(IsSelected));
+            }
+        }
+        #region 实现通知接口
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public void RaisePropertyChanged(string propertyName)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        } 
+        #endregion
+    }
+}

+ 99 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/DrawDocumentUtil.cs

@@ -0,0 +1,99 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using SAGA.Models;
+using SAGA.Models.GplotElement;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public class DrawDocumentUtil
+    {
+        private static Dictionary<Type,object> m_Draws=new Dictionary<Type, object>();
+        private static Dictionary<Type, Tuple<object, MethodInfo>> m_Methods = new Dictionary<Type, Tuple<object, MethodInfo>>();
+        static DrawDocumentUtil()
+        {
+            InitDraw();
+            CoordiateMatrix = new Matrix(1, 0, 0, 1, 0, 0);
+        }
+        private static void InitDraw()
+        {
+            m_Draws.Add(typeof(TText), new DrawText());
+            m_Draws.Add(typeof(TVertex), new DrawVertex());
+            m_Draws.Add(typeof(TLine), new DrawLine());
+        }
+        public static IDraw<T> DrawFactory<T>() where T:TElement
+        {
+            if (m_Draws.TryGetValue(typeof(T), out object  draw))
+            {
+                return (IDraw<T>) draw;
+            }
+            return null;
+        }
+        public static bool DrawProxy(Type type,TElement element, Canvas canvas)
+        {
+            Tuple<object, MethodInfo> tupleValue = null;
+            if (!m_Methods.TryGetValue(type, out tupleValue))
+            {
+                object value = null;
+                if (m_Draws.TryGetValue(type, out value))
+                {
+                    if (value != null)
+                    {
+                        var drawMethod = value.GetType().GetMethod("Draw");
+                        m_Methods.Add(type, tupleValue = new Tuple<object, MethodInfo>(value, drawMethod));
+                    }
+                }
+            }
+            if (tupleValue != null && tupleValue.Item2 != null)
+            {
+                tupleValue.Item2.Invoke(tupleValue.Item1, new object[] { element ,canvas });
+                return true;
+            }
+
+            return false;
+        }
+        public static void Draw(GplotDocument document, Canvas canvas)
+        {
+
+            var elements = document.Elements;
+            foreach (var element in elements)
+            {
+                try
+                {
+                    DrawProxy(element.GetType(), element, canvas);
+                }
+                catch (Exception ex)
+                {
+                }
+            }
+        }
+        /// <summary>
+        /// 坐标设定
+        /// </summary>
+        public static Matrix CoordiateMatrix
+        {
+            get;set;
+        }
+
+        public static Matrix CreateMatrix(FrameworkElement view, Rect rect)
+        {
+            var reg = rect;
+            var center = new Point(reg.Location.X + reg.Width / 2, reg.Location.Y + reg.Height / 2);
+            var zoom1 = view.ActualWidth / (float)reg.Width;
+            var zoom2 = view.ActualHeight / (float)reg.Height;
+            var zoom = Math.Min(zoom1, zoom2);
+            //映射到屏幕中心
+            var tempMatrix =  new Matrix(1, 0f, 0f, -1, view.ActualWidth / (float)2, view.ActualHeight / (float)2);
+            //移动到视口中心
+            tempMatrix.Prepend(new Matrix(zoom, 0f, 0f, zoom, -center.X * zoom, -center.Y * zoom));
+            return tempMatrix;
+        }
+    }  
+}

+ 26 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/DrawLine.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using SAGA.Models;
+using SAGA.Models.GplotElement;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public class DrawLine : IDraw<TLine>
+    {
+        public void Draw(TLine element, Canvas canvas)
+        {
+            var start = DrawDocumentUtil.CoordiateMatrix.Transform(element.StartPoint);
+            var end = DrawDocumentUtil.CoordiateMatrix.Transform(element.EndPoint);
+            var line = new SgLine(start, end);
+            if (line != null)
+            {
+                canvas.Children.Add(line);
+            }
+
+        }
+    }
+}

+ 33 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/DrawText.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using SAGA.Models.GplotElement;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public class DrawText : IDraw<TText>
+    {
+        public void Draw(TText element, Canvas canvas)
+        {
+            TextBlock tb = new TextBlock()
+            {
+                Width = element.Width,
+                Height = element.Height,
+                TextAlignment = TextAlignment.Center,
+                Text = element.Text,
+                Foreground = Brushes.Red,
+                RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, -1, 0, 0))
+            };
+            var end = DrawDocumentUtil.CoordiateMatrix.Transform( element.Center);
+           
+            Canvas.SetTop(tb, end.Y + 15 + tb.Height/2);
+            Canvas.SetLeft(tb, end.X - tb.Width / 2.0d);
+            canvas.Children.Add(tb);
+        }
+    }
+}

+ 36 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/DrawVertex.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Media;
+using SAGA.Models;
+using SAGA.Models.GplotElement;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public class DrawVertex : IDraw<TVertex>
+    {
+        public void Draw(TVertex element, Canvas canvas)
+        {
+            Vertex vertex = null;
+            var location = DrawDocumentUtil.CoordiateMatrix.Transform(element.Location);
+            if (element.VertexType == VertexType.Hellow)
+            {
+                vertex=Vertex.GetHollow(location);
+                vertex.Fill = Brushes.Gray;
+                Canvas.SetZIndex(vertex, 100);
+            }
+            else
+            {
+                vertex = new Vertex(location);
+            }
+
+            if (vertex != null)
+            {
+                canvas.Children.Add(vertex);
+            }
+        }
+    }
+}

+ 26 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/GplotNode.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using SAGA.Models.GplotElement;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public class GplotNode
+    {
+        /// <summary>
+        /// 节点位置
+        /// </summary>
+        public Point Location { get; set; }
+        /// <summary>
+        /// 节点类型
+        /// </summary>
+        public VertexType NodeType { get; set; }
+        /// <summary>
+        /// 节点描述
+        /// </summary>
+        public string Description { get; set; }
+    }
+}

+ 15 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/IDraw.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using SAGA.Models.GplotElement;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public interface IDraw<T> where T :TElement
+    {
+        void Draw(T element, Canvas canvas);
+    }
+}

+ 43 - 0
MBI/SAGA.GplotRelationComputerManage/Draw/PointExtension.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace SAGA.GplotRelationComputerManage.Draw
+{
+    public static class PointExtension
+    {
+        //public static Point UnitVector(this Point point)
+        //{
+        //    double sqr = Math.Sqrt(point.X * point.X + point.Y * point.Y);
+        //    if (sqr == 0)
+        //        return point;
+        //    return new Point(point.X / sqr, point.Y / sqr);
+        //}
+
+        //public static Point Offset(this Point point,  direction)
+        //{
+        //    Vector
+        //    return Point.Add(point, direction);
+        //}
+        public static Point AddX(this Point point, double x)
+        {
+            return new Point(point.X + x, point.Y);
+        }
+        public static Point AddY(this Point point, double y)
+        {
+            return new Point(point.X, point.Y + y);
+        }
+        public static Point Add(this Point point, Point point1)
+        {
+            return new Point(point.X + point.X, point.Y + point1.Y);
+        }
+        public static Point Mult(this Point point, Point point1)
+        {
+            return new Point(point.X - point1.X, point.Y - point1.Y);
+        }
+
+    }
+}

+ 11 - 5
MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj

@@ -81,8 +81,8 @@
     <Compile Include="ColdRoom\ElementsVertexExtension.cs" />
     <Compile Include="ColdRoom\EquipmentItem.cs" />
     <Compile Include="ColdRoom\VectorExtension.cs" />
-    <Compile Include="Command.cs" />
     <Compile Include="Common\AppSetting.cs" />
+    <Compile Include="Common\ComputerFileSetting.cs" />
     <Compile Include="Common\DataServerUtil.cs" />
     <Compile Include="Common\MBIInfoUtil.cs" />
     <Compile Include="Common\PointConverter.cs" />
@@ -97,6 +97,14 @@
     <Compile Include="DataServer\FileKeyAttribute.cs" />
     <Compile Include="DataServer\IVersionFile.cs" />
     <Compile Include="DataServer\TimeVersionFile.cs" />
+    <Compile Include="Draw\DocumentNode.cs" />
+    <Compile Include="Draw\DrawDocumentUtil.cs" />
+    <Compile Include="Draw\DrawLine.cs" />
+    <Compile Include="Draw\DrawText.cs" />
+    <Compile Include="Draw\DrawVertex.cs" />
+    <Compile Include="Draw\GplotNode.cs" />
+    <Compile Include="Draw\IDraw.cs" />
+    <Compile Include="Draw\PointExtension.cs" />
     <Compile Include="LvSpace.cs" />
     <Compile Include="PowerDistribution\Common\DataNodeUtil.cs" />
     <Compile Include="PowerDistribution\Common\PowerComputerContext.cs" />
@@ -129,6 +137,7 @@
     <Compile Include="SystemRelation\Common\PointItemType.cs" />
     <Compile Include="SystemRelation\Common\SystemCalcUtil.cs" />
     <Compile Include="SystemRelation\Common\SystemParseManager.cs" />
+    <Compile Include="SystemRelation\Common\VerticalResult.cs" />
     <Compile Include="SystemRelation\Data\BinaryRelationItem.cs" />
     <Compile Include="SystemRelation\Data\EquipmentNode.cs" />
     <Compile Include="SystemRelation\Data\SetRelationItem.cs" />
@@ -138,6 +147,7 @@
     <Compile Include="SystemRelation\FloorSystemItem.cs" />
     <Compile Include="SystemRelation\ServerData\MachineRoomDrawRecord.cs" />
     <Compile Include="SystemRelation\ServerData\MachineRoomRelationRecord.cs" />
+    <Compile Include="SystemRelation\ServerData\VerticalDrawData.cs" />
     <Compile Include="SystemRelation\ServerData\VerticalDrawRecord.cs" />
     <Compile Include="SystemRelation\ServerData\FloorDrawRecord.cs" />
     <Compile Include="SystemRelation\ServerData\FloorRecord.cs" />
@@ -147,10 +157,6 @@
     <Compile Include="SystemRelation\SystemComputerHandler.cs" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\SAGA.GplotDrawData\SAGA.GplotDrawData.csproj">
-      <Project>{e7a7daac-f310-46cb-bd9b-1d5ab9e01923}</Project>
-      <Name>SAGA.GplotDrawData</Name>
-    </ProjectReference>
     <ProjectReference Include="..\SAGA.DotNetUtils\SAGA.DotNetUtils.csproj">
       <Project>{07b73c98-dcb0-4782-81fa-f50a30b563ab}</Project>
       <Name>SAGA.DotNetUtils</Name>

+ 6 - 2
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemParseManager.cs

@@ -403,7 +403,7 @@ namespace SAGA.GplotRelationComputerManage
         /// <summary>
         /// 计算立面数据
         /// </summary>
-        public static void ComputerVerticalData(List<VerticalPipe> pipeDatas, List<LevelData> levelDatas)
+        public static VerticalResult ComputerVerticalData(List<VerticalPipe> pipeDatas, List<LevelData> levelDatas)
         {
 
             List<VerticalDrawRecord> drawRecords = new List<VerticalDrawRecord>();
@@ -426,7 +426,6 @@ namespace SAGA.GplotRelationComputerManage
             }
             #endregion
 
-
             #region 立管或相当于立管的空间处理
             /*
              * 按系统分组,[一个空间会不会对应多个系统]
@@ -477,6 +476,11 @@ namespace SAGA.GplotRelationComputerManage
 
             #endregion
 
+            VerticalResult result = new VerticalResult();
+            result.DrawData = new VerticalDrawData() { LevelDatas = floors, DrawRecords = drawRecords };
+            result.RelationData = relationRecords;
+            return result;
+
         }
         #endregion
     }

+ 23 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/VerticalResult.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 立面计算结果信息
+    /// </summary>
+    public class VerticalResult
+    {
+        /// <summary>
+        /// 绘图数据
+        /// </summary>
+        public VerticalDrawData DrawData { get; set; }
+        /// <summary>
+        /// 关系数据
+        /// </summary>
+        public List<VerticalRelationRecord> RelationData { get; set; }
+    }
+}

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

@@ -249,8 +249,8 @@ namespace SAGA.GplotRelationComputerManage
             }
             #endregion
 
-            context.DrawRecords.AddRange(drawRecords);
-            context.RelationRecords.AddRange(relationRecords);
+            context.FloorDrawRecords.AddRange(drawRecords);
+            context.FloorRelationRecords.AddRange(relationRecords);
         }
         #endregion
 

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

@@ -0,0 +1,30 @@
+using SAGA.Models;
+using SAGA.Models.Graphs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 垂直立管相关信息
+    /// </summary>
+    public class VerticalDrawData
+    {
+        public VerticalDrawData()
+        {
+            LevelDatas = new List<VFloor>();
+            DrawRecords = new List<VerticalDrawRecord>();
+        }
+        /// <summary>
+        /// 标高数据
+        /// </summary>
+       public List<VFloor> LevelDatas { get; set; }
+        /// <summary>
+        /// 绘图相关数据
+        /// </summary>
+       public List<VerticalDrawRecord> DrawRecords { get; set; }
+    }
+}

+ 18 - 10
MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerContext.cs

@@ -26,8 +26,10 @@ namespace SAGA.GplotRelationComputerManage
             VerticalPipes = new List<VerticalPipe>();
             Levels = new List<LevelData>();
             Relations = new List<string>();
-            DrawRecords = new List<FloorDrawRecord>();
-            RelationRecords = new List<FloorRelationRecord>();
+            FloorDrawRecords = new List<FloorDrawRecord>();
+            FloorRelationRecords = new List<FloorRelationRecord>();
+            MachineRoomDrawRecords = new List<MachineRoomDrawRecord>();
+            MachineRoomRelationRecords = new List<MachineRoomRelationRecord>();
             #endregion
         }
         #region 计算缓存对象
@@ -81,8 +83,10 @@ namespace SAGA.GplotRelationComputerManage
          */
         public List<VerticalPipe> VerticalPipes { get; private set; }
         public List<LevelData> Levels { get; private set; }
-        public List<FloorDrawRecord> DrawRecords { get; private set; }
-        public List<FloorRelationRecord> RelationRecords { get; private set; }
+        public List<FloorDrawRecord> FloorDrawRecords { get; private set; }
+        public List<FloorRelationRecord> FloorRelationRecords { get; private set; }
+        public List<MachineRoomDrawRecord> MachineRoomDrawRecords { get; private set; }
+        public List<MachineRoomRelationRecord> MachineRoomRelationRecords { get; private set; }
         #endregion
 
         #region 需要计算的系统相关
@@ -97,15 +101,19 @@ namespace SAGA.GplotRelationComputerManage
         public List<string> Relations { get;private set; }
         #endregion
 
-        #region 根据立面数据缓存结果,生成全局的立面绘图数据和关系数据
+        #region 保存计算结果
         /// <summary>
-        /// 计算立面数据
+        /// 保存立面数据
         /// </summary>
-        public void ComputerVerticalData()
+        public void SaveComputerData()
         {
-            /*
-             * 1、
-             */
+            DataServerUtil.Current.SaveData(ComputerFileSetting.FloorDraw, FloorDrawRecords);
+            DataServerUtil.Current.SaveData(ComputerFileSetting.FloorRelation, FloorRelationRecords);
+            DataServerUtil.Current.SaveData(ComputerFileSetting.MachineRoomDraw, MachineRoomDrawRecords);
+            DataServerUtil.Current.SaveData(ComputerFileSetting.MachineRoomRelation, MachineRoomRelationRecords);
+            var result = SystemParseManager.ComputerVerticalData(VerticalPipes, Levels);
+            DataServerUtil.Current.SaveData(ComputerFileSetting.VerticalDraw, result.DrawData);
+            DataServerUtil.Current.SaveData(ComputerFileSetting.VerticalRelation, result.RelationData);
         }
         #endregion
     }

+ 1 - 0
MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerHandler.cs

@@ -30,6 +30,7 @@ namespace SAGA.GplotRelationComputerManage
                     floorItems.Document.CloseDocSimple();
                 }
             }
+            context.SaveComputerData();
             //最后统保存缓存数据
             return items;
         }