public Node(Node pattern) { screenPosition.X = pattern.screenPosition.X; screenPosition.Y = pattern.screenPosition.Y; this.name = pattern.name; centerPoint.X = pattern.centerPoint.X; centerPoint.Y = pattern.centerPoint.Y; typeNode = pattern.typeNode; try { System.Reflection.Assembly thisExe; thisExe = System.Reflection.Assembly.GetExecutingAssembly(); String imagePath = ""; statePicture = pattern.statePicture; widthPict = pattern.widthPict; radius = pattern.radius; } catch (Exception ex) { } }
private void copyNodesAndEdges(GraphAutomats patternGraph) { this.nodes.Clear(); this.edges.Clear(); int k = 0; int ind1=0,ind2=0; for (int i = 0; i < patternGraph.nodes.Count; i++) { Node newNode = new Node(patternGraph.nodes[i]); this.nodes.Add(newNode); } for (int i = 0; i < patternGraph.edges.Count; i++) { ind1 = patternGraph.nodes.IndexOf(patternGraph.edges[i].BeginNode); ind2 = patternGraph.nodes.IndexOf(patternGraph.edges[i].EndNode); Edge newEdge = new Edge(nodes[ind1], nodes[ind2], patternGraph.edges[i].EdgeChars); this.edges.Add(newEdge); } }
public Node[] AddEdgeToPosition(int screenx, int screeny,char c) { if(this.selectedNodes.Count==1) { Node found = this.findNode(screenx, screeny); if (found != null) { this.addEdge(selectedNodes[0],found,c); Node [] tab=new Node[2] {selectedNodes[0],found}; return tab; } } return null; }
private Edge findEdge(Node from, Node to) { for (int i = 0; i < edges.Count; i++) { if (edges[i].BeginNode == from && edges[i].EndNode == to) { return edges[i]; } } return null; }
private void addEdge(Node from, Node to,Char c) { Edge oldEd=findEdge(from, to); if(oldEd==null) edges.Add(new Edge(from, to,c)); }
public void SelectEdgeOperation(Node n1, Node n2) { if (animatedEdge != null) animatedEdge.Bevel = 0; animatedEdge = findEdge(n1, n2); if (animatedEdge != null) { animatedEdge.Bevel = 1; frameStep = 1; } }