Example #1
0
        public bool ExportGlobalCorrespondencesChart(object ownerViewModel, SyllablePosition syllablePosition, int frequencyFilter)
        {
            FileDialogResult result = _dialogService.ShowSaveFileDialog("Export Global Correspondences Chart", this, new FileType("PNG image", ".png"));

            if (result.IsValid)
            {
                IBidirectionalGraph <GlobalCorrespondencesGraphVertex, GlobalCorrespondencesGraphEdge> graph = _graphService.GenerateGlobalCorrespondencesGraph(syllablePosition);

                var graphLayout = new GlobalCorrespondencesGraphLayout
                {
                    IsAnimationEnabled       = false,
                    CreationTransition       = null,
                    DestructionTransition    = null,
                    LayoutAlgorithmType      = "Grid",
                    EdgeRoutingAlgorithmType = "Bundle",
                    EdgeRoutingParameters    = new BundleEdgeRoutingParameters {
                        InkCoefficient = 0, LengthCoefficient = 1, VertexMargin = 2
                    },
                    Graph            = graph,
                    Background       = Brushes.White,
                    WeightFilter     = frequencyFilter,
                    SyllablePosition = syllablePosition
                };
                graphLayout.Resources[typeof(EdgeControl)] = System.Windows.Application.Current.Resources["GlobalCorrespondenceEdgeControlStyle"];
                SaveElement(graphLayout, result.FileName, null);
                return(true);
            }

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

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

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