//============================================================================
//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
//=============================================================================
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace DrawGraph
{
	/// 
	/// Encapsulates a curve type that is displayed as a series of vertical "sticks",
	/// one at each defined point.
	/// 
	/// 
	/// The sticks run from the zero value of the Y axis, to the Y point defined in each
	///  of the  (see ).
	/// The properties of the sticks are defined in the  property.
	/// Normally, the  is not visible.  However, if you manually enable the
	///  using the  property, the
	/// symbols will be drawn at the "Z" value from each  (see
	/// ).
	/// 
	/// 
	///  John Champion 
	///  $Revision: 1.7 $ $Date: 2007/01/25 07:56:09 $ 
	[Serializable]
	public class StickItem : LineItem, ICloneable, ISerializable
	{
	#region Fields
	#endregion
	#region Properties
		/// 
		/// Gets a flag indicating if the Z data range should be included in the axis scaling calculations.
		/// 
		/// The parent  of this .
		/// 
		/// true if the Z data are included, false otherwise
		override internal bool IsZIncluded( GraphPane pane )
		{
			return _symbol.IsVisible;
		}
		/// 
		/// Gets a flag indicating if the X axis is the independent axis for this 
		/// 
		/// The parent  of this .
		/// 
		/// true if the X axis is independent, false otherwise
		override internal bool IsXIndependent( GraphPane pane )
		{
			return true;
		}
	#endregion
	
	#region Constructors
		/// 
		/// Create a new , specifying only the legend .
		/// 
		/// The label that will appear in the legend.
		public StickItem( string label ) : base( label )
		{
			_symbol.IsVisible = false;
		}
		
		/// 
		/// Create a new  using the specified properties.
		/// 
		/// The label that will appear in the legend.
		/// An array of double precision values that define
		/// the independent (X axis) values for this curve
		/// An array of double precision values that define
		/// the dependent (Y axis) values for this curve
		/// A  value that will be applied to
		/// the  and  properties.
		/// 
		/// The width (in points) to be used for the .  This
		/// width is scaled based on .  Use a value of zero to
		/// hide the line (see ).
		public StickItem( string label, double[] x, double[] y, Color color, float lineWidth )
			: this( label, new PointPairList( x, y ), color, lineWidth )
		{
		}
		/// 
		/// Create a new  using the specified properties.
		/// 
		/// The label that will appear in the legend.
		/// An array of double precision values that define
		/// the independent (X axis) values for this curve
		/// An array of double precision values that define
		/// the dependent (Y axis) values for this curve
		/// A  value that will be applied to
		/// the  and  properties.
		/// 
		public StickItem( string label, double[] x, double[] y, Color color )
			: this( label, new PointPairList( x, y ), color )
		{
		}
		/// 
		/// Create a new  using the specified properties.
		/// 
		/// The label that will appear in the legend.
		/// A  of double precision value pairs that define
		/// the X and Y values for this curve
		/// A  value that will be applied to
		/// the  and  properties.
		/// 
		public StickItem( string label, IPointList points, Color color )
			: this( label, points, color, DrawGraph.LineBase.Default.Width )
		{
		}
		/// 
		/// Create a new  using the specified properties.
		/// 
		/// The label that will appear in the legend.
		/// A  of double precision value pairs that define
		/// the X and Y values for this curve
		/// A  value that will be applied to
		/// the  and  properties.
		/// 
		/// The width (in points) to be used for the .  This
		/// width is scaled based on .  Use a value of zero to
		/// hide the line (see ).
		public StickItem( string label, IPointList points, Color color, float lineWidth )
			: base( label, points, color, Symbol.Default.Type, lineWidth )
		{
			_symbol.IsVisible = false;
		}
		/// 
		/// The Copy Constructor
		/// 
		/// The  object from which to copy
		public StickItem( StickItem rhs ) : base( rhs )
		{
		}
		/// 
		/// 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 new StickItem Clone()
		{
			return new StickItem( this );
		}
	#endregion
	#region Serialization
		/// 
		/// Current schema value that defines the version of the serialized file
		/// 
		public const int schema3 = 10;
		/// 
		/// Constructor for deserializing objects
		/// 
		/// A  instance that defines the serialized data
		/// 
		/// A  instance that contains the serialized data
		/// 
		protected StickItem( SerializationInfo info, StreamingContext context ) : base( info, context )
		{
			// The schema value is just a file version parameter.  You can use it to make future versions
			// backwards compatible as new member variables are added to classes
			int sch = info.GetInt32( "schema3" );
		}
		/// 
		/// Populates a  instance with the data needed to serialize the target object
		/// 
		/// A  instance that defines the serialized data
		/// A  instance that contains the serialized data
		[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
		public override void GetObjectData( SerializationInfo info, StreamingContext context )
		{
			base.GetObjectData( info, context );
			info.AddValue( "schema3", schema3 );
		}
	#endregion
	#region Methods
	#endregion
	}
}