{uGrid2D)
author: Nikolai Shokhirev )
created: (June 06, 2002)
last modified: August 08, 2003)
ŠNikolai V. Shokhirev, 2002-2003 }
unit uGrid2D;
interface
uses
classes, extctrls, uMatTypes, controls, Graphics, Windows, uDynArrays,
uColorMap;
type
TGrid2D = class(TPaintBox)
private
fCellColor: array of array of TColor;
fLineColor: TColor;
fLo1: TInt;
fLo2: TInt;
fHi1: TInt;
fHi2: TInt;
Dim1: TInt;
Dim2: TInt;
fBgColor: TColor;
t, b, l, r: TInt;
function GetCellColor(idx1, idx2: integer): TColor; virtual;
procedure SetCellColor(idx1, idx2: integer; const Value: TColor); virtual;
procedure ClearColors;
procedure DrawLines;
procedure PaintCells;
public
constructor Create(aOwner: TComponent; aParent: TWinControl); reintroduce;
destructor Destroy; override;
procedure SetRanges(aLo1, aHi1, aLo2, aHi2: TInt);
procedure ClearGrid;
procedure PaintGrid;
procedure ScreenToCell(X, Y: integer; var i2, i1: TInt);
property Lo1: TInt read fLo1;
property Hi1: TInt read fHi1;
property Lo2: TInt read fLo2;
property Hi2: TInt read fHi2;
property LineColor: TColor read fLineColor write fLineColor;
property BgColor: TColor read fBgColor write fBgColor;
property CellColor[idx1,idx2: integer]: TColor read GetCellColor write SetCellColor; Default;
end;
TGrid2DM = class(TGrid2D)
private
fMatrix: IFArr2D;
fMmin, fMmax: TFloat;
fRGBSet: TRGBSet;
procedure SetMatrix(const Value: IFArr2D);
function GetValue(i1, i2: TInt): TFloat;
procedure SetValue(i1, i2: TInt; const Value: TFloat);
procedure GetMinMax;
function ColorToNumb(aColor: TColor): TFloat;
function NumbToColor(aNumb: TFloat): TColor;
function GetMatrix: IFArr2D;
public
procedure MatrixToColors;
procedure ColorsToMatrix;
property RGBSet: TRGBSet read fRGBSet write fRGBSet;
property Mmin: TFloat read fMmin write fMmin;
property Mmax: TFloat read fMmax write fMmax;
property Matrix: IFArr2D read GetMatrix write SetMatrix;
property Values[i1,i2: TInt]: TFloat read GetValue write SetValue;
end;
implementation
uses
Math;
end.
Top
Generated by Lore's Source to HTML Converter(http://www.newty.de/lsc/index.html)