Example #1
0
        public override void AddAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
        {
            // ReSharper disable UseObjectOrCollectionInitializer
            foreach (var rmi in SpectrumInfo.PeaksMatched)
            {
                if (!IsVisibleIon(rmi))
                {
                    continue;
                }

                var matchedIon = rmi.MatchedIons.First(IsVisibleIon);

                Color color;
                switch (matchedIon.IonType)
                {
                default: color = COLOR_NONE; break;

                case IonType.a: color = COLOR_A; break;

                case IonType.x: color = COLOR_X; break;

                case IonType.b: color = COLOR_B; break;

                case IonType.y: color = COLOR_Y; break;

                case IonType.c: color = COLOR_C; break;

                case IonType.z: color = COLOR_Z; break;

                case IonType.custom: color = (rmi.Rank > 0) ? COLOR_OTHER_IONS : COLOR_NONE; break;     // Small molecule fragments - only color if ranked

                case IonType.precursor: color = COLOR_PRECURSOR; break;
                }

                if (rmi.MatchedIons.Any(mfi => IsMatch(mfi.PredictedMz)))
                {
                    color = COLOR_SELECTED;
                }

                double mz    = rmi.ObservedMz;
                var    stick = new LineObj(color, mz, rmi.Intensity, mz, 0);
                stick.IsClippedToChartRect     = true;
                stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                stick.Line.Width = LineWidth + 1;
                annotations.Add(stick);
            }
            //ReSharper restore UseObjectOrCollectionInitializer
        }
Example #2
0
        public override void AddAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
        {
            // ReSharper disable UseObjectOrCollectionInitializer
            foreach (var rmi in SpectrumInfo.PeaksMatched)
            {
                if (!IsVisibleIon(rmi))
                {
                    continue;
                }

                IonType type = IsVisibleIon(rmi.IonType, rmi.Ordinal, rmi.Charge) ?
                               rmi.IonType : rmi.IonType2;

                Color color;
                switch (type)
                {
                default: color = COLOR_NONE; break;

                case IonType.a: color = COLOR_A; break;

                case IonType.x: color = COLOR_X; break;

                case IonType.b: color = COLOR_B; break;

                case IonType.y: color = COLOR_Y; break;

                case IonType.c: color = COLOR_C; break;

                case IonType.z: color = COLOR_Z; break;

                // FUTURE: Add custom ions when LibraryRankedSpectrumInfo can support them
                case IonType.precursor: color = COLOR_PRECURSOR; break;
                }

                if (IsMatch(rmi.PredictedMz))
                {
                    color = COLOR_SELECTED;
                }

                double mz    = rmi.ObservedMz;
                var    stick = new LineObj(color, mz, rmi.Intensity, mz, 0);
                stick.IsClippedToChartRect     = true;
                stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                stick.Line.Width = LineWidth + 1;
                annotations.Add(stick);
            }
            //ReSharper restore UseObjectOrCollectionInitializer
        }
Example #3
0
 public override void AddAnnotations(MSGraphPane graphPane, Graphics g,
     MSPointList pointList, GraphObjList annotations)
 {
 }
Example #4
0
        public override void AddAnnotations(MSGraphPane graphPane, Graphics g,
                                            MSPointList pointList, GraphObjList annotations)
        {
            if (Chromatogram == null)
            {
                return;
            }


            // Calculate maximum y for potential retention time indicators
            PointF ptTop = new PointF(0, graphPane.Chart.Rect.Top);

            if (GraphChromatogram.ShowRT != ShowRTChrom.none)
            {
                if (RetentionMsMs != null)
                {
                    foreach (double retentionTime in RetentionMsMs)
                    {
                        Color color = COLOR_MSMSID_TIME;
                        if (SelectedRetentionMsMs.HasValue && Equals((float)retentionTime, (float)SelectedRetentionMsMs))
                        {
                            color = ColorSelected;
                        }
                        AddRetentionTimeAnnotation(graphPane, g, annotations, ptTop,
                                                   Resources.ChromGraphItem_AddAnnotations_ID, GraphObjType.ms_ms_id, color,
                                                   ScaleRetentionTime(retentionTime));
                    }
                }
                if (MidasRetentionMsMs != null)
                {
                    foreach (var retentionTime in MidasRetentionMsMs)
                    {
                        var color = SelectedRetentionMsMs.HasValue && Equals((float)retentionTime, (float)SelectedRetentionMsMs)
                            ? ColorSelected
                            : COLOR_MSMSID_TIME;
                        AddRetentionTimeAnnotation(graphPane, g, annotations, ptTop, string.Empty, GraphObjType.midas_spectrum, color, ScaleRetentionTime(retentionTime));
                    }
                }
                if (AlignedRetentionMsMs != null)
                {
                    foreach (var time in AlignedRetentionMsMs)
                    {
                        var scaledTime = ScaleRetentionTime(time);
                        var line       = new LineObj(COLOR_ALIGNED_MSMSID_TIME, scaledTime.DisplayTime, 0,
                                                     scaledTime.DisplayTime, 1)
                        {
                            ZOrder               = ZOrder.F_BehindGrid,
                            Location             = { CoordinateFrame = CoordType.XScaleYChartFraction },
                            IsClippedToChartRect = true,
                            Tag = new GraphObjTag(this, GraphObjType.aligned_ms_id, scaledTime),
                        };
                        annotations.Add(line);
                    }
                }
                if (UnalignedRetentionMsMs != null)
                {
                    foreach (var time in UnalignedRetentionMsMs)
                    {
                        var scaledTime = ScaleRetentionTime(time);
                        var line       = new LineObj(COLOR_UNALIGNED_MSMSID_TIME, scaledTime.DisplayTime, 0,
                                                     scaledTime.DisplayTime, 1)
                        {
                            ZOrder               = ZOrder.F_BehindGrid,
                            Location             = { CoordinateFrame = CoordType.XScaleYChartFraction },
                            IsClippedToChartRect = true,
                            Tag = new GraphObjTag(this, GraphObjType.unaligned_ms_id, scaledTime),
                        };
                        annotations.Add(line);
                    }
                }
            }

            // Draw retention time indicator, if set
            if (RetentionPrediction.HasValue)
            {
                double time = RetentionPrediction.Value;

                // Create temporary label to calculate positions
                if (GraphChromatogram.ShowRT != ShowRTChrom.none)
                {
                    AddRetentionTimeAnnotation(graphPane,
                                               g,
                                               annotations,
                                               ptTop,
                                               Resources.ChromGraphItem_AddAnnotations_Predicted,
                                               GraphObjType.predicted_rt_window,
                                               COLOR_RETENTION_TIME,
                                               ScaleRetentionTime(time));
                }

                // Draw background for retention time window
                if (RetentionWindow > 0)
                {
                    double x1  = ScaleRetentionTime(time - RetentionWindow / 2).DisplayTime;
                    double x2  = ScaleRetentionTime(time + RetentionWindow / 2).DisplayTime;
                    BoxObj box = new BoxObj(x1, 0, x2 - x1, 1,
                                            COLOR_RETENTION_WINDOW, COLOR_RETENTION_WINDOW)
                    {
                        Location             = { CoordinateFrame = CoordType.XScaleYChartFraction },
                        IsClippedToChartRect = true,
                        ZOrder = ZOrder.F_BehindGrid
                    };
                    annotations.Add(box);
                }
            }

            if (RetentionExplicit != null && GraphChromatogram.ShowRT != ShowRTChrom.none)
            {
                // Create temporary label to calculate positions
                AddRetentionTimeAnnotation(graphPane,
                                           g,
                                           annotations,
                                           ptTop,
                                           Resources.ChromGraphItem_AddAnnotations_Explicit,
                                           GraphObjType.predicted_rt_window,
                                           COLOR_RETENTION_TIME,
                                           ScaleRetentionTime(RetentionExplicit.RetentionTime));
            }

            for (int i = 0, len = Chromatogram.NumPeaks; i < len; i++)
            {
                if (_arrayLabelIndexes[i] == -1)
                {
                    continue;
                }

                double maxIntensity = _intensities[_arrayLabelIndexes[i]];

                // Show peak extent indicators, if they are far enough apart
                ChromPeak peak = Chromatogram.GetPeak(i);
                AddPeakBoundaries(graphPane, annotations, false,
                                  ScaleRetentionTime(peak.StartTime), ScaleRetentionTime(peak.EndTime), maxIntensity);
            }
        }
Example #5
0
        public override void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g,
                                                    MSPointList pointList, GraphObjList annotations)
        {
            if (Chromatogram == null)
            {
                return;
            }

            // Give priority to showing the best peak text object above all other annotations
            if (DragInfo != null || (!HideBest && TransitionChromInfo != null) || CurveAnnotation != null)
            {
                // Show text and arrow for the best peak
                double intensityBest = 0;
                if (_bestPeakTimeIndex != -1)
                {
                    ScaledRetentionTime timeBest = new ScaledRetentionTime(_measuredTimes[_bestPeakTimeIndex], _displayTimes[_bestPeakTimeIndex]);
                    float xBest = graphPane.XAxis.Scale.Transform(timeBest.DisplayTime);
                    intensityBest = _intensities[_bestPeakTimeIndex];
                    float yBest = graphPane.YAxis.Scale.Transform(intensityBest);

                    if (GraphChromatogram.ShowRT != ShowRTChrom.none || DragInfo != null)
                    {
                        // Best peak gets its own label to avoid curve overlap detection
                        double intensityLabel = graphPane.YAxis.Scale.ReverseTransform(yBest - 5);
                        float? massError      = Settings.Default.ShowMassError && TransitionChromInfo != null
                                               ? TransitionChromInfo.MassError
                                               : null;
                        double dotProduct = _dotProducts != null ? _bestProduct : 0;

                        TextObj text;
                        if (CurveAnnotation != null)
                        {
                            // Darken peptide name a little so light colors stand out against the white background.
                            var color = FontSpec.FontColor;
                            if (!GraphInfo.IsSelected)
                            {
                                color = Color.FromArgb(color.R * 7 / 10, color.G * 7 / 10, color.B * 7 / 10);
                            }
                            var fontSpec = new FontSpec(FontSpec)
                            {
                                FontColor = color, Angle = 90
                            };
                            if (GraphInfo.IsSelected)
                            {
                                fontSpec = new FontSpec(fontSpec)
                                {
                                    IsBold = true, Size = fontSpec.Size + 2, IsAntiAlias = true
                                }
                            }
                            ;

                            // Display peptide name label using vertical text.
                            text = new TextObj(CurveAnnotation, timeBest.DisplayTime, intensityLabel,
                                               CoordType.AxisXYScale, AlignH.Left, AlignV.Center)
                            {
                                ZOrder = ZOrder.A_InFront,
                                IsClippedToChartRect = true,
                                FontSpec             = fontSpec,
                                Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest),
                            };
                        }
                        else
                        {
                            string label = FormatTimeLabel(timeBest.DisplayTime, massError, dotProduct);

                            text = new TextObj(label, timeBest.DisplayTime, intensityLabel,
                                               CoordType.AxisXYScale, AlignH.Center, AlignV.Bottom)
                            {
                                ZOrder = ZOrder.A_InFront,
                                IsClippedToChartRect = true,
                                FontSpec             = FontSpec,
                                Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest),
                            };
                        }

                        annotations.Add(text);
                    }

                    // If showing multiple peptides, skip the best peak arrow indicator.
                    if (CurveAnnotation == null)
                    {
                        // Show the best peak arrow indicator
                        double timeArrow      = graphPane.XAxis.Scale.ReverseTransform(xBest - 4);
                        double intensityArrow = graphPane.YAxis.Scale.ReverseTransform(yBest - 2);

                        ArrowObj arrow = new ArrowObj(COLOR_BEST_PEAK, 12f,
                                                      timeArrow, intensityArrow, timeArrow, intensityArrow)
                        {
                            Location             = { CoordinateFrame = CoordType.AxisXYScale },
                            IsArrowHead          = true,
                            IsClippedToChartRect = true,
                            ZOrder = ZOrder.A_InFront
                        };
                        annotations.Add(arrow);
                    }
                }

                // Show the best peak boundary lines
                if (CurveAnnotation == null)
                {
                    double startTime = 0, endTime = 0;
                    if (DragInfo != null)
                    {
                        startTime = DragInfo.StartTime.MeasuredTime;
                        endTime   = DragInfo.EndTime.MeasuredTime;
                    }
                    else if (TransitionChromInfo != null)
                    {
                        var tranPeakInfo = TransitionChromInfo;
                        startTime = tranPeakInfo.StartRetentionTime;
                        endTime   = tranPeakInfo.EndRetentionTime;
                    }
                    AddPeakBoundaries(graphPane, annotations, true,
                                      ScaleRetentionTime(startTime), ScaleRetentionTime(endTime), intensityBest);
                }
                if (Chromatogram.BestPeakIndex >= 0)
                {
                    // Only shade peak when user modified. Otherwise, shading can be added when an entire
                    // precursor was force integrated because of another precursor (e.g. heavy) since that
                    // leads to an empty peak, which will not match the best peak.
                    if (Settings.Default.ShowOriginalPeak && TransitionChromInfo != null && TransitionChromInfo.IsUserModified)
                    {
                        var bestPeak = Chromatogram.GetPeak(Chromatogram.BestPeakIndex);
                        if (bestPeak.StartTime != TransitionChromInfo.StartRetentionTime ||
                            bestPeak.EndTime != TransitionChromInfo.EndRetentionTime)
                        {
                            AddOriginalPeakAnnotation(bestPeak, annotations, graphPane);
                        }
                    }
                }
            }
            if (_displayRawTimes.HasValue)
            {
                AddPeakRawTimes(graphPane, annotations,
                                ScaleRetentionTime(_displayRawTimes.Value.StartBound),
                                ScaleRetentionTime(_displayRawTimes.Value.EndBound),
                                Chromatogram);
            }
        }
Example #6
0
 public abstract void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g,
                                             MSPointList pointList, GraphObjList annotations);
Example #7
0
 public override void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
 {
     // Do nothing
 }
Example #8
0
 public void AddAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
 {
 }
Example #9
0
        public override void AddAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
        {
            // ReSharper disable UseObjectOrCollectionInitializer
            foreach (var rmi in SpectrumInfo.PeaksMatched)
            {
                if (!IsVisibleIon(rmi))
                {
                    continue;
                }

                var matchedIon = rmi.MatchedIons.First(IsVisibleIon);

                Color color;
                switch (matchedIon.IonType)
                {
                default: color = COLOR_NONE; break;

                case IonType.a: color = COLOR_A; break;

                case IonType.x: color = COLOR_X; break;

                case IonType.b: color = COLOR_B; break;

                case IonType.y: color = COLOR_Y; break;

                case IonType.c: color = COLOR_C; break;

                case IonType.z: color = COLOR_Z; break;

                case IonType.custom: color = (rmi.Rank > 0) ? COLOR_OTHER_IONS : COLOR_NONE; break;     // Small molecule fragments - only color if ranked

                case IonType.precursor: color = COLOR_PRECURSOR; break;
                }

                if (Invert)
                {
                    color = InvertColor(color);
                }

                if (rmi.MatchedIons.Any(mfi => IsMatch(mfi.PredictedMz)))
                {
                    color = COLOR_SELECTED;
                }

                double mz        = rmi.ObservedMz;
                var    intensity = Invert ? -rmi.Intensity : rmi.Intensity;
                var    stick     = new LineObj(color, mz, intensity, mz, 0);
                stick.IsClippedToChartRect     = true;
                stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                stick.Line.Width = LineWidth + 1;
                annotations.Add(stick);
            }
            //ReSharper restore UseObjectOrCollectionInitializer

            if (ShowScores && SpectrumInfo.Score.HasValue)
            {
                var text = new TextObj(
                    string.Format(LocalizationHelper.CurrentCulture, Resources.AbstractSpectrumGraphItem_AddAnnotations_, SpectrumInfo.Score),
                    0.01, 0, CoordType.ChartFraction, AlignH.Left, AlignV.Top)
                {
                    IsClippedToChartRect = true,
                    ZOrder   = ZOrder.E_BehindCurves,
                    FontSpec = GraphSummary.CreateFontSpec(Color.Black),
                };
                annotations.Add(text);
            }
        }
Example #10
0
 public abstract void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g,
     MSPointList pointList, GraphObjList annotations);
Example #11
0
        public override void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g,
            MSPointList pointList, GraphObjList annotations)
        {
            if (Chromatogram == null)
                return;

            // Give priority to showing the best peak text object above all other annotations
            if (DragInfo != null || (!HideBest && TransitionChromInfo != null) || CurveAnnotation != null)
            {
                // Show text and arrow for the best peak
                double intensityBest = 0;
                if (_bestPeakTimeIndex != -1)
                {
                    ScaledRetentionTime timeBest = new ScaledRetentionTime(_measuredTimes[_bestPeakTimeIndex], _displayTimes[_bestPeakTimeIndex]);
                    float xBest = graphPane.XAxis.Scale.Transform(timeBest.DisplayTime);
                    intensityBest = _intensities[_bestPeakTimeIndex];
                    float yBest = graphPane.YAxis.Scale.Transform(intensityBest);

                    if (GraphChromatogram.ShowRT != ShowRTChrom.none || DragInfo != null)
                    {
                        // Best peak gets its own label to avoid curve overlap detection
                        double intensityLabel = graphPane.YAxis.Scale.ReverseTransform(yBest - 5);
                        float? massError = Settings.Default.ShowMassError && TransitionChromInfo != null
                                               ? TransitionChromInfo.MassError
                                               : null;
                        double dotProduct = _dotProducts != null ? _bestProduct : 0;

                        TextObj text;
                        if (CurveAnnotation != null)
                        {
                            // Darken peptide name a little so light colors stand out against the white background.
                            var color = FontSpec.FontColor;
                            if (!GraphInfo.IsSelected)
                                color = Color.FromArgb(color.R*7/10, color.G*7/10, color.B*7/10);
                            var fontSpec = new FontSpec(FontSpec) { FontColor = color, Angle = 90 };
                            if (GraphInfo.IsSelected)
                                fontSpec = new FontSpec(fontSpec) {IsBold = true, Size = fontSpec.Size + 2, IsAntiAlias = true};

                            // Display peptide name label using vertical text.
                            text = new TextObj(CurveAnnotation, timeBest.DisplayTime, intensityLabel,
                                CoordType.AxisXYScale, AlignH.Left, AlignV.Center)
                            {
                                ZOrder = ZOrder.A_InFront,
                                IsClippedToChartRect = true,
                                FontSpec = fontSpec,
                                Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest),
                            };
                        }
                        else
                        {
                            string label = FormatTimeLabel(timeBest.DisplayTime, massError, dotProduct);

                            text = new TextObj(label, timeBest.DisplayTime, intensityLabel,
                                CoordType.AxisXYScale, AlignH.Center, AlignV.Bottom)
                            {
                                ZOrder = ZOrder.A_InFront,
                                IsClippedToChartRect = true,
                                FontSpec = FontSpec,
                                Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest),
                            };
                        }

                        annotations.Add(text);
                    }

                    // If showing multiple peptides, skip the best peak arrow indicator.
                    if (CurveAnnotation == null)
                    {
                        // Show the best peak arrow indicator
                        double timeArrow = graphPane.XAxis.Scale.ReverseTransform(xBest - 4);
                        double intensityArrow = graphPane.YAxis.Scale.ReverseTransform(yBest - 2);

                        ArrowObj arrow = new ArrowObj(COLOR_BEST_PEAK, 12f,
                            timeArrow, intensityArrow, timeArrow, intensityArrow)
                        {
                            Location = {CoordinateFrame = CoordType.AxisXYScale},
                            IsArrowHead = true,
                            IsClippedToChartRect = true,
                            ZOrder = ZOrder.A_InFront
                        };
                        annotations.Add(arrow);
                    }
                }

                // Show the best peak boundary lines
                if (CurveAnnotation == null)
                {
                    double startTime = 0, endTime = 0;
                    if (DragInfo != null)
                    {
                        startTime = DragInfo.StartTime.MeasuredTime;
                        endTime = DragInfo.EndTime.MeasuredTime;
                    }
                    else if (TransitionChromInfo != null)
                    {
                        var tranPeakInfo = TransitionChromInfo;
                        startTime = tranPeakInfo.StartRetentionTime;
                        endTime = tranPeakInfo.EndRetentionTime;
                    }
                    AddPeakBoundaries(graphPane, annotations, true,
                        ScaleRetentionTime(startTime), ScaleRetentionTime(endTime), intensityBest);
                }
            }
        }
Example #12
0
        public override void AddAnnotations(MSGraphPane graphPane, Graphics g,
            MSPointList pointList, GraphObjList annotations)
        {
            if (Chromatogram == null)
                return;

            // Calculate maximum y for potential retention time indicators
            PointF ptTop = new PointF(0, graphPane.Chart.Rect.Top);

            if (GraphChromatogram.ShowRT != ShowRTChrom.none)
            {
                if (RetentionMsMs != null)
                {
                    foreach (double retentionTime in RetentionMsMs)
                    {
                        Color color = COLOR_MSMSID_TIME;
                        if (SelectedRetentionMsMs.HasValue && Equals((float) retentionTime, (float) SelectedRetentionMsMs))
                        {
                            color = ColorSelected;
                        }
                        AddRetentionTimeAnnotation(graphPane, g, annotations, ptTop,
                            Resources.ChromGraphItem_AddAnnotations_ID, GraphObjType.ms_ms_id, color,
                            ScaleRetentionTime(retentionTime));
                    }
                }
                if (AlignedRetentionMsMs != null)
                {
                    foreach (var time in AlignedRetentionMsMs)
                    {
                        var scaledTime = ScaleRetentionTime(time);
                        var line = new LineObj(COLOR_ALIGNED_MSMSID_TIME, scaledTime.DisplayTime, 0,
                                               scaledTime.DisplayTime, 1)
                        {
                            ZOrder = ZOrder.F_BehindGrid,
                            Location = { CoordinateFrame = CoordType.XScaleYChartFraction },
                            IsClippedToChartRect = true,
                            Tag = new GraphObjTag(this, GraphObjType.aligned_ms_id, scaledTime),
                        };
                        annotations.Add(line);
                    }
                }
                if (UnalignedRetentionMsMs != null)
                {
                    foreach (var time in UnalignedRetentionMsMs)
                    {
                        var scaledTime = ScaleRetentionTime(time);
                        var line = new LineObj(COLOR_UNALIGNED_MSMSID_TIME, scaledTime.DisplayTime, 0,
                                               scaledTime.DisplayTime, 1)
                        {
                            ZOrder = ZOrder.F_BehindGrid,
                            Location = { CoordinateFrame = CoordType.XScaleYChartFraction },
                            IsClippedToChartRect = true,
                            Tag = new GraphObjTag(this, GraphObjType.unaligned_ms_id, scaledTime),
                        };
                        annotations.Add(line);
                    }
                }
            }

            // Draw retention time indicator, if set
            if (RetentionPrediction.HasValue)
            {
                double time = RetentionPrediction.Value;

                // Create temporary label to calculate positions
                if (GraphChromatogram.ShowRT != ShowRTChrom.none)
                {
                    AddRetentionTimeAnnotation(graphPane,
                                               g,
                                               annotations,
                                               ptTop,
                                               Resources.ChromGraphItem_AddAnnotations_Predicted,
                                               GraphObjType.predicted_rt_window,
                                               COLOR_RETENTION_TIME,
                                               ScaleRetentionTime(time));
                }

                // Draw background for retention time window
                if (RetentionWindow > 0)
                {
                    double x1 = ScaleRetentionTime(time - RetentionWindow/2).DisplayTime;
                    double x2 = ScaleRetentionTime(time + RetentionWindow/2).DisplayTime;
                    BoxObj box = new BoxObj(x1, 0, x2-x1, 1,
                                            COLOR_RETENTION_WINDOW, COLOR_RETENTION_WINDOW)
                                     {
                                         Location = { CoordinateFrame = CoordType.XScaleYChartFraction },
                                         IsClippedToChartRect = true,
                                         ZOrder = ZOrder.F_BehindGrid
                                     };
                    annotations.Add(box);
                }
            }

            if (RetentionExplicit != null && GraphChromatogram.ShowRT != ShowRTChrom.none)
            {
                // Create temporary label to calculate positions
                AddRetentionTimeAnnotation(graphPane,
                                            g,
                                            annotations,
                                            ptTop,
                                            Resources.ChromGraphItem_AddAnnotations_Explicit,
                                            GraphObjType.predicted_rt_window,
                                            COLOR_RETENTION_TIME,
                                            ScaleRetentionTime(RetentionExplicit.RetentionTime));
            }

            for (int i = 0, len = Chromatogram.NumPeaks; i < len; i++)
            {
                if (_arrayLabelIndexes[i] == -1)
                    continue;

                double maxIntensity = _intensities[_arrayLabelIndexes[i]];

                // Show peak extent indicators, if they are far enough apart
                ChromPeak peak = Chromatogram.GetPeak(i);
                AddPeakBoundaries(graphPane, annotations, false,
                                  ScaleRetentionTime(peak.StartTime), ScaleRetentionTime(peak.EndTime), maxIntensity);
            }
        }
Example #13
0
 public override void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
 {
     // Do nothing
 }
Example #14
0
        public override void AddAnnotations(MSGraphPane graphPane, Graphics g, MSPointList pointList, GraphObjList annotations)
        {
            // ReSharper disable UseObjectOrCollectionInitializer
            foreach (var rmi in SpectrumInfo.PeaksMatched)
            {
                if (!IsVisibleIon(rmi))
                    continue;

                IonType type = IsVisibleIon(rmi.IonType, rmi.Ordinal, rmi.Charge) ?
                                                                                      rmi.IonType : rmi.IonType2;

                Color color;
                switch (type)
                {
                    default: color = COLOR_NONE; break;
                    case IonType.a: color = COLOR_A; break;
                    case IonType.x: color = COLOR_X; break;
                    case IonType.b: color = COLOR_B; break;
                    case IonType.y: color = COLOR_Y; break;
                    case IonType.c: color = COLOR_C; break;
                    case IonType.z: color = COLOR_Z; break;
                    // FUTURE: Add custom ions when LibraryRankedSpectrumInfo can support them
                    case IonType.precursor: color = COLOR_PRECURSOR; break;
                }

                if (IsMatch(rmi.PredictedMz))
                {
                    color = COLOR_SELECTED;
                }

                double mz = rmi.ObservedMz;
                var stick = new LineObj(color, mz, rmi.Intensity, mz, 0);
                stick.IsClippedToChartRect = true;
                stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                stick.Line.Width = LineWidth + 1;
                annotations.Add(stick);
            }
            //ReSharper restore UseObjectOrCollectionInitializer
        }