private void NavigateTo(DataVertex dataVertex, QuickGraph.BidirectionalGraph <DataVertex, DataEdge> overrallGraph) { //overrallGraph.get var historyItem = GetHistoryItem(dataVertex, overrallGraph); CreateGraphArea(AreaNav, historyItem.Vertexes, historyItem.Edges, 0); //var dispatcher = AreaNav.Dispatcher; //FitToBounds(dispatcher, zoomctrlNav); }
public object ConvertToGraph(GraphData data) { var result = new QuickGraph.BidirectionalGraph<NodeDefinition, ReferenceGraphEdge>(); // add nodes result.AddVertexRange(data.Nodes.Values); foreach (var reference in data.References) { NodeDefinition from = data.Nodes[reference.NodeFromId]; NodeDefinition to = data.Nodes[reference.NodeToId]; result.AddEdge(new ReferenceGraphEdge(from, to)); } return result; }
private NavigateHistoryItem GetHistoryItem(DataVertex v, QuickGraph.BidirectionalGraph <DataVertex, DataEdge> overrallGraph) { var hisItem = new NavigateHistoryItem(); IEnumerable <DataEdge> outs; IEnumerable <DataEdge> ins; overrallGraph.TryGetInEdges(v, out ins); var edges = new List <DataEdge>(); if (overrallGraph.TryGetOutEdges(v, out outs)) { edges.AddRange(outs); } if (overrallGraph.TryGetInEdges(v, out ins)) { edges.AddRange(ins); } if (edges.Count > 0) { List <DataVertex> vertexes = new List <DataVertex>(); foreach (var e in edges) { if (!vertexes.Contains(e.Source)) { vertexes.Add(e.Source); } if (!vertexes.Contains(e.Target)) { vertexes.Add(e.Target); } } hisItem.Edges = edges; hisItem.Vertexes = vertexes; } return(hisItem); }