public void InsertNode(GraphNodeKind k) { GoObject n = new GraphNode(k); n.Position = NextNodePosition(); StartTransaction(); Add(n); FinishTransaction("Insert Node"); }
public GraphNode(GraphNodeKind k, string language) { InitCommon(); this.Kind = k; }
public GraphNode(GraphNodeKind k) { InitCommon(); this.Kind = k; }
protected virtual void OnKindChanged(GraphNodeKind oldkind, GraphNodeKind newkind) { // update the parts, based on the Kind of node this now is Color first = Color.FromArgb(70, 174, 250); Color second = Color.FromArgb(214, 225, 235); switch (newkind) { //TestKind case GraphNodeKind.TestKind: { //this.Text = "TestKind"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_TestKind"); this.Background = new GoDrawing(GoFigure.RoundedRectangle); this.Shape.FillShapeHighlight(Color.Green); this.TopLeftMargin = new SizeF(10, 5); this.BottomRightMargin = new SizeF(10, 5); UpdatePorts("", "o", "o", "o"); break; } case GraphNodeKind.Start: { //this.Text = "Start"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Start"); this.Background = new GoDrawing(GoFigure.RoundedRectangle); this.Shape.FillShapeHighlight(Color.Green); this.TopLeftMargin = new SizeF(10, 5); this.BottomRightMargin = new SizeF(10, 5); UpdatePorts("", "o", "o", "o"); break; } case GraphNodeKind.End: { //this.Text = "End"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_End"); this.Background = new GoDrawing(GoFigure.RoundedRectangle); this.Shape.FillShapeHighlight(Color.DarkRed); this.TopLeftMargin = new SizeF(10, 5); this.BottomRightMargin = new SizeF(10, 5); UpdatePorts("i", "i", "", "i"); break; } case GraphNodeKind.Step: { //this.Text = "Step"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Step"); this.Background = new GoDrawing(GoFigure.Rectangle); this.Shape.FillShapeHighlight(first, second); this.TopLeftMargin = new SizeF(10, 5); this.BottomRightMargin = new SizeF(10, 5); UpdatePorts("io", "io", "io", "io"); break; } case GraphNodeKind.Input: { //this.Text = "Input"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Input"); this.Background = new GoDrawing(GoFigure.Input); this.Shape.FillShapeHighlight(first, second); this.TopLeftMargin = new SizeF(20, 4); this.BottomRightMargin = new SizeF(20, 4); UpdatePorts("io", "io", "io", "io"); break; } case GraphNodeKind.Output: { //this.Text = "Output"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Output"); this.Background = new GoDrawing(GoFigure.Output); this.Shape.FillShapeHighlight(first, second); this.TopLeftMargin = new SizeF(20, 4); this.BottomRightMargin = new SizeF(20, 4); UpdatePorts("io", "io", "io", "io"); break; } case GraphNodeKind.Decision: { this.Text = "?"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Decision"); this.Background = new GoDrawing(GoFigure.Decision); this.Shape.FillShapeHighlight(first, second); this.TopLeftMargin = new SizeF(35, 20); this.BottomRightMargin = new SizeF(35, 20); UpdatePorts("i", "io", "o", "io"); break; } case GraphNodeKind.Read: { this.Text = "Read"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Read"); this.Background = new GoDrawing(GoFigure.Ellipse); this.Shape.FillEllipseGradient(first, Color.White); this.Shape.BrushPoint = new PointF(.3f, .3f); this.TopLeftMargin = new SizeF(20, 10); this.BottomRightMargin = new SizeF(20, 10); UpdatePorts("io", "io", "io", "io"); break; } case GraphNodeKind.Write: { this.Text = "Write"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Write"); this.Background = new GoDrawing(GoFigure.Ellipse); this.Shape.FillEllipseGradient(first, Color.White); this.Shape.BrushPoint = new PointF(.3f, .3f); this.TopLeftMargin = new SizeF(20, 10); this.BottomRightMargin = new SizeF(20, 10); UpdatePorts("io", "io", "io", "io"); break; } case GraphNodeKind.ManualOperation: { this.Text = "Manual \nOperation"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_ManualOperation"); this.Background = new GoDrawing(GoFigure.ManualOperation); this.Shape.FillShapeHighlight(first, second); this.TopLeftMargin = new SizeF(20, 10); this.BottomRightMargin = new SizeF(20, 10); UpdatePorts("io", "io", "io", "io"); break; } case GraphNodeKind.Database: { this.Text = "Database"; this.Text = SelectionLanguage.ResourceCulture.GetString("GraphNode_Database"); this.Background = new GoDrawing(GoFigure.Database); this.Shape.FillShapeHighlight(first, second); this.Shape.BrushPoint = new PointF(.15f, .55f); this.Shape.BrushFocusScales = new SizeF(.1f, .1f); this.TopLeftMargin = new SizeF(10, 30); this.BottomRightMargin = new SizeF(10, 15); UpdatePorts("io", "io", "io", "io"); break; } default: throw new InvalidEnumArgumentException("newkind", (int)newkind, typeof(GraphNodeKind)); } }