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);
            }
        }
Ejemplo n.º 2
0
        public void CreateEdgeOperation_Do_Test()
        {
            var graph = new Model.GraphArea();

            var source = new DataVertex(100) { };
            var sourceVC = new VertexControl(source);
            graph.Graph.AddVertex(source);
            graph.AddVertex(source, sourceVC);

            var target = new DataVertex(101) { };
            var targetVC = new VertexControl(target);
            graph.Graph.AddVertex(target);
            graph.AddVertex(target, targetVC);

            bool called = false;
            EdgeControl ec = null;
            var ceo = new CreateEdgeOperation(graph, source, target, (e) =>
            {
                called = true;
                ec = e;
            },
            (e) =>
            {

            });

            ceo.Do();

            Assert.IsTrue(called);
            Assert.IsNotNull(ec);
            Assert.AreEqual<VertexControl>(ec.Source, sourceVC, "source are not equal");
            Assert.AreEqual<VertexControl>(ec.Target, targetVC, "target are not equal");
        }
        public VertexPositionChangeOperation(GraphArea graph, VertexControl vc, double offsetX, double offsetY, DataVertex data = null, Action<DataVertex, VertexControl> callback = null, Action<DataVertex> undoCallback = null)
            : base(graph, data, callback, undoCallback)
        {
            _vc = vc;
            _offsetX = offsetX;
            _offsetY = offsetY;

            Status = Orc.GraphExplorer.Status.Done;
        }
Ejemplo n.º 4
0
 internal virtual void OnVertexMouseLeave(VertexControl vc)
 {
     if (VertexMouseLeave != null)
     {
         VertexMouseLeave(this, new VertexSelectedEventArgs(vc, null, Keyboard.Modifiers));
     }
     if (MouseOverAnimation != null)
     {
         MouseOverAnimation.AnimateVertexBackward(vc);
     }
 }
Ejemplo n.º 5
0
 internal virtual void OnVertexMouseEnter(VertexControl vc)
 {
     if (VertexMouseEnter != null)
     {
         VertexMouseEnter(this, new VertexSelectedEventArgs(vc, null));
     }
     if (MouseOverAnimation != null)
     {
         MouseOverAnimation.AnimateVertexForward(vc);
     }
 }
Ejemplo n.º 6
0
        private Point GetOffset(VertexControl source, VertexControl target, int side_distance)
        {
            var sourcepos = source.GetPosition();
            var targetpos = target.GetPosition();

            var main_vector = new Vector(targetpos.X - sourcepos.X, targetpos.Y - sourcepos.Y);
            //get new point coordinate
            var joint = new Point(
                sourcepos.X + side_distance * (main_vector.Y / main_vector.Length),
                sourcepos.Y - side_distance * (main_vector.X / main_vector.Length));

            return(joint);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the offset point for edge parallelization
        /// </summary>
        /// <param name="source">Source vertex</param>
        /// <param name="target">Target vertex</param>
        /// <param name="sideDistance">Distance between edges</param>
        internal Point GetParallelOffset(VertexControl source, VertexControl target, int sideDistance)
        {
            var sourcepos = source.GetPosition();
            var targetpos = target.GetPosition();

            var mainVector = new Vector(targetpos.X - sourcepos.X, targetpos.Y - sourcepos.Y);
            //get new point coordinate
            var joint = new Point(
                sourcepos.X + source.DesiredSize.Width * .5 + sideDistance * (mainVector.Y / mainVector.Length),
                sourcepos.Y + source.DesiredSize.Height * .5 - sideDistance * (mainVector.X / mainVector.Length));

            return(joint);
        }
        public override void Do()
        {
            _graph.Graph.AddVertex(_vertex);
            _vCtrl = new VertexControl(_vertex);
            _graph.AddVertex(_vertex, _vCtrl);

            //ArrangeVertexPosition();

            if (_x != double.MinValue && _y != double.MinValue)
            {
                SetPositon();
            }

            if (_callback != null)
            {
                _callback.Invoke(_vertex, _vCtrl);
            }

        }
Ejemplo n.º 9
0
        public EdgeControl(VertexControl source, VertexControl target, object edge, bool showLabels = false, bool showArrows = true)
        {
            DataContext          = edge;
            Source               = source; Target = target;
            Edge                 = edge; DataContext = edge;
            ShowArrows           = showArrows;
            ShowLabel            = showLabels;
            _updateLabelPosition = true;
            IsHiddenEdgesUpdated = true;

            EventOptions = new EdgeEventOptions(this);
            foreach (var item in Enum.GetValues(typeof(EventType)).Cast <EventType>())
            {
                UpdateEventhandling(item);
            }

            if (source != null)
            {
                _sourceTrace = source.EventOptions.PositionChangeNotification;
                source.EventOptions.PositionChangeNotification = true;
                source.PositionChanged += source_PositionChanged;
            }
            if (target != null)
            {
                _targetTrace = target.EventOptions.PositionChangeNotification;
                target.EventOptions.PositionChangeNotification = true;
                target.PositionChanged += source_PositionChanged;
            }

            var dpd = DependencyPropertyDescriptor.FromProperty(SourceProperty, typeof(EdgeControl));

            if (dpd != null)
            {
                dpd.AddValueChanged(this, SourceChanged);
            }
            dpd = DependencyPropertyDescriptor.FromProperty(TargetProperty, typeof(EdgeControl));
            if (dpd != null)
            {
                dpd.AddValueChanged(this, TargetChanged);
            }

            IsSelfLooped = _isSelfLooped;
        }
Ejemplo n.º 10
0
 private static void UpdateVertexEdges(VertexControl vc)
 {
     if (vc != null && vc.Vertex != null)
     {
         var ra = vc.RootArea;
         if (ra == null)
         {
             throw new GX_InvalidDataException("OnDragFinished() - IGraphControl object must always have RootArea property set!");
         }
         //if (ra.IsEdgeRoutingEnabled) ra.ComputeEdgeRoutesByVertex(vc);
         //foreach (var item in ra.GetRelatedControls(vc, GraphControlType.Edge, EdgesType.All))
         //{
         if (ra.IsEdgeRoutingEnabled)
         {
             ra.ComputeEdgeRoutesByVertex(vc);
             vc.InvalidateVisual();
         }
         // }
     }
 }
Ejemplo n.º 11
0
 internal virtual void OnVertexSelected(VertexControl vc, MouseButtonEventArgs e)
 {
     if (VertexSelected != null)
         VertexSelected(this, new VertexSelectedEventArgs(vc, e));
 }
Ejemplo n.º 12
0
        public void VertexPositionChanged_Test()
        {
            var graph = new Model.GraphArea();

            var vertex = new DataVertex();

            var vctrol = new VertexControl(vertex);

            graph.Graph.AddVertex(vertex);

            graph.AddVertex(vertex, vctrol);

            bool called = false;
            bool undoCalled = false;

            var vpco = new VertexPositionChangeOperation(graph, vctrol, 10, 10, vertex, (v, vc) =>
            {
                called = true;
            }, (vc) =>
            {
                undoCalled = true;
            });

            vpco.Do();

            Assert.IsTrue(called);

            vpco.UnDo();

            Assert.IsTrue(undoCalled);
        }
Ejemplo n.º 13
0
        private Task SearchForString(string selected_text, VertexControl from_vertex_control, List<string> extensions_to_search = null)
        {
            if (selected_text != null && selected_text != "")
            {
                PocVertex from_vertex = (PocVertex)from_vertex_control.Vertex;

                SearchResultsVertex new_search_results_vertex = graph_provider.PerformSearch(selected_text, from_vertex, extensions_to_search);
                VertexControl new_search_results_vertex_control = new VertexControl(new_search_results_vertex) { DataContext = new_search_results_vertex };
                graph_area.AddVertex(new_search_results_vertex, new_search_results_vertex_control);

                PocEdge new_edge = new PocEdge((PocVertex)from_vertex_control.Vertex, new_search_results_vertex);
                graph_area.InsertEdge(new_edge, new EdgeControl(from_vertex_control, new_search_results_vertex_control, new_edge));
                
                graph_area.RelayoutGraph(true);
                graph_area.UpdateLayout();
                
                centre_on_me = new_search_results_vertex_control;

                System.Windows.Controls.DataGrid grid = TreeHelpers.FindVisualChild<System.Windows.Controls.DataGrid>(new_search_results_vertex_control);
                System.Windows.Controls.ProgressBar bar = TreeHelpers.FindVisualChild<System.Windows.Controls.ProgressBar>(new_search_results_vertex_control);
                if (still_counting)
                {
                    bar.Maximum = 100;
                }
                else
                {
                    bar.Maximum = directory_count;
                }
                var search_progress = new Progress<int>((int some_int) => ReportProgress(bar));

                return graph_provider.PopulateResultsAsync(selected_text, new_search_results_vertex, search_progress);
                
                //bar.Visibility = System.Windows.Visibility.Collapsed;
                //grid.Visibility = System.Windows.Visibility.Visible;
            }
            return new Task(() => { });
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Generates and displays edges for specified vertex
 /// </summary>
 /// <param name="vc">Vertex control</param>
 /// <param name="edgeType">Type of edges to display</param>
 /// <param name="defaultVisibility">Default edge visibility on layout</param>
 public virtual void GenerateEdgesForVertex(VertexControl vc, EdgesType edgeType, Visibility defaultVisibility = System.Windows.Visibility.Visible)
 {
 }
Ejemplo n.º 15
0
 private void RelayoutGraph(VertexControl vertex_control)
 {
     centre_on_me = vertex_control;
     graph_area.RelayoutGraph(true);
     graph_area.UpdateLayout();
 }
Ejemplo n.º 16
0
 internal virtual void OnVertexMouseMove(VertexControl vc)
 {
     if (VertexMouseMove != null)
         VertexMouseMove(this, new VertexMovedEventArgs(vc, new Point()));
 }
Ejemplo n.º 17
0
 private void load_project(String filename)
 {
     graph_provider.LoadProject(filename);
     graph_area.Graph = graph_provider.Graph;
     SetGraphLayoutParameters();
     graph_area.GenerateGraph(graph_provider.Graph);
     graph_area.RelayoutGraph(true);
     root_control = graph_area.VertexList.Where(x => x.Key.GetType() == typeof(FileBrowser)).First().Value;
     root_control.Vertex = graph_provider.root_vertex;
     RelayoutGraph(root_control);
 }
Ejemplo n.º 18
0
 public void Clean()
 {
     _vc = null;
 }
Ejemplo n.º 19
0
 private void AddFileView(FileItem file_item, VertexControl source, PocVertex source_vertex, int line)
 {
     AddFileView(file_item, source, source_vertex, new List<int> { line });
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Generates and displays edges for specified vertex
 /// </summary>
 /// <param name="vc">Vertex control</param>
 /// <param name="edgeType">Type of edges to display</param>
 /// <param name="defaultVisibility">Default edge visibility on layout</param>
 public abstract void GenerateEdgesForVertex(VertexControl vc, EdgesType edgeType, Visibility defaultVisibility = Visibility.Visible);
Ejemplo n.º 21
0
 /// <summary>
 /// Compute new edge routes for all edges of the vertex
 /// </summary>
 /// <param name="vc">Vertex visual control</param>
 /// <param name="vertexDataNeedUpdate">If vertex data inside edge routing algorthm needs to be updated</param>
 public virtual void ComputeEdgeRoutesByVertex(VertexControl vc, bool vertexDataNeedUpdate = true)
 {
 }
Ejemplo n.º 22
0
        private void AddFileView(FileItem file_item, VertexControl source, PocVertex source_vertex, List<int> lines = null)
        {
            if (!graph_provider.root_vertex.CtagsRun)
            {
                System.Windows.Forms.MessageBox.Show("Ctags is still running, so tags are not available.", "Ctags running", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            FileVertex new_vertex = graph_provider.AddFileView(file_item, source_vertex);
            VertexControl new_vertex_control = new VertexControl(new_vertex) { DataContext = new_vertex };
            try
            {
                graph_area.AddVertex(new_vertex, new_vertex_control);
            }
            catch (GraphX.GX_InvalidDataException)
            {
                new_vertex_control = graph_area.GetAllVertexControls().Where(c => c.Vertex == new_vertex).First();
            }

            PocEdge new_edge = new PocEdge(source_vertex, new_vertex);
            graph_area.InsertEdge(new_edge, new EdgeControl(source, new_vertex_control, new_edge));
            graph_area.RelayoutGraph(true);
            graph_area.UpdateLayout();
            centre_on_me = new_vertex_control;
            ICSharpCode.AvalonEdit.TextEditor editor = TreeHelpers.FindVisualChild<ICSharpCode.AvalonEdit.TextEditor>(new_vertex_control);
            if (editor != null && editor != NotesEditor)
            {
                editor.TextArea.TextView.MouseDown += TestEditor_MouseDown;
                editor.TextArea.SelectionChanged += TestEditor_SelectionChanged;
                if (graph_provider.root_vertex.CtagsRun) editor.TextArea.TextView.LineTransformers.Add(new UnderlineCtagsMatches(graph_provider.root_vertex.CtagsMatches.Keys.ToList()));
                if (lines != null)
                {
                    editor.TextArea.TextView.BackgroundRenderers.Add(new HighlightSearchLineBackgroundRenderer(editor, lines));
                    editor.ScrollToLine(lines.Min());
                }
                editor.Width = editor.ActualWidth;
            }
        }
Ejemplo n.º 23
0
        private void CreateNewGraph()
        {
            graph_area.Children.Clear();
            graph_provider = new GraphProvider();
            graph_area.AsyncAlgorithmCompute = true;
            graph_area.RelayoutFinished += OnRelayoutFinished;
            graph_area.UseNativeObjectArrange = true;
            graph_area.Graph = graph_provider.Graph;
            SetGraphLayoutParameters();
            graph_area.GenerateGraph(graph_provider.Graph);
            graph_area.RelayoutGraph(true);

            root_control = graph_area.VertexList.Values.First();
            graph_provider.root_vertex = (FileBrowser)graph_area.VertexList.Keys.First();
            centre_on_me = root_control;
        }
Ejemplo n.º 24
0
        private VertexControl AddCtagsAnchor(String tag, VertexControl source, PocVertex source_vertex)
        {
            CtagsVertex new_vertex = graph_provider.AddCtagsAnchor(tag, source_vertex);
            VertexControl new_vertex_control = new VertexControl(new_vertex) { DataContext = new_vertex };
            graph_area.AddVertex(new_vertex, new_vertex_control);
            PocEdge new_edge = new PocEdge(source_vertex, new_vertex);
            graph_area.InsertEdge(new_edge, new EdgeControl(source, new_vertex_control, new_edge));
            graph_area.RelayoutGraph(true);
            graph_area.UpdateLayout();
            centre_on_me = new_vertex_control;

            return new_vertex_control;
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Compute new edge routes for all edges of the vertex
 /// </summary>
 /// <param name="vc">Vertex visual control</param>
 /// <param name="vertexDataNeedUpdate">If vertex data inside edge routing algorthm needs to be updated</param>
 public virtual void ComputeEdgeRoutesByVertex(VertexControl vc, bool vertexDataNeedUpdate = true)
 {
 }
Ejemplo n.º 26
0
 public VertexEventOptions(VertexControl vc)
 {
     _vc = vc;
 }
Ejemplo n.º 27
0
 internal virtual void OnVertexDoubleClick(VertexControl vc)
 {
     if (VertexDoubleClick != null)
         VertexDoubleClick(this, new VertexSelectedEventArgs(vc, null, Keyboard.Modifiers));
 }
Ejemplo n.º 28
0
 public VertexEventOptions(VertexControl vc)
 {
     _vc = vc;
 }
Ejemplo n.º 29
0
 private void CenterOnVertex(VertexControl vc)
 {
     var x = zoom_control.Position.X + vc.GetPosition().X;
     var y = zoom_control.Position.Y + vc.GetPosition().Y;
     var of = System.Windows.Media.VisualTreeHelper.GetOffset(vc);
     var new_point = new Point(
         (of.X
         * zoom_control.Scale
         + vc.ActualWidth / 2
         * zoom_control.Scale
         - zoom_control.ActualWidth / 2
         )
         ,
         (of.Y
         * zoom_control.Scale
         + vc.ActualHeight / 2
         * zoom_control.Scale
         - zoom_control.ActualHeight / 2
         )
         );
     zoom_control.ZoomTo(new_point);
 }
Ejemplo n.º 30
0
        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));
        }
Ejemplo n.º 31
0
 public void Clean()
 {
     //cleanVertexTracer(true);
     //cleanVertexTracer(false);
     if (Source != null)
         Source.PositionChanged -= source_PositionChanged;
     if (Target != null)
         Target.PositionChanged -= source_PositionChanged;
     _oldSource = _oldTarget = null;
     Source = null;
     Target = null;
     Edge = null;
     RootArea = null;
     HighlightBehaviour.SetIsHighlightEnabled(this, false);
     DragBehaviour.SetIsDragEnabled(this, false);
     _linegeometry = null;
     _arrowgeometry = null;
     _linePathObject = null;
     _arrowPathObject = null;
     if (EventOptions != null)
         EventOptions.Clean();
 }
Ejemplo n.º 32
0
 public void Clean()
 {
     _vc = null;
 }
Ejemplo n.º 33
0
        /// <summary>
        /// Gets the offset point for edge parallelization
        /// </summary>
        /// <param name="source">Source vertex</param>
        /// <param name="target">Target vertex</param>
        /// <param name="sideDistance">Distance between edges</param>
        internal Point GetParallelOffset(VertexControl source, VertexControl target, int sideDistance)
        {
            var sourcepos = source.GetPosition();
            var targetpos = target.GetPosition();

            var mainVector = new Vector(targetpos.X - sourcepos.X, targetpos.Y - sourcepos.Y);
            //get new point coordinate
            var joint = new Point(
                 sourcepos.X + source.DesiredSize.Width * .5 + sideDistance * (mainVector.Y / mainVector.Length),
                 sourcepos.Y + source.DesiredSize.Height * .5 - sideDistance * (mainVector.X / mainVector.Length));
            return joint;
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Generates and displays edges for specified vertex
 /// </summary>
 /// <param name="vc">Vertex control</param>
 /// <param name="edgeType">Type of edges to display</param>
 /// <param name="defaultVisibility">Default edge visibility on layout</param>
 public abstract void GenerateEdgesForVertex(VertexControl vc, EdgesType edgeType, Visibility defaultVisibility = Visibility.Visible);
Ejemplo n.º 35
0
 private void SourceChanged(object sender, EventArgs e)
 {
     if (_oldSource != null)
     {
         _oldSource.PositionChanged -= source_PositionChanged;
         _oldSource.EventOptions.PositionChangeNotification = _sourceTrace;
     }
     _oldSource = Source;
     if (Source != null)
     {
         _sourceTrace = Source.EventOptions.PositionChangeNotification;
         Source.EventOptions.PositionChangeNotification = true;
         Source.PositionChanged += source_PositionChanged;
     }
 }
Ejemplo n.º 36
0
 internal virtual void OnVertexMouseLeave(VertexControl vc)
 {
     if (VertexMouseLeave != null)
         VertexMouseLeave(this, new VertexSelectedEventArgs(vc, null, Keyboard.Modifiers));
     if (MouseOverAnimation != null)
         MouseOverAnimation.AnimateVertexBackward(vc);
 }
Ejemplo n.º 37
0
 private void TargetChanged(object sender, EventArgs e)
 {
     if (_oldTarget != null)
     {
         _oldTarget.PositionChanged -= source_PositionChanged;
         _oldTarget.EventOptions.PositionChangeNotification = _targetTrace;
     }
     _oldTarget = Target;
     if (Target != null)
     {
         _targetTrace = Target.EventOptions.PositionChangeNotification;
         Target.EventOptions.PositionChangeNotification = true;
         Target.PositionChanged += source_PositionChanged;
     }
 }
Ejemplo n.º 38
0
 internal virtual void OnVertexSelected(VertexControl vc, MouseButtonEventArgs e, ModifierKeys keys)
 {
     if (VertexSelected != null)
         VertexSelected(this, new VertexSelectedEventArgs(vc, e, keys));
 }
Ejemplo n.º 39
0
        public EdgeControl(VertexControl source, VertexControl target, object edge, bool showLabels = false, bool showArrows = true)
        {
            DataContext = edge;
            Source = source; Target = target;
            Edge = edge; DataContext = edge;
            ShowArrows = showArrows;
            ShowLabel = showLabels;

            EventOptions = new EdgeEventOptions(this);
            foreach (var item in Enum.GetValues(typeof(EventType)).Cast<EventType>())
                UpdateEventhandling(item);

            if (source != null)
            {
                _sourceTrace = source.EventOptions.PositionChangeNotification;
                source.EventOptions.PositionChangeNotification = true;
                source.PositionChanged += source_PositionChanged;
            }
            if (target != null)
            {
                _targetTrace = target.EventOptions.PositionChangeNotification;
                target.EventOptions.PositionChangeNotification = true;
                target.PositionChanged += source_PositionChanged;
            }

            var dpd = DependencyPropertyDescriptor.FromProperty(SourceProperty, typeof(EdgeControl));
            if (dpd != null) dpd.AddValueChanged(this, SourceChanged);
            dpd = DependencyPropertyDescriptor.FromProperty(TargetProperty, typeof(EdgeControl));
            if (dpd != null) dpd.AddValueChanged(this, TargetChanged);
        }
        public CreateVertexOperation(GraphArea graph, DataVertex data = null, double x = double.MinValue, double y = double.MinValue, Action<DataVertex, VertexControl> callback = null, Action<DataVertex> undoCallback = null)
            : base(graph, data, callback, undoCallback)
        {
            _vCtrl = new VertexControl(_vertex);

            if (x != double.MinValue)
                _x = x;

            if (y != double.MinValue)
                _y = y;
        }
Ejemplo n.º 41
0
 internal virtual void OnVertexMouseEnter(VertexControl vc)
 {
     if (VertexMouseEnter != null)
         VertexMouseEnter(this, new VertexSelectedEventArgs(vc, null));
     if (MouseOverAnimation != null)
         MouseOverAnimation.AnimateVertexForward(vc);
 }