コード例 #1
0
        public EdgeControl GetEdgeControl(TEdge edge)
        {
            EdgeControl ec = null;

            _edgeControls.TryGetValue(edge, out ec);
            return(ec);
        }
コード例 #2
0
        protected virtual void CreateEdgeControl(TEdge edge)
        {
            var edgeControl = new EdgeControl
            {
                Edge        = edge,
                DataContext = edge
            };

            //var edgeControl = _edgePool.GetObject();
            //edgeControl.Edge = edge;
            _edgeControls[edge] = edgeControl;

            //set the Source and the Target
            edgeControl.Source = _vertexControls[edge.Source];
            edgeControl.Target = _vertexControls[edge.Target];

            if (ActualLayoutMode == GraphSharp.Algorithms.Layout.LayoutMode.Simple)
            {
                Children.Insert(0, edgeControl);
            }
            else
            {
                Children.Add(edgeControl);
            }
            SetHighlightProperties(edge, edgeControl);
            RunCreationTransition(edgeControl);
        }
コード例 #3
0
 private void HighlightEdge(EdgeControl ec)
 {
     ClearHighlights();
     VisualStateManager.GoToState(ec, "Highlighted", true);
     VisualStateManager.GoToState(ec.Source, "HighlightedSource", true);
     VisualStateManager.GoToState(ec.Target, "HighlightedTarget", true);
 }
コード例 #4
0
        protected virtual void CreateEdgeControl(TEdge edge)
        {
            var edgeControl = new EdgeControl
            {
                Edge = edge
            };

            //var edgeControl = _edgePool.GetObject();
            //edgeControl.Edge = edge;
            _edgeControls[edge] = edgeControl;

            //set the Source and the Target
            edgeControl.Source = _vertexControls[edge.Source];
            edgeControl.Target = _vertexControls[edge.Target];

            if (ActualLayoutMode == GraphSharp.Algorithms.Layout.LayoutMode.Simple)
            {
                Children.Insert(0, edgeControl);
            }
            else
            {
                Children.Add(edgeControl);
            }

            edgeControl.ApplyTemplate();
            VisualStateManager.GoToState(edgeControl, "BeforeAdded", false);
            VisualStateManager.GoToState(edgeControl, "AfterAdded", true);

            //SetHighlightProperties(edge, edgeControl);
        }
コード例 #5
0
        private static void SourceChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            EdgeControl c = d as EdgeControl;

            VertexControl vcn = e.NewValue as VertexControl;

            if (vcn != null)
            {
                vcn.AsSources.AddEdge(c);
            }
            VertexControl vco = e.OldValue as VertexControl;

            if (vco != null)
            {
                vco.AsSources.RemoveEdge(c);
            }
        }
コード例 #6
0
        protected void SetHighlightProperties(TEdge edge, EdgeControl edgeControl)
        {
            object highlightInfo;

            if (IsHighlightedEdge(edge, out highlightInfo))
            {
                GraphElementBehavior.SetIsHighlighted(edgeControl, true);
                GraphElementBehavior.SetHighlightInfo(edgeControl, highlightInfo);
            }

            object semiHighlightInfo;

            if (IsSemiHighlightedEdge(edge, out semiHighlightInfo))
            {
                GraphElementBehavior.SetIsSemiHighlighted(edgeControl, true);
                GraphElementBehavior.SetSemiHighlightInfo(edgeControl, semiHighlightInfo);
            }
        }
コード例 #7
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 40 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteRemoveNode);
     
     #line default
     #line hidden
     
     #line 41 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanExecuteRemoveNode);
     
     #line default
     #line hidden
     return;
     case 2:
     
     #line 43 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteRemoveSelectedNodes);
     
     #line default
     #line hidden
     
     #line 44 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanExecuteRemoveSelectedNodes);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 46 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteToggleLogLevel);
     
     #line default
     #line hidden
     
     #line 47 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanToggleLogLevel);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 49 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteCreateConnection);
     
     #line default
     #line hidden
     return;
     case 5:
     
     #line 51 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteAddScopeToDecision);
     
     #line default
     #line hidden
     return;
     case 6:
     
     #line 54 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Controls.DockPanel)(target)).PreviewDrop += new System.Windows.DragEventHandler(this.Graph_Drop);
     
     #line default
     #line hidden
     
     #line 55 "..\..\..\Views\ScopeGraph.xaml"
     ((System.Windows.Controls.DockPanel)(target)).PreviewDragOver += new System.Windows.DragEventHandler(this.Graph_DragOver);
     
     #line default
     #line hidden
     return;
     case 7:
     this.zoomControl = ((TraceLab.UI.WPF.Controls.ZoomControl.ZoomControl)(target));
     return;
     case 8:
     this.marqueeAdorner = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 9:
     this.graphLayout = ((TraceLab.UI.WPF.Controls.NodeGraphLayout)(target));
     return;
     case 10:
     this.HACK_Vertex = ((GraphSharp.Controls.VertexControl)(target));
     return;
     case 11:
     this.HACK_Edge = ((GraphSharp.Controls.EdgeControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
コード例 #8
0
ファイル: ScopeGraph.g.i.cs プロジェクト: thbin/TraceLab
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 40 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteRemoveNode);

            #line default
            #line hidden

            #line 41 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanExecuteRemoveNode);

            #line default
            #line hidden
                return;

            case 2:

            #line 43 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteRemoveSelectedNodes);

            #line default
            #line hidden

            #line 44 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanExecuteRemoveSelectedNodes);

            #line default
            #line hidden
                return;

            case 3:

            #line 46 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteToggleLogLevel);

            #line default
            #line hidden

            #line 47 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanToggleLogLevel);

            #line default
            #line hidden
                return;

            case 4:

            #line 49 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteCreateConnection);

            #line default
            #line hidden
                return;

            case 5:

            #line 51 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ExecuteAddScopeToDecision);

            #line default
            #line hidden
                return;

            case 6:

            #line 54 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Controls.DockPanel)(target)).PreviewDrop += new System.Windows.DragEventHandler(this.Graph_Drop);

            #line default
            #line hidden

            #line 55 "..\..\..\Views\ScopeGraph.xaml"
                ((System.Windows.Controls.DockPanel)(target)).PreviewDragOver += new System.Windows.DragEventHandler(this.Graph_DragOver);

            #line default
            #line hidden
                return;

            case 7:
                this.zoomControl = ((TraceLab.UI.WPF.Controls.ZoomControl.ZoomControl)(target));
                return;

            case 8:
                this.marqueeAdorner = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 9:
                this.graphLayout = ((TraceLab.UI.WPF.Controls.NodeGraphLayout)(target));
                return;

            case 10:
                this.HACK_Vertex = ((GraphSharp.Controls.VertexControl)(target));
                return;

            case 11:
                this.HACK_Edge = ((GraphSharp.Controls.EdgeControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
コード例 #9
0
        /// <summary>
        ///  Unmark all edges
        /// </summary>
        /// <param name="graphLayout"></param>
        public void UnmarkAllEdges(GraphLayoutCity graphLayout)
        {
            EdgeControl edgeControl = new EdgeControl();

            foreach (EdgeCity edge in graphLayout.HighlightedEdges)
            {
                graphLayout.Dispatcher.Invoke(
                new Action(delegate()
                {
                    graphLayout.RemoveHighlightFromEdge(edge);
                }),
                DispatcherPriority.Normal, null);
            }
        }