Example #1
0
        public bool ExportNetworkGraph(object ownerViewModel, SimilarityMetric similarityMetric, double scoreFilter)
        {
            FileDialogResult result = _dialogService.ShowSaveFileDialog("Export Network Graph", this, new FileType("PNG image", ".png"));

            if (result.IsValid)
            {
                IBidirectionalGraph <NetworkGraphVertex, NetworkGraphEdge> graph = _graphService.GenerateNetworkGraph(similarityMetric);

                var graphLayout = new NetworkGraphLayout
                {
                    IsAnimationEnabled    = false,
                    CreationTransition    = null,
                    DestructionTransition = null,
                    LayoutAlgorithmType   = "StressMajorization",
                    LayoutParameters      = new StressMajorizationLayoutParameters {
                        WeightAdjustment = 1.0
                    },
                    OverlapRemovalAlgorithmType = "FSA",
                    OverlapRemovalParameters    = new OverlapRemovalParameters {
                        HorizontalGap = 2, VerticalGap = 2
                    },
                    Graph        = graph,
                    Background   = Brushes.White,
                    WeightFilter = scoreFilter
                };
                SaveElement(graphLayout, result.FileName, null);
                return(true);
            }

            return(false);
        }
Example #2
0
        public bool ExportCurrentNetworkGraph(object ownerViewModel)
        {
            FileDialogResult result = _dialogService.ShowSaveFileDialog("Export Network Graph", ownerViewModel, new FileType("PNG image", ".png"));

            if (result.IsValid)
            {
                NetworkGraphLayout graphLayout = System.Windows.Application.Current.MainWindow.FindVisualDescendants <NetworkGraphLayout>().FirstOrDefault();
                if (graphLayout == null)
                {
                    throw new InvalidOperationException();
                }

                SaveElement(graphLayout, result.FileName, null);
                return(true);
            }
            return(false);
        }