Unit XYSys;
{
  Component history:
  v 1.0  - June 18, 1997        First Release
  v 1.1  - September 15, 1997   Some bugs corrected, two graph methods added
  v 1.2  - December 31, 1997    New bug corrected, aspect ratio management added
  v 1.21 - June 6, 1998         Stream support added, other minor correction done
  v 1.3  - September 10, 1998   DrawFuncStep property added, DrawPoint improved
}

Interface

Uses
  Windows, Messages, SysUtils, Classes, Graphics, Math,
  Controls, ExtCtrls, Forms, XYSysAbout, DsgnIntf;

Type
  real = double;       // specify f.p. type to use
  tXYOption = (xyTransparent, xyAxes, xyGrid, xyKeepRatio);
		{ When xyKeepRatio = true, any setting about user's coordinate system
		  changes also paint box's width/height and vice versa }
  TXYOptions = set of tXYOption;
  TXYKRPriority = (rpNone, rpChangeY, rpChangeX);
  TPointStyle = (psCircle, psPlus, psCross);      // namely o, +, x

  TFunc = Function(x : real) : real;

  TXYSystem = class(TPaintBox)
  private
	 { Private declarations }
	 ...
  protected
	 { Protected declarations }
	 Procedure Paint; override;
  public
	 { Public declarations }
	 Constructor Create(AOwner : TComponent); override;
	 Procedure Load(S : TStream);
	 Procedure Store(S : TStream);

	 Function scrX(x : real) : integer;     (* user ref. -> screen ref. *)
	 Function scrY(y : real) : integer;
	 Function usrX(xs : integer) : real;     (* screen ref. -> user ref. *)
	 Function usrY(ys : integer) : real;
	 Procedure RotateXY(x,y, xcen,ycen : real; ang : real; VAR xt,yt : real);
		  (* return (xt, yt) rotated of ang radians with (xcen, ycen) as center *)
	 Function Dist(x1, y1, x2, y2 : real) : real;

	 Procedure RedrawAxes;
	 Procedure DrawPoint(x, y : real);         (* draw a point with current style & size *)
	 Procedure DrawLine(a, b, c : real);       (* draw the eq. ax + by + c = 0 *)
	 Procedure Vector(x1, y1, x2, y2 : real);  (* draw an oriented segment to (x2, y2) *)
	 Procedure DrawFunc(f : TFunc; a, b : real);
		  (* draw the graph of f(x) in [a,b]; f must be defined in [a,b] *)
  published
	 { Published declarations }
	 property Width default 320;
	 property Height default 240;
	 { new properties }
	 property About : string read fAbout write fAbout;
	 property Ox : integer read GetOx write NotSetO;
	 property Oy : integer read GetOy write NotSetO;
	 property Xmin : real read fXmin write SetXmin;    (* user coordinate system *)
	 property Ymin : real read fYmin write SetYmin;
	 property Xmax : real read fXmax write SetXmax;
	 property Ymax : real read fYmax write SetYmax;
	 property UprX : real read fUprX write SetUprX;       (* primary for values *)
	 property UprY : real read fUprY write SetUprY;
	 property UsecX : real read fUsecX write SetUsecX;    (* secondary for ticks on axes *)
	 property UsecY : real read fUsecY write SetUsecY;
	 property AspectRatio : real read GetAspectRatio write NotSetAR;
	 property Options : TXYOptions read fOptions write SetOptions;
	 property KRPriority : TXYKRPriority read fKRPriority write SetKRPriority;
	 property Decimals : byte read fDecimals write SetDecimals;
	 property PointSize : byte read fPointSize write fPointSize default 4;
    	 property PointStyle : TPointStyle read fPointStyle write fPointStyle default psCircle;
    	 property DrawFuncStep : byte read fDrawFuncStep write fDrawFuncStep default 1;
	 property AxesColor : TColor read fAxesColor write SetAxesColor;
	 property GridColor : TColor read fGridColor write SetGridColor;
  end;


  TAboutProperty = class(TStringProperty)
  public
	 procedure Edit; override;
	 function GetAttributes: TPropertyAttributes; override;
  end;


Procedure Register;


Implementation

...


end.
