Example #1
0
        //private System.Windows.Forms.sy  ChangeAxis;


        public void GetStatusEvent(CurveStatus cs)
        {
            objAldysGraphTmp.GetStatusEventEx(cs);
        }
Example #2
0
        public void DrawManyEx(Graphics g, AldysPane pane, float[] x, float[] y, ArrayList xY)
        {
            if (this.isVisible)
            {
                Pen pen = new Pen(this.color, this.width);
                pen.DashStyle = this.Style;
                int   nSeg = x.Length - 1;
                int   iPlus = 0;
                float xTmp, yTmp;
                xTmp = yTmp = 0;
                float slope, constant;
                slope = constant = 0;

                for (int i = 0; i < nSeg; i++)
                {
                    iPlus++;
                    if (x[i] != System.Single.MaxValue &&
                        x[iPlus] != System.Single.MaxValue &&
                        y[i] != System.Single.MaxValue &&
                        y[iPlus] != System.Single.MaxValue)
                    {
                        if (this.StepType == StepType.NonStep)
                        {
                            if ((((double)xY[i]) >= pane.YAxis.UpperAlarmLineY) && (((double)xY[iPlus]) >= pane.YAxis.UpperAlarmLineY) && pane.YAxis.UpperAlarmLine)
                            {
                                pen.Color = pane.YAxis.UpperAlarmLineColor;
                                CurveStatus cStatus = new CurveStatus(1);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, x[i], y[i], x[iPlus], y[iPlus]);
                            }
                            else if ((((double)xY[i]) < pane.YAxis.UpperAlarmLineY) && (((double)xY[iPlus]) > pane.YAxis.UpperAlarmLineY) && pane.YAxis.UpperAlarmLine)
                            {
                                //find the slope of the line
                                if (x[i] - x[iPlus] != 0)
                                {
                                    slope    = (y[iPlus] - y[i]) / (x[iPlus] - x[i]);
                                    constant = y[i] - (((y[iPlus] - y[i]) / (x[iPlus] - x[i])) * x[i]);
                                }
                                //find the new point
                                yTmp      = pane.YAxis.Transform(pane.YAxis.UpperAlarmLineY);
                                xTmp      = (yTmp - constant) / slope;
                                pen.Color = this.color;
                                g.DrawLine(pen, x[i], y[i], xTmp, yTmp);
                                pen.Color = pane.YAxis.UpperAlarmLineColor;
                                CurveStatus cStatus = new CurveStatus(1);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, xTmp, yTmp, x[iPlus], y[iPlus]);
                            }
                            else if ((((double)xY[i]) > pane.YAxis.UpperAlarmLineY) && (((double)xY[iPlus]) < pane.YAxis.UpperAlarmLineY) && pane.YAxis.UpperAlarmLine)
                            {
                                //find the slope of the line
                                if (x[i] - x[iPlus] != 0)
                                {
                                    slope    = (y[iPlus] - y[i]) / (x[iPlus] - x[i]);
                                    constant = y[i] - (((y[iPlus] - y[i]) / (x[iPlus] - x[i])) * x[i]);
                                }
                                //find the new point
                                yTmp      = pane.YAxis.Transform(pane.YAxis.UpperAlarmLineY);
                                xTmp      = (yTmp - constant) / slope;
                                pen.Color = pane.YAxis.UpperAlarmLineColor;
                                CurveStatus cStatus = new CurveStatus(1);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, x[i], y[i], xTmp, yTmp);
                                pen.Color = this.color;
                                g.DrawLine(pen, xTmp, yTmp, x[iPlus], y[iPlus]);
                            }

                            else if ((((double)xY[i]) <= pane.YAxis.LowerAlarmLineY) && (((double)xY[iPlus]) <= pane.YAxis.LowerAlarmLineY) && pane.YAxis.LowerAlarmLine)
                            {
                                pen.Color = this.color;
                                //Sachin Ashtankar
                                //pen.Color = pane.YAxis.LowerAlarmLineColor;
                                CurveStatus cStatus = new CurveStatus(-1);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, x[i], y[i], x[iPlus], y[iPlus]);
                            }
                            else if ((((double)xY[i]) > pane.YAxis.LowerAlarmLineY) && (((double)xY[iPlus]) < pane.YAxis.LowerAlarmLineY) && pane.YAxis.LowerAlarmLine)
                            {
                                //find the slope of the line

                                if (x[i] - x[iPlus] != 0)
                                {
                                    slope    = (y[iPlus] - y[i]) / (x[iPlus] - x[i]);
                                    constant = y[i] - (((y[iPlus] - y[i]) / (x[iPlus] - x[i])) * x[i]);
                                }
                                //find the new point
                                yTmp = pane.YAxis.Transform(pane.YAxis.LowerAlarmLineY);
                                xTmp = (yTmp - constant) / slope;

                                pen.Color = this.color;
                                g.DrawLine(pen, x[i], y[i], xTmp, yTmp);
                                pen.Color = pane.YAxis.LowerAlarmLineColor;
                                CurveStatus cStatus = new CurveStatus(1);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, xTmp, yTmp, x[iPlus], y[iPlus]);
                            }
                            else if ((((double)xY[i]) < pane.YAxis.LowerAlarmLineY) && (((double)xY[iPlus]) > pane.YAxis.LowerAlarmLineY) && pane.YAxis.LowerAlarmLine)
                            {
                                //find the slope of the line

                                if (x[i] - x[iPlus] != 0)
                                {
                                    slope    = (y[iPlus] - y[i]) / (x[iPlus] - x[i]);
                                    constant = y[i] - (((y[iPlus] - y[i]) / (x[iPlus] - x[i])) * x[i]);
                                }
                                //find the new point
                                yTmp      = pane.YAxis.Transform(pane.YAxis.LowerAlarmLineY);
                                xTmp      = (yTmp - constant) / slope;
                                pen.Color = this.color;
                                g.DrawLine(pen, xTmp, yTmp, x[iPlus], y[iPlus]);
                                pen.Color = pane.YAxis.LowerAlarmLineColor;
                                CurveStatus cStatus = new CurveStatus(1);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, x[i], y[i], xTmp, yTmp);
                            }
                            else
                            {
                                if (this.CL.Count > 0)
                                {
                                    pen.Color = (Color)this.CL[i];                             //this.color;
                                }
                                else
                                {
                                    pen.Color = this.color;
                                }

                                CurveStatus cStatus = new CurveStatus(0);
                                pane.GetStatusEvent(cStatus);
                                g.DrawLine(pen, x[i], y[i], x[iPlus], y[iPlus]);
                            }

                            //g.DrawLine( pen, xTmp, y[i], x[iPlus], y[iPlus] );
                        }

                        else if (this.StepType == StepType.ForwardStep)
                        {
                            g.DrawLine(pen, x[i], y[i], x[iPlus], y[i]);
                            g.DrawLine(pen, x[iPlus], y[i], x[iPlus], y[iPlus]);
                        }
                        else if (this.StepType == StepType.RearwardStep)
                        {
                            g.DrawLine(pen, x[i], y[i], x[i], y[iPlus]);
                            g.DrawLine(pen, x[i], y[iPlus], x[iPlus], y[iPlus]);
                        }
                    }
                }
            }
        }