//============================================================================ //ZedGraph Class Library - A Flexible Line Graph/Bar Graph Library in C# //Copyright ?2004 John Champion // //This library is free software; you can redistribute it and/or //modify it under the terms of the GNU Lesser General Public //License as published by the Free Software Foundation; either //version 2.1 of the License, or (at your option) any later version. // //This library is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //Lesser General Public License for more details. // //You should have received a copy of the GNU Lesser General Public //License along with this library; if not, write to the Free Software //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //============================================================================= #region Using directives using System; using System.Collections.Generic; using System.Text; #endregion namespace DrawGraph { /// /// A collection class that maintains a list of /// objects, corresponding to the list of objects /// from or . /// public class ScaleStateList : List, ICloneable { /// /// Construct a new automatically from an /// existing . /// /// The (a list of Y axes), /// from which to retrieve the state and create the /// objects. public ScaleStateList( YAxisList list ) { foreach ( Axis axis in list ) this.Add( new ScaleState( axis ) ); } /// /// Construct a new automatically from an /// existing . /// /// The (a list of Y axes), /// from which to retrieve the state and create the /// objects. public ScaleStateList( Y2AxisList list ) { foreach ( Axis axis in list ) this.Add( new ScaleState( axis ) ); } /// /// The Copy Constructor /// /// The object from which to copy public ScaleStateList( ScaleStateList rhs ) { foreach ( ScaleState item in rhs ) { this.Add( item.Clone() ); } } /// /// Implement the interface in a typesafe manner by just /// calling the typed version of /// /// A deep copy of this object object ICloneable.Clone() { return this.Clone(); } /// /// Typesafe, deep-copy clone method. /// /// A new, independent copy of this class public ScaleStateList Clone() { return new ScaleStateList( this ); } /// /// Iterate through the list of objects, comparing them /// to the state of the specified /// objects. /// /// A object specifying a list of /// objects to be compared with this . /// /// true if a difference is found, false otherwise public bool IsChanged( YAxisList list ) { int count = Math.Min( list.Count, this.Count ); for ( int i = 0; i < count; i++ ) if ( this[i].IsChanged( list[i] ) ) return true; return false; } /// /// Iterate through the list of objects, comparing them /// to the state of the specified /// objects. /// /// A object specifying a list of /// objects to be compared with this . /// /// true if a difference is found, false otherwise public bool IsChanged( Y2AxisList list ) { int count = Math.Min( list.Count, this.Count ); for ( int i = 0; i < count; i++ ) if ( this[i].IsChanged( list[i] ) ) return true; return false; } /* /// /// Indexer to access the specified object by /// its ordinal position in the list. /// /// The ordinal position (zero-based) of the /// object to be accessed. /// A object reference. public ScaleState this[ int index ] { get { return (ScaleState) List[index]; } set { List[index] = value; } } /// /// Add a object to the collection at the end of the list. /// /// A reference to the object to /// be added /// public void Add( ScaleState state ) { List.Add( state ); } */ /// /// /// /// public void ApplyScale( YAxisList list ) { int count = Math.Min( list.Count, this.Count ); for ( int i = 0; i < count; i++ ) this[i].ApplyScale( list[i] ); } /// /// /// /// public void ApplyScale( Y2AxisList list ) { int count = Math.Min( list.Count, this.Count ); for ( int i = 0; i < count; i++ ) this[i].ApplyScale( list[i] ); } } }