예제 #1
1
파일: Form1.cs 프로젝트: kouweizhong/GraphX
        private UIElement GenerateWpfVisuals()
        {
            zoomctrl = new ZoomControl();
            ZoomControl.SetViewFinderVisibility(zoomctrl, System.Windows.Visibility.Visible);
            /* ENABLES WINFORMS HOSTING MODE --- >*/
            var logic = new GXLogicCore<DataVertex, DataEdge, BidirectionalGraph<DataVertex, DataEdge>>();
            gArea = new GraphAreaExample() { EnableWinFormsHostingMode = true, LogicCore = logic };
            logic.Graph = GenerateGraph();
            logic.DefaultLayoutAlgorithm = GraphX.LayoutAlgorithmTypeEnum.KK;
            logic.DefaultLayoutAlgorithmParams = logic.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.KK);
            ((KKLayoutParameters)logic.DefaultLayoutAlgorithmParams).MaxIterations = 100;
            logic.DefaultOverlapRemovalAlgorithm = GraphX.OverlapRemovalAlgorithmTypeEnum.FSA;
            logic.DefaultOverlapRemovalAlgorithmParams = logic.AlgorithmFactory.CreateOverlapRemovalParameters(GraphX.OverlapRemovalAlgorithmTypeEnum.FSA);
            ((OverlapRemovalParameters)logic.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 50;
            ((OverlapRemovalParameters)logic.DefaultOverlapRemovalAlgorithmParams).VerticalGap = 50;
            logic.DefaultEdgeRoutingAlgorithm = GraphX.EdgeRoutingAlgorithmTypeEnum.None;
            logic.AsyncAlgorithmCompute = false;
            zoomctrl.Content = gArea;
            gArea.RelayoutFinished += gArea_RelayoutFinished;

            var myResourceDictionary = new ResourceDictionary {Source = new Uri("Templates\\template.xaml", UriKind.Relative)};
            zoomctrl.Resources.MergedDictionaries.Add(myResourceDictionary);

            return zoomctrl;
        }
예제 #2
0
 public void Dispose()
 {
     ClearEdgeBp();
     _graphArea = null;
     if(_zoomControl != null)
         _zoomControl.MouseMove -= _zoomControl_MouseMove;
     _zoomControl = null;
     _rd = null;
 }
예제 #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 71 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnBFS_Click);

            #line default
            #line hidden
                return;

            case 2:

            #line 72 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnColorize_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.sldrDelta = ((System.Windows.Controls.Slider)(target));
                return;

            case 4:
                this.myTextBox = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.sldrVertices = ((System.Windows.Controls.Slider)(target));
                return;

            case 6:
                this.txtVertices = ((System.Windows.Controls.Label)(target));
                return;

            case 7:

            #line 80 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnGenerate_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.zoomctrl = ((GraphX.Controls.ZoomControl)(target));
                return;

            case 9:
                this.Area = ((graphx.GraphView)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #4
0
 public EditorObjectManager(GraphAreaExample graphArea, ZoomControl zc)
 {
     _graphArea = graphArea;
     _zoomControl = zc;
     _zoomControl.MouseMove += _zoomControl_MouseMove;
     _rd = new ResourceDictionary
     {
         Source = new Uri("/ShowcaseApp.WPF;component/Templates/EditorGraphXTemplates.xaml",
             UriKind.RelativeOrAbsolute)
     };
 }
예제 #5
0
 public SentenceEditorManager(SentenceGraphArea graphArea, ZoomControl zc)
 {
     this.graphArea = graphArea;
     zoomControl = zc;
     zoomControl.MouseMove += _zoomControl_MouseMove;
     resourceDictionary = new ResourceDictionary
     {
         Source =
             new Uri(
                 "/Treebank.Annotator;component/Templates/SentenceEditorViewTemplates.xaml",
                 UriKind.RelativeOrAbsolute)
     };
 }
예제 #6
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 2:
     this.zoomctrl = ((GraphX.Controls.ZoomControl)(target));
     return;
     case 3:
     this.Area = ((Modelisator.MonGraphX.GraphAreaExample)(target));
     return;
     }
     this._contentLoaded = true;
 }
예제 #7
0
        public void Dispose()
        {
            ClearEdgeBp();
            graphArea = null;
            if (zoomControl != null)
            {
                zoomControl.MouseMove -= _zoomControl_MouseMove;
            }

            zoomControl = null;
            resourceDictionary = null;
        }