mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-12 20:26:35 +08:00
线条文本可以保存了
This commit is contained in:
@@ -18,8 +18,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
}
|
||||
|
||||
public ConnectorViewModel(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo, DrawMode vectorLineDrawMode)
|
||||
public ConnectorViewModel(IDiagramViewModel parent, FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo, DrawMode vectorLineDrawMode)
|
||||
{
|
||||
Parent = parent;
|
||||
VectorLineDrawMode = vectorLineDrawMode;
|
||||
Init(sourceConnectorInfo, sinkConnectorInfo);
|
||||
}
|
||||
@@ -126,10 +127,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
private set
|
||||
{
|
||||
Rect oldarea = _area;
|
||||
if (SetProperty(ref _area, value))
|
||||
{
|
||||
UpdateConnectionPoints();
|
||||
OutTextItemLocation(_area, value);
|
||||
OutTextItemLocation(oldarea, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,6 +141,17 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; set;
|
||||
}
|
||||
|
||||
public virtual Dictionary<string, string> PropertiesSetting
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Dictionary<string, string>()
|
||||
{
|
||||
{ "Text","文本" },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public ConnectorInfo ConnectorInfo(ConnectorOrientation orientation, double left, double top, double width, double height, Point position)
|
||||
{
|
||||
|
||||
@@ -256,6 +269,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
this.SinkConnectorInfo = sinkConnectorInfo;
|
||||
DeleteConnectionCommand = new SimpleCommand(DeleteConnection);
|
||||
|
||||
if (Parent != null && Parent.ColorViewModel != null)
|
||||
{
|
||||
this.ColorViewModel = CopyHelper.Mapper(Parent.ColorViewModel);
|
||||
}
|
||||
if (sinkConnectorInfo is FullyCreatedConnectorInfo sink && sink.DataItem.ShowArrow == false)
|
||||
{
|
||||
this.ColorViewModel.RightArrowPathStyle = ArrowPathStyle.None;
|
||||
|
||||
@@ -32,7 +32,12 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; set;
|
||||
}
|
||||
|
||||
public DrawMode? VectorLineDrawMode
|
||||
public IDrawModeViewModel DrawModeViewModel
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public IColorViewModel ColorViewModel
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public class FullyCreatedConnectorInfo : ConnectorInfoBase
|
||||
{
|
||||
|
||||
|
||||
private List<CinchMenuItem> menuOptions;
|
||||
|
||||
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint=false, ValueTypePoint valueTypePoint = 0)
|
||||
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, ValueTypePoint valueTypePoint = 0)
|
||||
: base(orientation)
|
||||
{
|
||||
this.DataItem = dataItem;
|
||||
@@ -66,7 +66,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
menuOptions.Add(delete);
|
||||
}
|
||||
|
||||
public DesignerItemViewModelBase DataItem { get; private set; }
|
||||
public DesignerItemViewModelBase DataItem
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private bool _showConnectors = false;
|
||||
public bool ShowConnectors
|
||||
@@ -77,14 +80,17 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _showConnectors, value);
|
||||
SetProperty(ref _showConnectors, value);
|
||||
}
|
||||
}
|
||||
|
||||
private double _xRatio;
|
||||
public double XRatio
|
||||
{
|
||||
get { return _xRatio; }
|
||||
get
|
||||
{
|
||||
return _xRatio;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _xRatio, value);
|
||||
@@ -94,29 +100,50 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
private double _yRatio;
|
||||
public double YRatio
|
||||
{
|
||||
get { return _yRatio; }
|
||||
get
|
||||
{
|
||||
return _yRatio;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _yRatio, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsInnerPoint { get; set; }
|
||||
public bool IsInnerPoint
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public ValueTypePoint _valueTypePoint;
|
||||
public ValueTypePoint ValueTypePoint
|
||||
{
|
||||
get { return _valueTypePoint; }
|
||||
get
|
||||
{
|
||||
return _valueTypePoint;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _valueTypePoint, value);
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleCommand DeleteCommand { get; private set; }
|
||||
public SimpleCommand MenuItemCommand { get; private set; }
|
||||
public SimpleCommand DeleteCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand MenuItemCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public IEnumerable<CinchMenuItem> MenuOptions { get { return menuOptions; } }
|
||||
public IEnumerable<CinchMenuItem> MenuOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
return menuOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,59 +11,190 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public interface IDiagramViewModel
|
||||
{
|
||||
string Name { get; set; }
|
||||
List<SelectableDesignerItemViewModelBase> SelectedItems { get; }
|
||||
ObservableCollection<SelectableDesignerItemViewModelBase> Items { get; }
|
||||
SelectionService SelectionService { get; }
|
||||
string Name
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
List<SelectableDesignerItemViewModelBase> SelectedItems
|
||||
{
|
||||
get;
|
||||
}
|
||||
ObservableCollection<SelectableDesignerItemViewModelBase> Items
|
||||
{
|
||||
get;
|
||||
}
|
||||
SelectionService SelectionService
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand CreateNewDiagramCommand { get; }
|
||||
SimpleCommand DirectAddItemCommand { get; }
|
||||
SimpleCommand AddItemCommand { get; }
|
||||
SimpleCommand RemoveItemCommand { get; }
|
||||
SimpleCommand DirectRemoveItemCommand { get; }
|
||||
SimpleCommand ClearSelectedItemsCommand { get; }
|
||||
SimpleCommand AlignTopCommand { get; }
|
||||
SimpleCommand AlignVerticalCentersCommand { get; }
|
||||
SimpleCommand AlignBottomCommand { get; }
|
||||
SimpleCommand AlignLeftCommand { get; }
|
||||
SimpleCommand AlignHorizontalCentersCommand { get; }
|
||||
SimpleCommand AlignRightCommand { get; }
|
||||
SimpleCommand BringForwardCommand { get; }
|
||||
SimpleCommand BringToFrontCommand { get; }
|
||||
SimpleCommand SendBackwardCommand { get; }
|
||||
SimpleCommand SendToBackCommand { get; }
|
||||
SimpleCommand CreateNewDiagramCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand DirectAddItemCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AddItemCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand RemoveItemCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand DirectRemoveItemCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand ClearSelectedItemsCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AlignTopCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AlignVerticalCentersCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AlignBottomCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AlignLeftCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AlignHorizontalCentersCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand AlignRightCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand BringForwardCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand BringToFrontCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand SendBackwardCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand SendToBackCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand DistributeHorizontalCommand { get; }
|
||||
SimpleCommand DistributeVerticalCommand { get; }
|
||||
SimpleCommand SelectAllCommand { get; }
|
||||
SimpleCommand UndoCommand { get; }
|
||||
SimpleCommand RedoCommand { get; }
|
||||
SimpleCommand DistributeHorizontalCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand DistributeVerticalCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand SelectAllCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand UndoCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand RedoCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
Func<SelectableDesignerItemViewModelBase, bool> OutAddVerify { get; set; }
|
||||
Func<SelectableDesignerItemViewModelBase, bool> OutAddVerify
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
void ClearSelectedItems();
|
||||
bool BelongToSameGroup(IGroupable item1, IGroupable item2);
|
||||
Rect GetBoundingRectangle(IEnumerable<DesignerItemViewModelBase> items);
|
||||
void UpdateZIndex();
|
||||
|
||||
bool IsReadOnly{ get; set; }
|
||||
bool IsLoading{get;set;}
|
||||
Size PageSize { get; set; }
|
||||
PageSizeType PageSizeType { get; set; }
|
||||
bool ShowGrid { get; set; }
|
||||
Size GridCellSize { get; set; }
|
||||
PageSizeOrientation PageSizeOrientation { get; set; }
|
||||
CellHorizontalAlignment CellHorizontalAlignment { get; set; }
|
||||
CellVerticalAlignment CellVerticalAlignment { get; set; }
|
||||
double GridMargin { get; set; }
|
||||
Color GridColor { get; set; }
|
||||
DiagramType DiagramType { get; set; }
|
||||
bool IsReadOnly
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
bool IsLoading
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
Size PageSize
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
PageSizeType PageSizeType
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
bool ShowGrid
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
Size GridCellSize
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
PageSizeOrientation PageSizeOrientation
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
CellHorizontalAlignment CellHorizontalAlignment
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
CellVerticalAlignment CellVerticalAlignment
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
double GridMargin
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
Color GridColor
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
DiagramType DiagramType
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
Point CurrentPoint { get; set; }
|
||||
Color CurrentColor { get; set; }
|
||||
//如果这个赋值了,优先用这个的
|
||||
DrawMode? VectorLineDrawMode { get; set; }
|
||||
Point CurrentPoint
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
Color CurrentColor
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
#region 如果这个赋值了,优先用这个的
|
||||
IDrawModeViewModel DrawModeViewModel
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
IColorViewModel ColorViewModel
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
#endregion
|
||||
//用于wpf大小与物理像素之间转换
|
||||
double ScreenScale { get; set; }
|
||||
double ScreenScale
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
void SetScreenScale();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user