Ejemplo n.º 1
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The TextItem object from which to copy</param>
        public TextItem(TextItem rhs)
        {
            text    = rhs.Text;
            alignV  = rhs.AlignV;
            alignH  = rhs.AlignH;
            x       = rhs.X;
            y       = rhs.Y;
            widthx  = rhs.widthx;
            heighty = rhs.heighty;

            blnForCurveLabel    = rhs.blnForCurveLabel;
            blnForHighPeakLabel = rhs.blnForHighPeakLabel;
            coordinateFrame     = rhs.CoordinateFrame;
            fontSpec            = new FontSpecs(rhs.FontSpec);
        }
Ejemplo n.º 2
0
        public void DrawCurveLabels()
        {
            int    intCurveCount = 0;
            string name;
            double x, y;

            if (ShowCurveLabels == false)
            {
                return;
            }

            try
            {
                //double dblInterval=((this.XAxis.Max - this.XAxis.Min)/this.CurveList.Count -1);
                //after commenting the above line , following block of code is
                //written by deepak b. on 01.04.06

                ////////////----------
                int    LastPointOnCurve;
                double XValueOfLastPointOnCurve, MinXValueOfLastPointOnCurve;
                MinXValueOfLastPointOnCurve = 0.0;
                foreach (CurveItem curve in CurveList)
                {
                    LastPointOnCurve            = curve.X.Count - 1;
                    XValueOfLastPointOnCurve    = (double)curve.X[LastPointOnCurve];
                    MinXValueOfLastPointOnCurve = XValueOfLastPointOnCurve;
                    if (MinXValueOfLastPointOnCurve <= XValueOfLastPointOnCurve)
                    {
                        MinXValueOfLastPointOnCurve = XValueOfLastPointOnCurve;
                    }
                }

                double dblInterval = ((MinXValueOfLastPointOnCurve - this.XAxis.Min) / this.CurveList.Count);
                ////////////----------

                double dblFrom, dblTo;
                dblFrom = this.XAxis.Min;
                dblTo   = dblFrom + dblInterval;

                foreach (CurveItem curve in CurveList)
                {
                    bool blnDrawn = false;
                    curve.LabelX = curve.Label;
                    curve.Label += "(" + intCurveCount.ToString() + ")";

                    name = intCurveCount.ToString();

                    for (int intCount = 0; intCount <= curve.X.Count - 1; intCount++)
                    {
                        if ((double)curve.X[intCount] >= dblFrom && (double)curve.X[intCount] <= dblTo)
                        {
                            x = (double)curve.X[intCount];
                            y = (double)curve.Y[intCount];

                            TextItem text = new TextItem(name, (float)x, (float)y);
                            text.CoordinateFrame = CoordType.AxisXYScale;
                            text.AlignH          = FontAlignH.Center;
                            text.AlignV          = FontAlignV.Bottom;
                            if (CurveLabelSize != 0)
                            {
                                text.FontSpec.Size = CurveLabelSize;
                            }
                            text.ForCurveLabel      = true;
                            text.FontSpec.IsFramed  = true;
                            text.FontSpec.FontColor = curve.Line.Color;
                            TextList.Add(text);

                            intCurveCount += 1;
                            dblFrom        = dblTo;
                            dblTo          = dblFrom + dblInterval;

                            blnDrawn = true;
                            break;
                        }
                        blnDrawn = false;
                    }
                    if (blnDrawn == false)
                    {
                        //this if block is written by deepak b. on 01.04.06
                        int LastPointBeforeEdge = 0;
                        for (int intCount = curve.X.Count - 1; intCount >= 0; intCount--)
                        {
                            if ((double)curve.X[intCount] < this.XAxis.Min || (double)curve.X[intCount] > this.XAxis.Max || (double)curve.Y[intCount] < this.YAxis.Min || (double)curve.Y[intCount] > this.YAxis.Max)
                            {
                                //Do nothing
                            }
                            else
                            {
                                LastPointBeforeEdge = intCount;
                                break;
                            }
                        }

                        x = (double)curve.X[LastPointBeforeEdge];
                        y = (double)curve.Y[LastPointBeforeEdge];

                        TextItem text = new TextItem(name, (float)x, (float)y);
                        text.CoordinateFrame = CoordType.AxisXYScale;
                        text.AlignH          = FontAlignH.Center;
                        text.AlignV          = FontAlignV.Bottom;
                        text.ForCurveLabel   = true;
                        if (CurveLabelSize != 0)
                        {
                            text.FontSpec.Size = CurveLabelSize;
                        }
                        text.FontSpec.IsFramed  = true;
                        text.FontSpec.FontColor = curve.Line.Color;
                        TextList.Add(text);

                        intCurveCount += 1;
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Add a <see cref="TextItem"/> object to the <see cref="TextList"/>
 /// collection at the end of the list.
 /// </summary>
 /// <param name="item">A reference to the <see cref="TextItem"/> object to
 /// be added</param>
 public void Add(TextItem item)
 {
     List.Add(item);
 }