Exemplo n.º 1
0
        public void DoUpdateGraph(IControllerSplit graphController, GraphTypeSummary graphType)
        {
            var paneKeys = CalcPaneKeys(graphType);

            bool panesValid = paneKeys.SequenceEqual(GraphPanes.Select(pane => pane.PaneKey));

            if (panesValid)
            {
                switch (graphType)
                {
                case GraphTypeSummary.replicate:
                    panesValid = GraphPanes.All(graphController.IsReplicatePane);
                    break;

                case GraphTypeSummary.peptide:
                    panesValid = GraphPanes.All(graphController.IsPeptidePane);
                    break;
                }
            }
            if (panesValid)
            {
                return;
            }

            switch (graphType)
            {
            case GraphTypeSummary.replicate:
                GraphPanes = paneKeys.Select(graphController.CreateReplicatePane);
                break;

            case GraphTypeSummary.peptide:
                GraphPanes = paneKeys.Select(graphController.CreatePeptidePane);
                break;
            }
        }
Exemplo n.º 2
0
        private void UpdateGraph(bool checkData)
        {
            // Only worry about updates, if the graph is visible
            // And make sure it is not disposed, since rendering happens on a timer
            if (!Visible || IsDisposed)
            {
                return;
            }

            // Avoid updating when document container and state provider are out of sync
            if (!ReferenceEquals(DocumentUIContainer.Document, StateProvider.SelectionDocument))
            {
                return;
            }

            // CONSIDER: Need a better guarantee that this ratio index matches the
            //           one in the sequence tree, but at least this will keep the UI
            //           from crashing with IndexOutOfBoundsException.
            var mods = DocumentUIContainer.DocumentUI.Settings.PeptideSettings.Modifications;

            _ratioIndex = Math.Min(_ratioIndex, mods.RatioInternalStandardTypes.Count - 1);

            // Only show ratios if document changes to have valid ratios
            if (AreaGraphController.AreaView == AreaNormalizeToView.area_ratio_view && !mods.HasHeavyModifications)
            {
                AreaGraphController.AreaView = AreaNormalizeToView.none;
            }

            var graphPanesCurrent = GraphPanes.ToArray();

            _controller.OnUpdateGraph();
            var graphPanes = GraphPanes.ToArray();

            if (!graphPanesCurrent.SequenceEqual(graphPanes))
            {
                foreach (var pane in graphPanesCurrent)
                {
                    // Release any necessary resources from the old pane
                    var disposable = pane as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

                // Layout the new pane
                using (Graphics g = CreateGraphics())
                {
                    graphControl.MasterPane.SetLayout(g, PaneLayout.SingleColumn);
                }
            }

            foreach (var pane in graphPanes)
            {
                pane.UpdateGraph(checkData);
                GraphHelper.FormatGraphPane(pane);
                GraphHelper.FormatFontSize(pane, Settings.Default.AreaFontSize);
            }
            graphControl.Invalidate();
        }
Exemplo n.º 3
0
        private void UpdateGraph(bool selectionChanged)
        {
            // Only worry about updates, if the graph is visible
            // And make sure it is not disposed, since rendering happens on a timer
            if (!Visible || IsDisposed)
            {
                return;
            }

            // Avoid updating when document container and state provider are out of sync
            if (!ReferenceEquals(DocumentUIContainer.Document, StateProvider.SelectionDocument))
            {
                return;
            }

            var graphPanesCurrent = GraphPanes.ToArray();

            _controller.OnUpdateGraph();
            var graphPanes = GraphPanes.ToArray();

            if (!graphPanesCurrent.SequenceEqual(graphPanes))
            {
                foreach (var pane in graphPanesCurrent)
                {
                    // Release any necessary resources from the old pane
                    var disposable = pane as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

                // Layout the new pane
                using (Graphics g = CreateGraphics())
                {
                    graphControl.MasterPane.SetLayout(g, PaneLayout.SingleColumn);
                }
            }

            foreach (var pane in graphPanes)
            {
                pane.UpdateGraph(selectionChanged);
                GraphHelper.FormatGraphPane(pane);
                GraphHelper.FormatFontSize(pane, Settings.Default.AreaFontSize);
            }
            graphControl.Invalidate();
        }
Exemplo n.º 4
0
        private void GraphSummary_KeyDown(object sender, KeyEventArgs e)
        {
            if (GraphPanes.First().HandleKeyDownEvent(sender, e))
            {
                return;
            }

            if (_controller.HandleKeyDownEvent(sender, e))
            {
                return;
            }

            switch (e.KeyCode)
            {
            case Keys.Escape:
                _documentContainer.FocusDocument();
                break;
            }
        }
Exemplo n.º 5
0
 public int CountCurves(Func <CurveItem, bool> isCounted)
 {
     return(GraphPanes.Sum(pane => pane.CurveList.Count(isCounted)));
 }