Esempio n. 1
0
File: Link.cs Progetto: CareyGit/jx
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The <see c_ref="Link"/> object from which to copy</param>
		public Link( Link rhs )
		{
			// Copy value types
			_title = rhs._title;
			_url = rhs._url;
			_target = rhs._target;
			_isEnabled = false;

			// copy reference types by cloning
			if ( rhs.Tag is ICloneable )
				Tag = ((ICloneable) rhs.Tag).Clone();
			else
				Tag = rhs.Tag;
		}
Esempio n. 2
0
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The CurveItem object from which to copy</param>
		public CurveItem( CurveItem rhs )
		{
			_label = rhs._label.Clone();
			_isY2Axis = rhs.IsY2Axis;
			_isX2Axis = rhs.IsX2Axis;
			_isVisible = rhs.IsVisible;
			_isOverrideOrdinal = rhs._isOverrideOrdinal;
			_yAxisIndex = rhs._yAxisIndex;

			if ( rhs.Tag is ICloneable )
				Tag = ((ICloneable) rhs.Tag).Clone();
			else
				Tag = rhs.Tag;
			
			_points = (IPointList) rhs.Points.Clone();

			_link = rhs._link.Clone();
		}
Esempio n. 3
0
		/// <summary>
		/// Constructor for deserializing objects
		/// </summary>
		/// <param name="info">A <see c_ref="SerializationInfo"/> instance that defines the serialized data
		/// </param>
		/// <param name="context">A <see c_ref="StreamingContext"/> instance that contains the serialized data
		/// </param>
		protected CurveItem( SerializationInfo info, StreamingContext 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( "schema" );

			_label = (Label) info.GetValue( "label", typeof(Label) );
			_isY2Axis = info.GetBoolean( "isY2Axis" );
			if ( sch >= 11 )
				_isX2Axis = info.GetBoolean( "isX2Axis" );
			else
				_isX2Axis = false;

			_isVisible = info.GetBoolean( "isVisible" );

			_isOverrideOrdinal = info.GetBoolean( "isOverrideOrdinal" );

			// Data Points are always stored as a PointPairList, regardless of the
			// actual original type (which could be anything that supports IPointList).
			_points = (PointPairList) info.GetValue( "points", typeof(PointPairList) );

			Tag = info.GetValue( "Tag", typeof(object) );

			_yAxisIndex = info.GetInt32( "yAxisIndex" );

			_link = (Link) info.GetValue( "link", typeof(Link) );

		}
Esempio n. 4
0
		/// <summary>
		/// Internal initialization routine thats sets some initial values to defaults.
		/// </summary>
		/// <param name="label">A string label (legend entry) for this curve</param>
		private void Init( string label )
		{
			_label = new Label( label, null );
			_isY2Axis = false;
			_isX2Axis = false;
			_isVisible = true;
			_isOverrideOrdinal = false;
			Tag = null;
			_yAxisIndex = 0;
			_link = new Link();
		}
Esempio n. 5
0
		/// <summary>
		/// Constructor for deserializing objects
		/// </summary>
		/// <param name="info">A <see c_ref="SerializationInfo"/> instance that defines the serialized data
		/// </param>
		/// <param name="context">A <see c_ref="StreamingContext"/> instance that contains the serialized data
		/// </param>
		protected GraphObj( SerializationInfo info, StreamingContext 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( "schema" );

			_location = (Location) info.GetValue( "location", typeof(Location) );
			_isVisible = info.GetBoolean( "isVisible" );
			Tag = info.GetValue( "Tag", typeof(object) );
			_zOrder = (ZOrder) info.GetValue( "zOrder", typeof(ZOrder) );

			_isClippedToChartRect = info.GetBoolean( "isClippedToChartRect" );
			_link = (Link) info.GetValue( "link", typeof( Link ) );
		}
Esempio n. 6
0
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The <see c_ref="GraphObj"/> object from which to copy</param>
		public GraphObj( GraphObj rhs )
		{
			// Copy value types
			_isVisible = rhs.IsVisible;
			_isClippedToChartRect = rhs._isClippedToChartRect;
			_zOrder = rhs.ZOrder;

			// copy reference types by cloning
			if ( rhs.Tag is ICloneable )
				Tag = ((ICloneable) rhs.Tag).Clone();
			else
				Tag = rhs.Tag;

			_location = rhs.Location.Clone();
			_link = rhs._link.Clone();
		}
Esempio n. 7
0
		/// <summary>
		/// Constructor that creates a <see c_ref="GraphObj"/> with the specified
		/// position, <see c_ref="CoordType"/>, <see c_ref="AlignH"/>, and <see c_ref="AlignV"/>.
		/// Other properties are set to default values as defined in the <see c_ref="Default"/> class.
		/// </summary>
		/// <remarks>
		/// The four coordinates define the starting point and ending point for
		/// <see c_ref="ArrowObj"/>'s, or the topleft and bottomright points for
		/// <see c_ref="ImageObj"/>'s.  For <see c_ref="GraphObj"/>'s that only require
		/// one point, the <see paramref="x2"/> and <see paramref="y2"/> values
		/// will be ignored.  The units of the coordinates are specified by the
		/// <see c_ref="ZedGraph.Location.CoordinateFrame"/> property.
		/// </remarks>
		/// <param name="x">The x position of the item.</param>
		/// <param name="y">The y position of the item.</param>
		/// <param name="x2">The x2 position of the item.</param>
		/// <param name="y2">The x2 position of the item.</param>
		/// <param name="coordType">The <see c_ref="CoordType"/> enum value that
		/// indicates what type of coordinate system the x and y parameters are
		/// referenced to.</param>
		/// <param name="alignH">The <see c_ref="ZedGraph.AlignH"/> enum that specifies
		/// the horizontal alignment of the object with respect to the (x,y) location</param>
		/// <param name="alignV">The <see c_ref="ZedGraph.AlignV"/> enum that specifies
		/// the vertical alignment of the object with respect to the (x,y) location</param>
		public GraphObj( double x, double y, double x2, double y2, CoordType coordType,
					AlignH alignH, AlignV alignV )
		{
			_isVisible = true;
			_isClippedToChartRect = Default.IsClippedToChartRect;
			Tag = null;
			_zOrder = ZOrder.A_InFront;
			_location = new Location( x, y, x2, y2, coordType, alignH, alignV );
			_link = new Link();
		}
Esempio n. 8
0
		/// <summary>
		/// Search through the <see c_ref="GraphObjList" /> and <see c_ref="CurveList" /> for
		/// items that contain active <see c_ref="Link" /> objects.
		/// </summary>
		/// <param name="mousePt">The mouse location where the click occurred</param>
		/// <param name="g">An appropriate <see c_ref="Graphics" /> instance</param>
		/// <param name="scaleFactor">The current scaling factor for drawing operations.</param>
		/// <param name="source">The clickable object that was found.  Typically a type of
		/// <see c_ref="GraphObj" /> or a type of <see c_ref="CurveItem" />.</param>
		/// <param name="link">The <see c_ref="Link" /> instance that is contained within
		/// the <see paramref="source" /> object.</param>
		/// <param name="index">An index value, indicating which point was clicked for
		/// <see c_ref="CurveItem" /> type objects.</param>
		/// <returns>returns true if a clickable link was found under the
		/// <see paramref="mousePt" />, or false otherwise.
		/// </returns>
		public bool FindLinkableObject( PointF mousePt, Graphics g, float scaleFactor,
				out object source, out Link link, out int index )
		{
			index = -1;

			// First look for graph objects that lie in front of the data points
			foreach ( GraphObj graphObj in _graphObjList )
			{
				link = graphObj._link;
				bool inFront = graphObj.IsInFrontOfData;

				if ( link.IsActive )
				{
					if ( graphObj.PointInBox( mousePt, this, g, scaleFactor ) )
					{
						source = graphObj;
						return true;
					}
				}
			}

			// Second, look at the curve data points
			foreach ( CurveItem curve in _curveList )
			{
				link = curve._link;

				if ( link.IsActive )
				{
					CurveItem nearestCurve;

					if ( FindNearestPoint( mousePt, curve, out nearestCurve, out index ) )
					{
						source = curve;
						return true;
					}
				}
			}

			// Third, look for graph objects that lie behind the data points
			foreach ( GraphObj graphObj in _graphObjList )
			{
				link = graphObj._link;
				bool inFront = graphObj.IsInFrontOfData;

				if ( link.IsActive )
				{
					if ( graphObj.PointInBox( mousePt, this, g, scaleFactor ) )
					{
						source = graphObj;
						return true;
					}
				}
			}

			source = null;
			link = null;
			index = -1;
			return false;

		}