public EdgeBreak(MyPoint position, EdgePart beforeEdgePart, EdgePart afterEdgePart, Graph graph) { this.Position = position; this.BeforeEdgePart = beforeEdgePart; this.AfterEdgePart = afterEdgePart; this.graph = graph; normalBrush = Brushes.Transparent; hoverBrush = Brushes.Red; UIEllipse = new Ellipse { Margin = new Thickness(position.X - 3, position.Y - 3, 0, 0), Width = 5, Height = 5, Fill = normalBrush, Stroke = normalBrush, StrokeThickness = 1 }; UIEllipse.MouseEnter += onMouseEnter; UIEllipse.MouseLeave += onMouseLeave; UIEllipse.MouseDown += onMouseDown; IsSelected = false; }
private void onPositionChanged(double lastX, double lastY) { foreach (Edge edge in edges) { int lastIndex = edge.EdgeParts.Count - 1; EdgePart firstPart = edge.EdgeParts[0]; EdgePart lastPart = edge.EdgeParts[lastIndex]; if (edge.HeadConnection.Node == this) { firstPart.UILine.X1 += Position.X - lastX; firstPart.UILine.Y1 += Position.Y - lastY; } if (edge.TailConnection.Node == this) { lastPart.UILine.X2 += Position.X - lastX; lastPart.UILine.Y2 += Position.Y - lastY; } edge.UpdateLabels(); edge.UpdateStructure(); } foreach (NodeConnection nodeConnection in NodeConnections) { nodeConnection.Update(); } }
public void SelectedgePart(EdgePart edgePart) { ClearSelection(); edgePart.IsSelected = true; edgePart.Edge.IsSelected = true; SelectedEdgePart = edgePart; SelectionChanged(); }
public EdgeLabel(string text, EdgePart edgepart) { this.EdgePart = edgepart; UITextBlock = new TextBlock(); UITextBlock.Text = text; Percent = 0.1; Distance = 3; Graph graph = edgepart.Edge.HeadConnection.Node.Graph; graph.UICanvas.Children.Add(UITextBlock); Update(); }