private void CreateNode(Repo.INode node, Point position) { var vertex = new DataVertex(node.Name) { Node = node, VertexType = DataVertex.VertexTypeEnum.Node, Picture = node.Class.Shape }; var attributeInfos = node.Attributes.Select(x => new DataVertex.Attribute() { Name = x.Name, Type = x.Kind.ToString(), Value = x.StringValue }); attributeInfos.ToList().ForEach(x => vertex.Attributes.Add(x)); var vc = new VertexControl(vertex); vc.SetPosition(position); this.dataGraph.AddVertex(vertex); this.g_Area.AddVertex(vertex, vc); this.DrawNewVertex(vertex); }
private void DrawNewEdge(Repo.INode source, Repo.INode target) { ListBoxItem lbi = new ListBoxItem(); StackPanel sp = new StackPanel { Orientation = Orientation.Horizontal }; Image img = new Image() { Source = new BitmapImage(new Uri("pack://application:,,,/Pictures/Edge.png")) }; TextBlock spaces = new TextBlock { Text = " " }; TextBlock tx0 = new TextBlock { Text = source.Name }; TextBlock tx1 = new TextBlock { Text = " - " }; TextBlock tx2 = new TextBlock { Text = target.Name }; sp.Children.Add(img); sp.Children.Add(spaces); sp.Children.Add(tx0); sp.Children.Add(tx1); sp.Children.Add(tx2); lbi.Content = sp; this.elementsListBox.Items.Add(lbi); }
public void Init() { model = new Model(); testModel = model.Repo.CreateModel("testModel", "RobotsMetamodel"); model.ModelName = testModel.Name; testNodeType = testModel.Metamodel.FindElement("FinalNode") as Repo.INode; testEdgeType = testModel.Metamodel.FindElement("Link") as Repo.IEdge; }
private void RaiseNewVertexInRepo(Repo.INode node) { var args = new VertexEventArgs { Node = node }; this.NewVertexInRepo?.Invoke(this, args); }