|
@@ -5,6 +5,7 @@ using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
+using System.Windows.Documents;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Shapes;
|
|
@@ -16,6 +17,7 @@ using Point = System.Windows.Point;
|
|
|
using System.Windows.Media.Animation;
|
|
|
using System.Windows.Threading;
|
|
|
using Autodesk.Revit.UI;
|
|
|
+using SAGA.DotNetUtils.WPF;
|
|
|
using SAGA.MBI.DataArrange;
|
|
|
using SAGA.MBI.Model;
|
|
|
using SAGA.MBI.WinView.ModeInfoMaintenance;
|
|
@@ -1003,20 +1005,20 @@ namespace SAGA.MBI.WinView.Space
|
|
|
if (lbSpaces.SelectedItems.Count == 0) return;
|
|
|
var space = lbSpaces.SelectedItems[0] as MISpace;
|
|
|
var bimId = space.BimID.Split(':')[1];
|
|
|
- foreach (var polyline in this.canvas.Children.OfType<WPolyline>())
|
|
|
+ foreach (var spaceELement in this.canvas.Children.OfType<SpaceElement>())
|
|
|
{
|
|
|
- if (polyline.Tag is Autodesk.Revit.DB.Mechanical.Space s)
|
|
|
+ if (spaceELement.Tag is Autodesk.Revit.DB.Mechanical.Space s)
|
|
|
{
|
|
|
if (s.Id.ToString() == (bimId))
|
|
|
{
|
|
|
- polyline.Fill = Brushes.Aquamarine;
|
|
|
+ spaceELement.Fill = Brushes.Aquamarine;
|
|
|
|
|
|
//显示属性窗口
|
|
|
ShowSpaceProperty(s);
|
|
|
}
|
|
|
- else if (polyline.Fill == Brushes.Aquamarine)
|
|
|
+ else if (spaceELement.Fill == Brushes.Aquamarine)
|
|
|
{
|
|
|
- polyline.Fill = Brushes.Transparent;
|
|
|
+ spaceELement.Fill = Brushes.Transparent;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1036,7 +1038,6 @@ namespace SAGA.MBI.WinView.Space
|
|
|
{
|
|
|
MRevitEquipBase equipment = DalCommon.GetEquipmentQueryId(space);
|
|
|
ShowSpaceProperty(equipment);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1072,22 +1073,37 @@ namespace SAGA.MBI.WinView.Space
|
|
|
var seg = mySegments.FirstOrDefault();
|
|
|
if (seg == null)
|
|
|
{
|
|
|
- MessageBox.Show(space.Id.IntegerValue + "");
|
|
|
return;
|
|
|
}
|
|
|
+ SpaceElement spaceElement = null;
|
|
|
+ for (int i = 0; i < mySegments.Count; i++)
|
|
|
+ {
|
|
|
+ var useSeg = mySegments[i];
|
|
|
+ List<Point> datas = new List<Point>();
|
|
|
+ foreach (BoundarySegment segment in useSeg)
|
|
|
+ {
|
|
|
+ datas.AddRange(segment.GetCurve().Tessellate().Select(xyz => xyz.ToW2DPoint()).ToList());
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- List<Point> datas = new List<Point>();
|
|
|
- foreach (BoundarySegment segment in seg)
|
|
|
+ datas = datas.Select(p => { return MovePoint(new Point(p.X, p.Y)); }).ToList();
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ spaceElement = new SpaceElement(datas);
|
|
|
+ }
|
|
|
+ else if (spaceElement!=null)
|
|
|
+ {
|
|
|
+ spaceElement.InPolygons.Add(new PointCollection(datas));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //var polyLine = this.CreateDefaultPolyLine(datas, Brushes.Transparent);
|
|
|
+ if (spaceElement != null)
|
|
|
{
|
|
|
- datas.AddRange(segment.GetCurve().Tessellate().Select(xyz => xyz.ToW2DPoint()).ToList());
|
|
|
+ spaceElement.Tag = space;//此处比较重要,这个是判断曲线是否为轮廓线的关键
|
|
|
+ spaceElement.Fill = Brushes.Transparent;
|
|
|
+ spaceElement.MouseLeftButtonDown +=Space_MouseDown;
|
|
|
+ this.canvas.Children.Add(spaceElement);
|
|
|
}
|
|
|
-
|
|
|
- var polyLine = this.CreateDefaultPolyLine(datas, Brushes.Transparent);
|
|
|
- polyLine.Tag = space;//此处比较重要,这个是判断曲线是否为轮廓线的关键
|
|
|
- polyLine.Fill = Brushes.Transparent;
|
|
|
-
|
|
|
- polyLine.MouseLeftButtonDown += PolyLine_MouseDown;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1095,19 +1111,17 @@ namespace SAGA.MBI.WinView.Space
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
- private void PolyLine_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
+ private void Space_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
{
|
|
|
- if ((sender is WPolyline line) && m_isDraw == null)
|
|
|
+ if ((sender is SpaceElement sapceElement) && m_isDraw == null)
|
|
|
{
|
|
|
//找到已亮显的空间
|
|
|
- var showSpaces = this.canvas.Children.OfType<WPolyline>().FirstOrDefault(t => t is WPolyline l && l.Fill == Brushes.Aquamarine);
|
|
|
+ var showSpaces = this.canvas.Children.OfType<SpaceElement>().FirstOrDefault(s => s.Fill == Brushes.Aquamarine);
|
|
|
|
|
|
//先清除
|
|
|
if (showSpaces != null) showSpaces.Fill = Brushes.Transparent;
|
|
|
- line.Fill = Brushes.Aquamarine;
|
|
|
- //MessageBox.Show(line.Tag+"");
|
|
|
-
|
|
|
- if (line.Tag is Autodesk.Revit.DB.Mechanical.Space space)
|
|
|
+ sapceElement.Fill = Brushes.Aquamarine;
|
|
|
+ if (sapceElement.Tag is Autodesk.Revit.DB.Mechanical.Space space)
|
|
|
{
|
|
|
//反选右侧树
|
|
|
for (int i = 0; i < lbSpaces.Items.Count; i++)
|
|
@@ -1120,10 +1134,7 @@ namespace SAGA.MBI.WinView.Space
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//显示属性板
|
|
|
-
|
|
|
-
|
|
|
ShowSpaceProperty(space);
|
|
|
}
|
|
|
}
|
|
@@ -1144,11 +1155,6 @@ namespace SAGA.MBI.WinView.Space
|
|
|
{
|
|
|
MoveElement(0.1, new Point());
|
|
|
}
|
|
|
-
|
|
|
- //创建定时器,以检测所有操作是否全部保存完成
|
|
|
- private DispatcherTimer timer;
|
|
|
-
|
|
|
-
|
|
|
private void CanvasDefaultTips()
|
|
|
{
|
|
|
string tips = "请选择一个需要进行空间管理的楼层";
|