示例#1
0
 public CCurve()
 {
     for (int i = 0; i < UserMarkerArrayValues.Length; i++)
     {
         UserMarkerArrayValues[i] = new MarkersValues();
     }
 }
示例#2
0
        private DipoleDetected DetermineDipoleType(ref MarkersValues Marker)
        {
            if (Marker.LowFreq == -1 && Marker.HighFreq == -1)
            {
                return(DipoleDetected.FLAT);
            }

            if (Marker.LowFreq == -1)
            {
                return(DipoleDetected.LPF);
            }

            if (Marker.HighFreq == -1)
            {
                return(DipoleDetected.HPF);
            }

            return(DipoleDetected.BPF);
        }
示例#3
0
        public void ComputeMarkerFrequencies(ref MarkersValues dest,
                                             float fLevelToFind,
                                             int nMaxLevelIndex)
        {
            int nLeftIndex = Utility.FindLevelIndex(SpectrumValues, nMaxLevelIndex, -1, fLevelToFind);

            if (nLeftIndex != 0)
            {
                dest.LowFreq = nSpectrumLowFrequency + nLeftIndex * nFrequencyStep;
            }
            else
            {
                dest.LowFreq = -1;
            }

            int nRightIndex = Utility.FindLevelIndex(SpectrumValues, nMaxLevelIndex, 1, fLevelToFind);

            if (nRightIndex < SpectrumValues.Length - 1)
            {
                dest.HighFreq = nSpectrumLowFrequency + nRightIndex * nFrequencyStep;
            }
            else
            {
                dest.HighFreq = -1;
            }


            if (dest.LowFreq != -1 && dest.HighFreq != -1)
            {
                dest.BandPass = dest.HighFreq - dest.LowFreq;
            }
            else
            {
                dest.BandPass = -1;
            }
        }
示例#4
0
        void DrawLevel(float dB, MarkersValues Marker, Graphics g, CGraph Graph)
        {
            Pen mypenArrow = new Pen(Color.Black, 1.0f);
            Pen mypenHline = new Pen(Color.Black, 1.0f);

            mypenHline.DashStyle = DashStyle.Dash;

            Pen mypenVline = new Pen(Color.Black, LineWidth);

            mypenVline.DashStyle = DashStyle.DashDot;

            System.Drawing.StringFormat VerticalTextDrawFormat = new System.Drawing.StringFormat();
            VerticalTextDrawFormat.FormatFlags = StringFormatFlags.DirectionVertical;


            System.Drawing.Font SampleFont = new Font("Verdana", Graph.BitmapWhereDraw.Width / 120.0f);

            String ndB = ((int)dB).ToString() + "dB";

            bool bCliped = false;


            // bandpass
            if (Marker.HighFreq > 0 && Marker.LowFreq > 0)
            {
                // bandpass
                PointF HCoords1 = Graph.GetCoords(Marker.LowFreq, fMaxLeveldB + dB, ref bCliped);
                if (!bCliped)
                {
                    mypenHline.CustomStartCap = new AdjustableArrowCap(5.0f, 5.0f);
                }
                if (!bCliped)
                {
                    PointF VCoords1 = new PointF(HCoords1.X, Graph.UpBorder);
                    PointF VCoords2 = new PointF(HCoords1.X, Graph.BitmapWhereDraw.Height - Graph.LowBorder);
                    g.DrawLine(mypenVline, VCoords1, VCoords2);

                    PointF CoordVCenter = new PointF(VCoords1.X, 0.5f * (VCoords1.Y + VCoords2.Y));
                    g.DrawString(Utility.GetFrequencyStringAtBest(Marker.LowFreq), SampleFont, Brushes.Black, CoordVCenter, VerticalTextDrawFormat);
                }

                PointF HCoords2 = Graph.GetCoords(Marker.HighFreq, fMaxLeveldB + dB, ref bCliped);
                if (!bCliped)
                {
                    mypenHline.CustomEndCap = new AdjustableArrowCap(5.0f, 5.0f);
                }
                if (!bCliped)
                {
                    PointF VCoords1 = new PointF(HCoords2.X, Graph.UpBorder);
                    PointF VCoords2 = new PointF(HCoords2.X, Graph.BitmapWhereDraw.Height - Graph.LowBorder);
                    g.DrawLine(mypenVline, VCoords1, VCoords2);

                    PointF CoordVCenter = new PointF(VCoords1.X, 0.5f * (VCoords1.Y + VCoords2.Y));
                    g.DrawString(Utility.GetFrequencyStringAtBest(Marker.HighFreq), SampleFont, Brushes.Black, CoordVCenter, VerticalTextDrawFormat);
                }

                g.DrawLine(mypenHline, HCoords1, HCoords2);

                PointF CoordCenter = new PointF(0.5f * (HCoords1.X + HCoords2.X), HCoords1.Y);
                g.DrawString(" " + ndB + " (" + Utility.GetFrequencyStringAtBest(Marker.BandPass) + ")", SampleFont, Brushes.Black, CoordCenter);
            }
            else
            {
                if (Marker.BandPass == 0)
                {
                    // Hline ( min or max)
                    PointF Coords0 = Graph.GetCoords(this.nSpectrumLowFrequency, fMaxLeveldB + dB, ref bCliped);
                    PointF Coords1 = Graph.GetCoords(this.nSpectrumHighFrequency, fMaxLeveldB + dB, ref bCliped);
                    g.DrawLine(mypenHline, Coords0, Coords1);
                }
                else
                {
                    if (Marker.HighFreq > 0)
                    {
                        // low pass
                        PointF Coords0 = Graph.GetCoords(this.nSpectrumLowFrequency, fMaxLeveldB + dB, ref bCliped);
                        PointF Coords1 = Graph.GetCoords(Marker.HighFreq, fMaxLeveldB + dB, ref bCliped);
                        PointF Coords2 = new PointF(Coords1.X, Graph.BitmapWhereDraw.Height - Graph.LowBorder);

                        g.DrawLine(mypenHline, Coords0, Coords1);
                        g.DrawLine(mypenVline, Coords1, Coords2);


                        PointF CoordHCenter = new PointF(0.5f * (Coords0.X + Coords1.X), Coords0.Y);
                        PointF CoordVCenter = new PointF(Coords1.X, 0.5f * (Coords1.Y + Coords2.Y));

                        g.DrawString(Utility.GetFrequencyStringAtBest(Marker.HighFreq), SampleFont, Brushes.Black, CoordVCenter, VerticalTextDrawFormat);
                        g.DrawString(ndB, SampleFont, Brushes.Black, CoordHCenter);
                    }

                    if (Marker.LowFreq > 0)
                    {
                        PointF Coords0 = Graph.GetCoords(this.nSpectrumHighFrequency, fMaxLeveldB + dB, ref bCliped);
                        PointF Coords1 = Graph.GetCoords(Marker.LowFreq, fMaxLeveldB + dB, ref bCliped);
                        PointF Coords2 = new PointF(Coords1.X, Graph.BitmapWhereDraw.Height - Graph.LowBorder);

                        g.DrawLine(mypenHline, Coords0, Coords1);
                        g.DrawLine(mypenVline, Coords1, Coords2);

                        PointF CoordCenter  = new PointF(0.5f * (Coords0.X + Coords1.X), Coords0.Y);
                        PointF CoordVCenter = new PointF(Coords1.X, 0.5f * (Coords1.Y + Coords2.Y));

                        g.DrawString(Utility.GetFrequencyStringAtBest(Marker.LowFreq), SampleFont, Brushes.Black, CoordVCenter, VerticalTextDrawFormat);

                        g.DrawString(ndB, SampleFont, Brushes.Black, CoordCenter);
                    }
                }
            }
        }