2021-07-23 09:42:22 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2023-02-12 21:30:16 +08:00
|
|
|
|
using System.ComponentModel;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2023-02-10 18:49:02 +08:00
|
|
|
|
using System.Windows.Controls;
|
2022-10-28 22:45:39 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner;
|
2023-02-10 18:49:02 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
2023-02-02 23:00:36 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner.Models;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2022-10-28 22:45:39 +08:00
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
2023-02-12 21:30:16 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// DefaultGroup
|
|
|
|
|
|
/// </summary>
|
2021-07-23 09:42:22 +08:00
|
|
|
|
public class GroupDesignerItemViewModel : DesignerItemViewModelBase
|
|
|
|
|
|
{
|
2023-01-27 14:54:03 +08:00
|
|
|
|
public GroupDesignerItemViewModel() : this(null)
|
|
|
|
|
|
{
|
2023-02-10 18:49:02 +08:00
|
|
|
|
|
2023-01-27 14:54:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public GroupDesignerItemViewModel(IDiagramViewModel root) : base(root)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
2023-01-26 22:25:48 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-02 23:00:36 +08:00
|
|
|
|
public GroupDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public GroupDesignerItemViewModel(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-25 11:59:31 +08:00
|
|
|
|
protected override void Init(IDiagramViewModel root, bool initNew)
|
2023-01-26 22:25:48 +08:00
|
|
|
|
{
|
2023-03-25 11:59:31 +08:00
|
|
|
|
base.Init(root, initNew);
|
2023-01-26 22:25:48 +08:00
|
|
|
|
|
2023-02-10 18:49:02 +08:00
|
|
|
|
this.IsGroup = true;
|
2023-01-27 21:29:42 +08:00
|
|
|
|
this.IsHitTestVisible = true;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-25 11:59:31 +08:00
|
|
|
|
protected override void InitNew()
|
2023-01-26 22:25:48 +08:00
|
|
|
|
{
|
2023-03-25 11:59:31 +08:00
|
|
|
|
this.ClearConnectors();
|
2023-01-26 22:25:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-23 09:42:22 +08:00
|
|
|
|
protected override void ExecuteEditCommand(object param)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2023-02-02 23:00:36 +08:00
|
|
|
|
|
2023-02-10 18:49:02 +08:00
|
|
|
|
public void Resize()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.Root == null) return;
|
|
|
|
|
|
|
|
|
|
|
|
var items = this.Root.Items.Where(p => p.ParentId == Id).OfType<DesignerItemViewModelBase>();
|
|
|
|
|
|
RectangleBase rect = DiagramViewModelHelper.GetBoundingRectangle(items);
|
|
|
|
|
|
|
|
|
|
|
|
this.ItemWidth = rect.Width;
|
|
|
|
|
|
this.ItemHeight = rect.Height;
|
|
|
|
|
|
this.Left = rect.Left;
|
|
|
|
|
|
this.Top = rect.Top;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddItem(DesignerItemViewModelBase item)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.Root == null) return;
|
|
|
|
|
|
|
|
|
|
|
|
item.ParentId = Id;
|
|
|
|
|
|
if (item.ZIndex > this.ZIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
var zindex = item.ZIndex;
|
|
|
|
|
|
item.ZIndex = this.ZIndex;
|
|
|
|
|
|
this.ZIndex = zindex;
|
|
|
|
|
|
}
|
|
|
|
|
|
Resize();
|
|
|
|
|
|
}
|
2023-02-02 23:00:36 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打标记使用
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool Custom
|
|
|
|
|
|
{
|
|
|
|
|
|
get;set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|