public DiagramMouseManager(Diagram diagram) { _diagram = diagram; _currentResizeDirection = ResizeDirection.None; _leftButtonAction = MouseAction.None; _rightButtonAction = MouseAction.None; _leftButtonDown = false; _rightButtonDown = false; _leftButtonDownMousePosition = null; _currentMousePosition = null; _leftButtonDownMousePosition = null; _itemUnderCursor = null; _baseXViewOffset = 0; _baseYViewOffset = 0; _offsetWorker = null; Selector = null; }
public DiagramUpdateLock(Diagram diagram) { _diagram = diagram; _diagram.LockRecalc = true; _diagram.LockRender = true; }
public DiagramSerializer(Diagram diagram) { if (diagram == null) throw new ArgumentNullException("Diagram"); _diagram = diagram; }
public Project() { _diagram = null; _network = null; _path = ""; _linkMenu = new LinkContextMenu(); _nodeMenu = new NodeContextMenu(); }
internal DiagramItem(Diagram diagram) { _diagram = diagram; _label = null; _drawer = null; _geometry = null; _border = null; NeedRecalc = true; IsSelectable = true; }
public DiagramLabel(Diagram diagram, DiagramItem owner) : base(diagram) { Drawer = new BaseLabelDrawer(); _owner = owner; BorderPen = new Pen(new SolidColorBrush(Colors.Transparent), 0); AllowInPlaceEdit = true; IsSelectable = false; }
public DiagramNode(Diagram diagram) : base(diagram) { _label = new DiagramLabel(diagram, this); _label.NeedRecalc = true; _edges = new DiagramItemCollection<DiagramEdge>(diagram); IsUnderCursor = false; if (!diagram.Nodes.Contains(this)) diagram.Nodes.Add(this); }
public DiagramEdge(Diagram diagram) : base(diagram) { _sourceNode = null; _destinationNode = null; Background = new SolidColorBrush((BorderPen.Brush as SolidColorBrush).Color); _label = new DiagramLabel(diagram, this); _label.NeedRecalc = true; if (!diagram.Edges.Contains(this)) diagram.Edges.Add(this); }
protected void DrawBUC(Diagram diagram, DrawingContext dc, Rect rect) { //rect = GeometryTranslater.OffsetRect(rect, diagram.Offset, diagram.Scale); var topLeft = rect.TopLeft; topLeft.Offset(-GlobalData.BUCOffset, -GlobalData.BUCOffset); dc.DrawLine(GlobalData.BUCPen, topLeft, new Point(topLeft.X, topLeft.Y + GlobalData.BUCWingRelativeLength * rect.Height)); dc.DrawLine(GlobalData.BUCPen, topLeft, new Point(topLeft.X + GlobalData.BUCWingRelativeLength * rect.Width, topLeft.Y)); var topRight = rect.TopRight; topRight.Offset(GlobalData.BUCOffset, -GlobalData.BUCOffset); dc.DrawLine(GlobalData.BUCPen, new Point(topRight.X - GlobalData.BUCWingRelativeLength * rect.Width, topRight.Y), topRight); dc.DrawLine(GlobalData.BUCPen, topRight, new Point(topRight.X, topRight.Y + GlobalData.BUCWingRelativeLength * rect.Height)); var bottomRight = rect.BottomRight; bottomRight.Offset(GlobalData.BUCOffset, GlobalData.BUCOffset); dc.DrawLine(GlobalData.BUCPen, new Point(bottomRight.X, bottomRight.Y - GlobalData.BUCWingRelativeLength * rect.Height), bottomRight); dc.DrawLine(GlobalData.BUCPen, bottomRight, new Point(bottomRight.X - GlobalData.BUCWingRelativeLength * rect.Width, bottomRight.Y)); var bottomLeft = rect.BottomLeft; bottomLeft.Offset(-GlobalData.BUCOffset, GlobalData.BUCOffset); dc.DrawLine(GlobalData.BUCPen, new Point(bottomLeft.X + GlobalData.BUCWingRelativeLength * rect.Width, bottomLeft.Y), bottomLeft); dc.DrawLine(GlobalData.BUCPen, bottomLeft, new Point(bottomLeft.X, bottomLeft.Y - GlobalData.BUCWingRelativeLength * rect.Height)); }
protected void DrawSelectionBorder(Diagram diagram, DrawingContext dc, DiagramSelectionBorder border) { if (border == null) return; for (var i = 0; i < border.ResizeInfos.Count; i++) { var curInfo = border.ResizeInfos[i]; var prevPointIndex = i != 0 ? i - 1 : border.ResizeInfos.Count - 1; var prevInfo = border.ResizeInfos[prevPointIndex]; if (!curInfo.Point.HasValue || !prevInfo.Point.HasValue) continue; if (border.IsLinked) dc.DrawLine(GlobalData.BorderPen, curInfo.Point.Value, prevInfo.Point.Value);//GeometryTranslater.OffsetPoint(, diagram.Offset, diagram.Scale), GeometryTranslater.OffsetPoint(prevInfo.Point.Value, diagram.Offset, diagram.Scale)); var resizeRect = curInfo.Rect; if (!resizeRect.HasValue) continue; if (curInfo.ResizeDirection != ResizeDirection.None) dc.DrawRectangle(GlobalData.BorderBrush, GlobalData.BorderPen, resizeRect.Value);//GeometryTranslater.OffsetRect(resizeRect.Value, diagram.Offset, diagram.Scale)); } }
public static Size ToViewSize(this Size size, Diagram diagram) { return new Size(size.Width, size.Height); }
public static Rect ToViewRect(this Rect rect, Diagram diagram) { return new Rect(rect.X + diagram.XViewOffset, rect.Y + diagram.YViewOffset, rect.Width, rect.Height); }
public static Point ToViewPoint(this Point point, Diagram diagram) { return new Point(point.X + diagram.XViewOffset, point.Y + diagram.YViewOffset); }
public static DiagramItem FindItemByUserData(Diagram diagram, int id) { DiagramItem result = null; foreach (var node in diagram.Nodes) { int parseResult; if (Int32.TryParse(node.UserData, out parseResult) == true) { if (parseResult == id) { result = node; break; } } } foreach (var edge in diagram.Edges) { int parseResult; if (Int32.TryParse(edge.UserData, out parseResult) == true) { if (parseResult == id) { result = edge; break; } } } return result; }
/// <summary> /// Новый проект /// </summary> public void NewProject() { Diagram = new Diagram(); Network = new TalesNetwork(); Path = ""; _linkMenu.Network = Network; _nodeMenu.Network = Network; }
public DiagramRecalcLock(Diagram diagram) { _diagram = diagram; _diagram.LockRecalc = true; }
protected virtual void SetDiagram(Diagram value) { _diagram = value; }
public EdgeEventArgs(Diagram diagram, DiagramEdge edge) : base(diagram) { Edge = edge; }
public DiagramEventArgs(Diagram diagram) { Diagram = diagram; }
public LabelEventArgs(Diagram diagram, DiagramLabel label) : base(diagram) { Label = label; }
public DiagramSerializer(Diagram diagram) { _diagram = diagram; }
public DiagramRenderLock(Diagram diagram) { _diagram = diagram; _diagram.LockRender = true; }