/// <summary>
        /// Pop a <see cref="ZoomState"/> entry from the top of the stack, and apply the properties
        /// to the specified <see cref="GraphPane"/> object.
        /// </summary>
        /// <param name="pane">The <see cref="GraphPane"/> object to which the scale range
        /// information should be copied.</param>
        public void Pop(GraphPane pane)
        {
            if (!this.IsEmpty)
            {
                ZoomState state = (ZoomState)this.List[this.List.Count - 1];
                this.List.RemoveAt(this.List.Count - 1);

                state.ApplyState(pane);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Pop a <see cref="ZoomState"/> entry from the top of the stack, and apply the properties
        /// to the specified <see cref="GraphPane"/> object.
        /// </summary>
        /// <param name="pane">The <see cref="GraphPane"/> object to which the scale range
        /// information should be copied.</param>
        /// <returns>The <see cref="ZoomState"/> object that was "popped" from the stack and applied
        /// to the specified <see cref="GraphPane"/>.  null if no <see cref="ZoomState"/> was
        /// available (the stack was empty).</returns>
        public ZoomState Pop(GraphPane pane)
        {
            if (!this.IsEmpty)
            {
                ZoomState state = (ZoomState)this.List[this.List.Count - 1];
                this.List.RemoveAt(this.List.Count - 1);

                state.ApplyState(pane);
                return(state);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Pop the <see cref="ZoomState"/> entry from the bottom of the stack, and apply the properties
        /// to the specified <see cref="GraphPane"/> object.  Clear the stack completely.
        /// </summary>
        /// <param name="pane">The <see cref="GraphPane"/> object to which the scale range
        /// information should be copied.</param>
        /// <returns>The <see cref="ZoomState"/> object at the bottom of the stack that was applied
        /// to the specified <see cref="GraphPane"/>.  null if no <see cref="ZoomState"/> was
        /// available (the stack was empty).</returns>
        public ZoomState PopAll(GraphPane pane)
        {
            if (!this.IsEmpty)
            {
                ZoomState state = (ZoomState)this.List[0];
                this.List.Clear();

                state.ApplyState(pane);

                return(state);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Restore the states of the GraphPanes to a previously saved condition (via
        /// <see cref="ZoomStateSave" />.  This is essentially an "undo" for live
        /// pan and scroll actions.  Restores a single
        /// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized
        /// (see <see cref="IsSynchronizeXAxes" /> and <see cref="IsSynchronizeYAxes" />),
        /// or save a list of states for all GraphPanes if the panes are synchronized.
        /// </summary>
        /// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations
        /// are taking place</param>
        private void ZoomStateRestore(GraphPane primaryPane)
        {
            if (_isSynchronizeXAxes || _isSynchronizeYAxes)
            {
                for (int i = 0; i < _masterPane._paneList.Count; i++)
                {
                    if (i < _zoomStateStack.Count)
                    {
                        _zoomStateStack[i].ApplyState(_masterPane._paneList[i]);
                    }
                }
            }
            else if (_zoomState != null)
            {
                _zoomState.ApplyState(primaryPane);
            }

            ZoomStateClear();
        }
Beispiel #5
0
        protected override void DoTest()
        {
            // IsPauseForScreenShots = true;
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("SplitGraphUnitTest.sky")));
            CollectionAssert.AreEqual(new[]{"SplitGraph_rev1.clib"}, SkylineWindow.Document.Settings.PeptideSettings.Libraries.LibrarySpecs
                .Select(spec => Path.GetFileName(spec.FilePath)).ToArray());
            WaitForDocumentLoaded();
            // Test that AutoZoomNone and AutoZoomBestPeak work
            var graphChromatogram = Application.OpenForms.OfType<GraphChromatogram>().First();
            var graphChromatogramGraphControl = AllControls(graphChromatogram).OfType<ZedGraphControl>().First();
            RunUI(() =>
                {
                    // Select the first transition group
                    SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo(2, 0);
                    SkylineWindow.AutoZoomBestPeak();
                    // Make sure that we are zoomed in to approximately the best peak
                    Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 13.0, 1.0);
                    Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Max, 14.0, 1.0);
                    // Remember the zoom state so that we can pretend to manually zoom later
                    var zoomStateAuto = new ZoomState(graphChromatogramGraphControl.GraphPane, ZoomState.StateType.Zoom);
                    SkylineWindow.AutoZoomNone();
                    Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 0.0, 1.0);
                    Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Max, 35.0, 1.0);
                    // Pretend to manually zoom
                    zoomStateAuto.ApplyState(graphChromatogramGraphControl.GraphPane);
                    Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 13.0, 1.0);
                    // Select some other transition group:
                    SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo(2, 1);
                    SkylineWindow.ShowPeakAreaReplicateComparison();
                });
            WaitForGraphs();
            // Ensure that we zoomed out when the selected transition group changed
            Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 0.0, 1.0);

            var peakAreaSummary = Application.OpenForms.OfType<GraphSummary>().First();
            var graphLibraryMatch = Application.OpenForms.OfType<GraphSpectrum>().First();
            var libraryMatchGraphControl = AllControls(graphLibraryMatch).OfType<ZedGraphControl>().First();
            RunUI(() =>
                {
                    Assert.IsTrue(Settings.Default.ShowLibraryChromatograms);
                    AssertCurveListsSame(graphChromatogram.CurveList,
                                         libraryMatchGraphControl.GraphPane.CurveList);
                    AssertCurveListsSame(graphChromatogram.CurveList,
                                         peakAreaSummary.GraphControl.GraphPane.CurveList);
                    Assert.AreEqual(9, graphChromatogram.CurveList.Count);
                    Assert.AreEqual(1, graphChromatogramGraphControl.MasterPane.PaneList.Count);
                    Assert.AreEqual(1, peakAreaSummary.GraphControl.MasterPane.PaneList.Count);
                    SkylineWindow.ShowPrecursorTransitions();
                    Assert.AreEqual(3, graphChromatogram.CurveList.Count);
                    // TODO(nicksh): Enable this when libraries filter based on precursor/product
                    //AssertCurveListsSame(graphChromatogram.CurveList, libraryMatchGraphControl.GraphPane.CurveList);
                    AssertCurveListsSame(graphChromatogram.CurveList,
                                         peakAreaSummary.GraphControl.GraphPane.CurveList);
                    SkylineWindow.ShowProductTransitions();
                    Assert.AreEqual(6, graphChromatogram.CurveList.Count);
                    // TODO(nicksh): Enable this when libraries filter based on precursor/product
                    AssertCurveListsSame(graphChromatogram.CurveList,
                      libraryMatchGraphControl.GraphPane.CurveList);
                    AssertCurveListsSame(graphChromatogram.CurveList,
                                         peakAreaSummary.GraphControl.GraphPane.CurveList);
                    SkylineWindow.ShowAllTransitions();
                    SkylineWindow.ShowSplitChromatogramGraph(true);
                });
            WaitForGraphs();
            Assert.AreEqual(2, graphChromatogramGraphControl.MasterPane.PaneList.Count);
            Assert.AreEqual(2, peakAreaSummary.GraphControl.MasterPane.PaneList.Count);
            AssertCurveListsSame(graphChromatogram.GetCurveList(graphChromatogramGraphControl.MasterPane.PaneList[0]),
                peakAreaSummary.GraphControl.MasterPane.PaneList[0].CurveList);
            AssertCurveListsSame(graphChromatogram.GetCurveList(graphChromatogramGraphControl.MasterPane.PaneList[1]),
                peakAreaSummary.GraphControl.MasterPane.PaneList[1].CurveList);
        }
Beispiel #6
0
 private void ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
 {
     if (sender == zedGraphControl1)
     {
         newState.ApplyState(zedGraphControl2.GraphPane);
         zedGraphControl2.Invalidate();
         zedGraphControl2.AxisChange();
     } else {
         newState.ApplyState(zedGraphControl1.GraphPane);
         zedGraphControl1.Invalidate();
         zedGraphControl1.AxisChange();
     }
 }
 public void ZoomTo(ZoomState zoomState)
 {
     zoomState.ApplyState(GraphPanes.First());
 }
Beispiel #8
0
 private MSGraphPane InsertMsGraphPane(MSGraphControl graphControl, int iInsert)
 {
     var pane = new MSGraphPane
     {
         Border = { IsVisible = false },
         AllowCurveOverlap = true,
     };
     ApplySettingsToGraphPane(pane);
     var primaryPane = graphControl.GraphPane;
     pane.CurrentItemType = primaryPane.CurrentItemType;
     pane.ZoomStack.AddRange(primaryPane.ZoomStack);
     var zoomState = new ZoomState(primaryPane, ZoomState.StateType.Zoom);
     zoomState.ApplyState(pane);
     pane.YAxis.Title.Text = primaryPane.YAxis.Title.Text;
     pane.XAxis.Title.Text = primaryPane.XAxis.Title.Text;
     graphControl.MasterPane.PaneList.Insert(iInsert, pane);
     return pane;
 }