// 创建攻击树上的"关系结点",传入 1.关系枚举 2.坐标 public NodeViewModel CreatRelationNode(RelationType rela, Point nodeLocation) { var node = new RelationNode(rela); node.X = nodeLocation.X; node.Y = nodeLocation.Y; for (int i = 0; i < 6; i++) { node.Connectors.Add(new ConnectorViewModel()); } this.Network.Nodes.Add(node); return(node); }
/// <summary> /// Create a node and add it to the view-model. /// </summary> public NodeViewModel CreateNode(string name, Point nodeLocation) { //var node = new NodeViewModel(name); var node = new RelationNode(RelationType.AND); node.X = nodeLocation.X; node.Y = nodeLocation.Y; // // Create the default set of four connectors. // 创建默认的connector集合,这里对攻击树的结点总是添加六个锚点 // for (int i = 0; i < 6; i++) { node.Connectors.Add(new ConnectorViewModel()); } // // Add the new node to the view-model. // this.Network.Nodes.Add(node); return(node); }