internal void OnEdgeDoubleClick(EdgeControl edgeControl) { if (EdgeDoubleClick != null) { EdgeDoubleClick(this, new EdgeSelectedEventArgs(edgeControl)); } }
internal virtual void OnEdgeSelected(EdgeControl ec) { if (EdgeSelected != null) { EdgeSelected(this, new EdgeSelectedEventArgs(ec)); } }
internal void OnEdgeMouseMove(EdgeControl edgeControl, MouseButtonEventArgs e, ModifierKeys keys) { if (EdgeMouseMove != null) { EdgeMouseMove(this, new EdgeSelectedEventArgs(edgeControl, e, keys)); } }
/// <summary> /// Load previously saved state into layout /// </summary> /// <param name="id">Unique state id</param> public void LoadState(string id) { if (_area.LogicCore == null) { throw new GraphX.GX_InvalidDataException("GraphArea.LogicCore -> Not initialized!"); } if (!_states.ContainsKey(id)) { Debug.WriteLine(string.Format("LoadState() -> State id {0} not found! Skipping...", id)); return; } // _area.RemoveAllVertices(); // _area.RemoveAllEdges(); //One action: clear all, preload vertices, assign Graph property _area.PreloadVertexes(_states[id].Graph, true, true); _area.LogicCore.Graph = _states[id].Graph; //setup vertex positions foreach (var item in _states[id].VertexPositions) { _area.VertexList[item.Key].SetPosition(item.Value, true); _area.VertexList[item.Key].Visibility = Visibility.Visible; } //setup visible edges foreach (var item in _states[id].VisibleEdges) { var edgectrl = new EdgeControl(_area.VertexList[item.Source], _area.VertexList[item.Target], item); _area.InsertEdge(item, edgectrl); } }
public override void UnDo() { _graph.Graph.AddVertex(_vertex); _vCtrl = new VertexControl(_vertex); _graph.AddVertex(_vertex, _vCtrl); HighlightBehaviour.SetIsHighlightEnabled(_vCtrl, false); foreach (var edge in _relatedEdges) { var source = _graph.VertexList.FirstOrDefault(v=>v.Key.Id == edge.Item2.Id); var target = _graph.VertexList.FirstOrDefault(v=>v.Key.Id == edge.Item3.Id); if(source.Value==null||target.Value==null) throw new Exception("source or target vertex not found"); var edgeCtrl = new EdgeControl(source.Value, target.Value, edge.Item1) { ShowArrows = true, ShowLabel = true }; _graph.Graph.AddEdge(edge.Item1); _graph.AddEdge(edge.Item1, edgeCtrl); HighlightBehaviour.SetIsHighlightEnabled(edgeCtrl, false); } if (_undoCallback != null) { _undoCallback.Invoke(_vertex); } }
public override void UnDo() { _Edge = new DataEdge(_source, _target); _sourceVC = _graph.VertexList.Where(pair => pair.Key == _source).Select(pair => pair.Value).FirstOrDefault(); _targetVC = _graph.VertexList.Where(pair => pair.Key == _target).Select(pair => pair.Value).FirstOrDefault(); if (_sourceVC == null || _targetVC == null) throw new ArgumentNullException("VertexControl"); _eCtrl = new EdgeControl(_sourceVC, _targetVC, _Edge) { ShowArrows = true, ShowLabel = true }; _graph.Graph.AddEdge(_Edge); _graph.AddEdge(_Edge, _eCtrl); HighlightBehaviour.SetIsHighlightEnabled(_eCtrl, false); if (_undoCallback != null) { _undoCallback.Invoke(_eCtrl); } }
internal void OnEdgeMouseMove(EdgeControl edgeControl) { if (EdgeMouseMove != null) { EdgeMouseMove(this, new EdgeSelectedEventArgs(edgeControl)); } }
internal virtual void OnEdgeSelected(EdgeControl ec, MouseButtonEventArgs e, ModifierKeys keys) { if (EdgeSelected != null) { EdgeSelected(this, new EdgeSelectedEventArgs(ec, e, keys)); } }
//dispose operation, release reference public virtual void Dispose() { _Edge.Dispose(); _Edge = null; _eCtrl = null; _callback = null; _undoCallback = null; _graph = null; }
internal void OnEdgeMouseLeave(EdgeControl edgeControl, MouseButtonEventArgs e, ModifierKeys keys) { if (EdgeMouseLeave != null) { EdgeMouseLeave(this, new EdgeSelectedEventArgs(edgeControl, e, keys)); } if (MouseOverAnimation != null) { MouseOverAnimation.AnimateEdgeBackward(edgeControl); } }
internal void OnEdgeMouseEnter(EdgeControl edgeControl) { if (EdgeMouseEnter != null) { EdgeMouseEnter(this, new EdgeSelectedEventArgs(edgeControl)); } if (MouseOverAnimation != null) { MouseOverAnimation.AnimateEdgeForward(edgeControl); } }
internal void OnEdgeMouseLeave(EdgeControl edgeControl) { if (EdgeMouseLeave != null) { EdgeMouseLeave(this, new EdgeSelectedEventArgs(edgeControl)); } if (MouseOverAnimation != null) { MouseOverAnimation.AnimateEdgeBackward(edgeControl); } }
public override void Do() { _Edge = new DataEdge(_source, _target); _sourceVC = _graph.VertexList.Where(pair => pair.Key.Id == _source.Id).Select(pair => pair.Value).FirstOrDefault(); _targetVC = _graph.VertexList.Where(pair => pair.Key.Id == _target.Id).Select(pair => pair.Value).FirstOrDefault(); if (_sourceVC == null || _targetVC == null) throw new ArgumentNullException("Vertex Control"); _eCtrl = new EdgeControl(_sourceVC, _targetVC, _Edge) { ShowArrows = true, ShowLabel = true }; _graph.Graph.AddEdge(_Edge); _graph.AddEdge(_Edge, _eCtrl); if (_callback != null) { _callback.Invoke(_eCtrl); } }
internal virtual void OnEdgeSelected(EdgeControl ec) { if (EdgeSelected != null) EdgeSelected(this, new EdgeSelectedEventArgs(ec)); }
internal void OnEdgeMouseMove(EdgeControl edgeControl) { if (EdgeMouseMove != null) EdgeMouseMove(this, new EdgeSelectedEventArgs(edgeControl)); }
internal void OnEdgeMouseLeave(EdgeControl edgeControl) { if (EdgeMouseLeave != null) EdgeMouseLeave(this, new EdgeSelectedEventArgs(edgeControl)); if (MouseOverAnimation != null) MouseOverAnimation.AnimateEdgeBackward(edgeControl); }
internal void OnEdgeMouseEnter(EdgeControl edgeControl) { if (EdgeMouseEnter != null) EdgeMouseEnter(this, new EdgeSelectedEventArgs(edgeControl)); if (MouseOverAnimation != null) MouseOverAnimation.AnimateEdgeForward(edgeControl); }
internal void OnEdgeDoubleClick(EdgeControl edgeControl) { if (EdgeDoubleClick != null) EdgeDoubleClick(this, new EdgeSelectedEventArgs(edgeControl)); }
public void Delete_Vertex_With_Related_Edges_Test() { //begin setup var graph = new Model.GraphArea(); var v1 = new DataVertex(100) { }; var v2 = new DataVertex(103) { }; var v3 = new DataVertex(105) { }; var vc1 = new VertexControl(v1); var vc2 = new VertexControl(v2); var vc3 = new VertexControl(v3); var e1 = new DataEdge(v1, v2); var ec1 = new EdgeControl(vc1, vc2, e1); var e2 = new DataEdge(v1, v3); var ec2 = new EdgeControl(vc1, vc3, e2); graph.Graph.AddVertex(v1); graph.AddVertex(v1, vc1); graph.Graph.AddVertex(v2); graph.AddVertex(v2, vc2); graph.Graph.AddVertex(v3); graph.AddVertex(v3, vc3); graph.Graph.AddEdge(e1); graph.AddEdge(e1, ec1); graph.Graph.AddEdge(e2); graph.AddEdge(e2, ec2); //end setup bool doCalled = false; bool undoCalled = false; var dvo = new DeleteVertexOperation(graph, v1, (dv, vc) => { doCalled = true; }, (dv) => { undoCalled = true; }); dvo.Do(); Assert.IsTrue(doCalled); Assert.IsFalse(graph.VertexList.Any(v => v.Key.Id == v1.Id)); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v2.Id)); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v3.Id)); Assert.IsFalse(graph.EdgesList.Any(e => e.Key == e1)); Assert.IsFalse(graph.EdgesList.Any(e => e.Key == e2)); dvo.UnDo(); Assert.IsTrue(undoCalled); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v1.Id)); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v2.Id)); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v3.Id)); Assert.IsTrue(graph.EdgesList.Any(e => e.Key == e1)); Assert.IsTrue(graph.EdgesList.Any(e => e.Key == e2)); dvo.Do(); Assert.IsTrue(doCalled); Assert.IsFalse(graph.VertexList.Any(v => v.Key.Id == v1.Id)); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v2.Id)); Assert.IsTrue(graph.VertexList.Any(v => v.Key.Id == v3.Id)); Assert.IsFalse(graph.EdgesList.Any(e => e.Key == e1)); Assert.IsFalse(graph.EdgesList.Any(e => e.Key == e2)); }
public EdgeEventOptions(EdgeControl ec) { _ec = ec; }
public void Clean() { _ec = null; }