/// <summary> /// copy constructor -- this returns a copy of the structure, /// but it does not duplicate the data (it just keeps a reference to the original) /// </summary> /// <param name="rhs">The SamplePointList to be copied</param> public SamplePointList(SamplePointList rhs) { XType = rhs.XType; YType = rhs.YType; // Don't duplicate the data values, just copy the reference to the ArrayList this.list = rhs.list; //foreach ( Sample sample in rhs ) // list.Add( sample ); }
/// <summary> /// copy constructor -- this returns a copy of the structure, /// but it does not duplicate the data (it just keeps a reference to the original) /// </summary> /// <param name="rhs">The SamplePointList to be copied</param> public SamplePointList( SamplePointList rhs ) { XType = rhs.XType; YType = rhs.YType; // Don't duplicate the data values, just copy the reference to the ArrayList this.list = rhs.list; //foreach ( Sample sample in rhs ) // list.Add( sample ); }
private void CreateGraph_SamplePointListDemo( ZedGraphControl z1 ) { GraphPane myPane = z1.GraphPane; myPane.Title.Text = "Demonstration of SamplePointList"; myPane.XAxis.Title.Text = "Time since start, days"; myPane.YAxis.Title.Text = "Postion (meters) or\nAverage Velocity (meters/day)"; myPane.Chart.Fill = new Fill( Color.White, Color.FromArgb( 230, 230, 255 ), 45.0f ); SamplePointList spl = new SamplePointList(); // Calculate sample data _points // starting position & velocity double d0 = 15.0; // m double v0 = 5.2; // m/d double acc = 11.5; // m/d/d for ( int i = 0; i < 10; i++ ) { Sample sample = new Sample(); // Samples are one day apart sample.Time = new DateTime( 2006, 3, i + 1 ); // velocity in meters per day sample.Velocity = v0 + acc * i; sample.Position = acc * i * i / 2.0 + v0 * i + d0; spl.Add( sample ); } // Create the first curve as Position vs delta time spl.XType = SampleType.TimeDiff; spl.YType = SampleType.Position; LineItem curve = myPane.AddCurve( "Position", spl, Color.Green, SymbolType.Diamond ); curve.Symbol.Fill = new Fill( Color.White ); curve.Line.Width = 2.0f; // create the second curve as Average Velocity vs delta time SamplePointList spl2 = new SamplePointList( spl ); spl2.YType = SampleType.VelocityAvg; LineItem curve2 = myPane.AddCurve( "Average Velocity", spl2, Color.Blue, SymbolType.Circle ); curve2.Symbol.Fill = new Fill( Color.White ); curve2.Line.Width = 2.0f; }