|
@@ -1,25 +1,10 @@
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
-using System.Diagnostics;
|
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
-using System.Text;
|
|
|
|
-using System.Text.RegularExpressions;
|
|
|
|
-using System.Threading.Tasks;
|
|
|
|
using System.Windows;
|
|
using System.Windows;
|
|
-using System.Windows.Controls;
|
|
|
|
-using System.Windows.Data;
|
|
|
|
-using System.Windows.Documents;
|
|
|
|
-using System.Windows.Input;
|
|
|
|
-using System.Windows.Media;
|
|
|
|
-using System.Windows.Media.Imaging;
|
|
|
|
-using System.Windows.Shapes;
|
|
|
|
using CEFSharpWPF;
|
|
using CEFSharpWPF;
|
|
-using DrawData;
|
|
|
|
-using SAGA.DotNetUtils.Logger;
|
|
|
|
using SAGA.GplotRelationComputerManage;
|
|
using SAGA.GplotRelationComputerManage;
|
|
-using SAGA.MBI.Common;
|
|
|
|
using SAGA.Models;
|
|
using SAGA.Models;
|
|
-using SAGA.RevitUtils;
|
|
|
|
|
|
|
|
namespace SAGA.GplotDrawData
|
|
namespace SAGA.GplotDrawData
|
|
{
|
|
{
|
|
@@ -28,38 +13,31 @@ namespace SAGA.GplotDrawData
|
|
/// </summary>
|
|
/// </summary>
|
|
public partial class WinDrawSpace_Web : Window
|
|
public partial class WinDrawSpace_Web : Window
|
|
{
|
|
{
|
|
|
|
+ public GplotShowType ShowType{ get; private set; }
|
|
public WinDrawSpace_Web()
|
|
public WinDrawSpace_Web()
|
|
{
|
|
{
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
- Vertex.SetRadius(6, 6);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private GplotShowType m_showType;
|
|
|
|
|
|
+ }
|
|
public WinDrawSpace_Web(GplotShowType showType) : this()
|
|
public WinDrawSpace_Web(GplotShowType showType) : this()
|
|
{
|
|
{
|
|
-
|
|
|
|
- this.m_showType = showType;
|
|
|
|
|
|
+ this.ShowType = showType;
|
|
this.Loaded += WinDrawWaterNode_Loaded;
|
|
this.Loaded += WinDrawWaterNode_Loaded;
|
|
}
|
|
}
|
|
- private bool IsRead = true;
|
|
|
|
-
|
|
|
|
private void WinDrawWaterNode_Loaded(object sender, RoutedEventArgs e)
|
|
private void WinDrawWaterNode_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- if (m_showType == GplotShowType.VerticalPlan)
|
|
|
|
|
|
+ if (ShowType == GplotShowType.VerticalPlan)
|
|
{
|
|
{
|
|
InitVerticalSpaces();
|
|
InitVerticalSpaces();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- var node = GetSpaceData();
|
|
|
|
- this.rootNode.ItemsSource = new List<DataNode>() { node };
|
|
|
|
|
|
+ InitHSpaceTree();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
-
|
|
|
|
DotNetUtils.Others.MessageShowBase.Show(ex);
|
|
DotNetUtils.Others.MessageShowBase.Show(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -67,12 +45,10 @@ namespace SAGA.GplotDrawData
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 立面空间相关数据源
|
|
/// 立面空间相关数据源
|
|
/// </summary>
|
|
/// </summary>
|
|
- private SpaceData VerticalSpaces { get; set; }
|
|
|
|
public void InitVerticalSpaces()
|
|
public void InitVerticalSpaces()
|
|
{
|
|
{
|
|
- var spaceDatas = SpaceComputerDataUtil.GetSpaceDataByType(SpaceRelatedEnum.Crossing);// DrawDataServer.GetSpaceData(SpaceRelatedEnum.Crossing);
|
|
|
|
- this.VerticalSpaces = spaceDatas;
|
|
|
|
- InitVSpaceTree();
|
|
|
|
|
|
+ var spaceData = SpaceComputerDataUtil.GetSpaceDataByType(SpaceRelatedEnum.Crossing);
|
|
|
|
+ InitVSpaceTree(spaceData.FloorDatas);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 绘制立面空间
|
|
/// 绘制立面空间
|
|
@@ -81,33 +57,54 @@ namespace SAGA.GplotDrawData
|
|
{
|
|
{
|
|
if (node == null)
|
|
if (node == null)
|
|
return;
|
|
return;
|
|
- var spaceDatas = VerticalSpaces;
|
|
|
|
VirticalSpaceGraphView view = new VirticalSpaceGraphView();
|
|
VirticalSpaceGraphView view = new VirticalSpaceGraphView();
|
|
view.SpaceType = node.Sno;
|
|
view.SpaceType = node.Sno;
|
|
- var db = view.CreateDb(spaceDatas);
|
|
|
|
|
|
+ var db = view.CreateDb(node.GetData<BuildingItem>());
|
|
ConstData.ResponseData = db.CreateJObjectGroup();
|
|
ConstData.ResponseData = db.CreateJObjectGroup();
|
|
ucShowElement.Show(WebGplotSettings.VSpaceUrl);
|
|
ucShowElement.Show(WebGplotSettings.VSpaceUrl);
|
|
}
|
|
}
|
|
- public void InitVSpaceTree()
|
|
|
|
|
|
+ public void InitVSpaceTree(List<FloorSpaceData> floorItems)
|
|
{
|
|
{
|
|
- List<DataNode> dataNode = new List<DataNode>();
|
|
|
|
-
|
|
|
|
- dataNode.Add(new DataNode() { EName = "楼梯间",Sno="140" });
|
|
|
|
- dataNode.Add(new DataNode() { EName = "中庭", Sno = "150" });
|
|
|
|
- dataNode.Add(new DataNode() { EName = "竖井", Sno = "1B0" });
|
|
|
|
- dataNode.Add(new DataNode() { EName = "其他公共区域", Sno = "1A0" });
|
|
|
|
- this.rootNode.ItemsSource = dataNode;
|
|
|
|
- }
|
|
|
|
|
|
+ List<DataNode> treeData = new List<DataNode>();
|
|
|
|
+ var buildGroup = floorItems.GroupBy(f => f.BuildingId);
|
|
|
|
+ foreach (var build in buildGroup)
|
|
|
|
+ {
|
|
|
|
+ var tempFloors = build.ToList();
|
|
|
|
+ var firstFloor = tempFloors.FirstOrDefault();
|
|
|
|
+ if (firstFloor == null)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ BuildingItem buildItem = new BuildingItem();
|
|
|
|
+ buildItem.Id = firstFloor.BuildingId;
|
|
|
|
+ buildItem.Name = firstFloor.BuildingName;
|
|
|
|
+ buildItem.FloorDataItems.AddRange(tempFloors);
|
|
|
|
+ var items = tempFloors.Select(f => f.LevelName).ToList();
|
|
|
|
+ //items.Reverse();
|
|
|
|
+ buildItem.Levels.AddRange(items);
|
|
|
|
+ var buildNode = new DataNode() {EName = firstFloor.BuildingName, Sno = firstFloor.BuildingId};
|
|
|
|
+ buildNode.Childrens.Add(new DataNode() { EName = "楼梯间", Sno = "140" });
|
|
|
|
+ buildNode.Childrens.Add(new DataNode() { EName = "中庭", Sno = "150" });
|
|
|
|
+ buildNode.Childrens.Add(new DataNode() { EName = "竖井", Sno = "1B0" });
|
|
|
|
+ buildNode.Childrens.Add(new DataNode() { EName = "其他公共区域", Sno = "1A0" });
|
|
|
|
+ buildNode.Childrens.ForEach(dn => dn.SetData(buildItem));
|
|
|
|
+ treeData.Add(buildNode);
|
|
|
|
+ }
|
|
|
|
+ this.rootNode.ItemsSource = treeData;
|
|
|
|
+ }
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
|
private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
|
{
|
|
{
|
|
if (rootNode.SelectedItem is DataNode ln)
|
|
if (rootNode.SelectedItem is DataNode ln)
|
|
{
|
|
{
|
|
- if (m_showType == GplotShowType.ViewPlan)
|
|
|
|
|
|
+ if (ln.Childrens.Count != 0)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (ShowType == GplotShowType.ViewPlan)
|
|
{
|
|
{
|
|
- if (ln.GetData<FloorSpaceData>() is FloorSpaceData fd)
|
|
|
|
- Draw(fd);
|
|
|
|
|
|
+ Draw(ln);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -117,66 +114,67 @@ namespace SAGA.GplotDrawData
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- void Draw(FloorSpaceData fd)
|
|
|
|
|
|
+ #region 平面处理
|
|
|
|
+ private void Draw(DataNode dataNode)
|
|
{
|
|
{
|
|
|
|
+ var fd = dataNode.GetData<FloorSpaceData>();
|
|
|
|
+ if (fd == null)
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("楼层数据不存在");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
SpaceGraphView view = new SpaceGraphView();
|
|
SpaceGraphView view = new SpaceGraphView();
|
|
var db = view.CreateDb(fd);
|
|
var db = view.CreateDb(fd);
|
|
ConstData.ResponseData = db.CreateJObjectGroup();
|
|
ConstData.ResponseData = db.CreateJObjectGroup();
|
|
- ucShowElement.Show(WebGplotSettings.GplotUrl);
|
|
|
|
|
|
+ ucShowElement.Show(WebGplotSettings.GplotUrl);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- private DataNode GetSpaceData()
|
|
|
|
|
|
+ private void InitHSpaceTree()
|
|
{
|
|
{
|
|
- var aData = SpaceComputerDataUtil.GetSpaceDataByType(SpaceRelatedEnum.Adjacent);
|
|
|
|
- var tData = SpaceComputerDataUtil.GetSpaceDataByType(SpaceRelatedEnum.Crossing);
|
|
|
|
-
|
|
|
|
- var vData = SpaceComputerDataUtil.GetSpaceDataByType(SpaceRelatedEnum.Ventilation);
|
|
|
|
- var rData = SpaceComputerDataUtil.GetSpaceDataByType(SpaceRelatedEnum.Radiation);
|
|
|
|
- DataNode root = new DataNode("空间关系");
|
|
|
|
- DataNode a = new DataNode("空间临接关系")
|
|
|
|
|
|
+ /*
|
|
|
|
+ * 层级结构:(建筑名称--空间关系)--四种关系--楼层
|
|
|
|
+ */
|
|
|
|
+ var buildNodes = new List<DataNode>();
|
|
|
|
+ Dictionary<SpaceRelatedEnum, string> seeds = new Dictionary<SpaceRelatedEnum, string>();
|
|
|
|
+ seeds[SpaceRelatedEnum.Adjacent] = "空间临接关系";
|
|
|
|
+ seeds[SpaceRelatedEnum.Crossing] = "建筑交通关系";
|
|
|
|
+ seeds[SpaceRelatedEnum.Ventilation] = "空气流通关系";
|
|
|
|
+ seeds[SpaceRelatedEnum.Radiation] = "光照辐射关系";
|
|
|
|
+ foreach (var seed in seeds)
|
|
{
|
|
{
|
|
- Childrens = aData.FloorDatas.Reverse<FloorSpaceData>().Select(f =>
|
|
|
|
|
|
+ var spaceDatas = SpaceComputerDataUtil.GetSpaceDataByType(seed.Key);
|
|
|
|
+ var floorItems = spaceDatas.FloorDatas;
|
|
|
|
+ var buildGroup = floorItems.GroupBy(f => f.BuildingId);
|
|
|
|
+ foreach (var build in buildGroup)
|
|
{
|
|
{
|
|
- var dn = new DataNode(f.Name);
|
|
|
|
- dn.SetData(f);
|
|
|
|
- return dn;
|
|
|
|
- }).ToList()
|
|
|
|
- };
|
|
|
|
|
|
+ var buildFloors = build.ToList();
|
|
|
|
+ var firstFloor = buildFloors.FirstOrDefault();
|
|
|
|
+ if (firstFloor == null)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- DataNode t = new DataNode("建筑交通关系")
|
|
|
|
- {
|
|
|
|
- Childrens = tData.FloorDatas.Reverse<FloorSpaceData>().Select(f =>
|
|
|
|
- {
|
|
|
|
- var dn = new DataNode(f.Name);
|
|
|
|
- dn.SetData(f);
|
|
|
|
- return dn;
|
|
|
|
- }).ToList()
|
|
|
|
- };
|
|
|
|
- DataNode v = new DataNode("空气流通关系")
|
|
|
|
- {
|
|
|
|
- Childrens = vData.FloorDatas.Reverse<FloorSpaceData>().Select(f =>
|
|
|
|
- {
|
|
|
|
- var dn = new DataNode(f.Name);
|
|
|
|
- dn.SetData(f);
|
|
|
|
- return dn;
|
|
|
|
- }).ToList()
|
|
|
|
- };
|
|
|
|
- DataNode r = new DataNode("光照辐射关系")
|
|
|
|
- {
|
|
|
|
- Childrens = rData.FloorDatas.Reverse<FloorSpaceData>().Select(f =>
|
|
|
|
- {
|
|
|
|
- var dn = new DataNode(f.Name);
|
|
|
|
- dn.SetData(f);
|
|
|
|
- return dn;
|
|
|
|
- }).ToList()
|
|
|
|
- };
|
|
|
|
- root.Childrens.AddRange(new List<DataNode>() { a, t, v, r });
|
|
|
|
- return root;
|
|
|
|
- }
|
|
|
|
- /// <summary>
|
|
|
|
- /// 外部命令启动计算
|
|
|
|
- /// </summary>
|
|
|
|
- public Action ComputerAction;
|
|
|
|
|
|
+ #region 检测建筑节点
|
|
|
|
+ var buildNode = buildNodes.FirstOrDefault(dn => dn.Sno == build.Key);
|
|
|
|
+ if (buildNode == null)
|
|
|
|
+ {
|
|
|
|
+ buildNode = new DataNode() { EName = $"[{firstFloor.BuildingName}]--空间关系", Sno = firstFloor.BuildingId };
|
|
|
|
+ buildNodes.Add(buildNode);
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+ DataNode relationNode = new DataNode(seed.Value)
|
|
|
|
+ {
|
|
|
|
+ Childrens = buildFloors.Reverse<FloorSpaceData>().Select(f =>
|
|
|
|
+ {
|
|
|
|
+ var floorNode = new DataNode(f.Name);
|
|
|
|
+ floorNode.SetData(f);
|
|
|
|
+ return floorNode;
|
|
|
|
+ }).ToList()
|
|
|
|
+ };
|
|
|
|
+ buildNode?.Childrens.Add(relationNode);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.rootNode.ItemsSource = buildNodes;
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
}
|
|
}
|
|
}
|
|
}
|