TAChart: Change GetBounds and GetGraphBounds parameters from out to var

* They may be set only partially.
* Add comment explaining that

git-svn-id: trunk@24506 -
This commit is contained in:
ask 2010-04-08 12:57:22 +00:00
parent c0a2d3d22d
commit 653230ad6b
3 changed files with 15 additions and 13 deletions

View File

@ -40,7 +40,7 @@ type
procedure SetAxisIndexY(AValue: Integer); procedure SetAxisIndexY(AValue: Integer);
protected protected
procedure GetGraphBounds(out ABounds: TDoubleRect); override; procedure GetGraphBounds(var ABounds: TDoubleRect); override;
procedure SetActive(AValue: Boolean); override; procedure SetActive(AValue: Boolean); override;
procedure SetDepth(AValue: TChartDistance); override; procedure SetDepth(AValue: TChartDistance); override;
procedure SetShowInLegend(AValue: Boolean); override; procedure SetShowInLegend(AValue: Boolean); override;
@ -96,7 +96,7 @@ type
procedure AfterDraw; override; procedure AfterDraw; override;
procedure BeforeDraw; override; procedure BeforeDraw; override;
function ColorOrDefault(AColor: TColor; ADefault: TColor = clTAColor): TColor; function ColorOrDefault(AColor: TColor; ADefault: TColor = clTAColor): TColor;
procedure GetBounds(out ABounds: TDoubleRect); override; procedure GetBounds(var ABounds: TDoubleRect); override;
function GetGraphPoint(AIndex: Integer): TDoublePoint; function GetGraphPoint(AIndex: Integer): TDoublePoint;
function GetGraphPointX(AIndex: Integer): Double; inline; function GetGraphPointX(AIndex: Integer): Double; inline;
function GetGraphPointY(AIndex: Integer): Double; inline; function GetGraphPointY(AIndex: Integer): Double; inline;
@ -170,7 +170,7 @@ begin
FAxisIndexY := DEF_AXIS_INDEX; FAxisIndexY := DEF_AXIS_INDEX;
end; end;
procedure TCustomChartSeries.GetGraphBounds(out ABounds: TDoubleRect); procedure TCustomChartSeries.GetGraphBounds(var ABounds: TDoubleRect);
begin begin
GetBounds(ABounds); GetBounds(ABounds);
with ABounds do begin with ABounds do begin
@ -379,7 +379,7 @@ begin
Result := Source.FormatItem(Marks.Format, AIndex); Result := Source.FormatItem(Marks.Format, AIndex);
end; end;
procedure TChartSeries.GetBounds(out ABounds: TDoubleRect); procedure TChartSeries.GetBounds(var ABounds: TDoubleRect);
begin begin
if not Active or (Count = 0) then exit; if not Active or (Count = 0) then exit;
ABounds := Extent; ABounds := Extent;

View File

@ -55,8 +55,10 @@ type
procedure AfterAdd; virtual; procedure AfterAdd; virtual;
procedure AfterDraw; virtual; procedure AfterDraw; virtual;
procedure BeforeDraw; virtual; procedure BeforeDraw; virtual;
procedure GetBounds(out ABounds: TDoubleRect); virtual; abstract; // Set series bounds in axis coordinates.
procedure GetGraphBounds(out ABounds: TDoubleRect); virtual; abstract; // Some or all bounds may be left unset, in which case they will be ignored.
procedure GetBounds(var ABounds: TDoubleRect); virtual; abstract;
procedure GetGraphBounds(var ABounds: TDoubleRect); virtual; abstract;
procedure GetLegendItems(AItems: TChartLegendItems); virtual; abstract; procedure GetLegendItems(AItems: TChartLegendItems); virtual; abstract;
procedure SetActive(AValue: Boolean); virtual; abstract; procedure SetActive(AValue: Boolean); virtual; abstract;
procedure SetDepth(AValue: TChartDistance); virtual; abstract; procedure SetDepth(AValue: TChartDistance); virtual; abstract;

View File

@ -232,7 +232,7 @@ type
procedure SetSeriesColor(AValue: TColor); procedure SetSeriesColor(AValue: TColor);
procedure SetUseBounds(AValue: Boolean); procedure SetUseBounds(AValue: Boolean);
protected protected
procedure GetBounds(out ABounds: TDoubleRect); override; procedure GetBounds(var ABounds: TDoubleRect); override;
procedure GetLegendItems(AItems: TChartLegendItems); override; procedure GetLegendItems(AItems: TChartLegendItems); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -273,7 +273,7 @@ type
procedure SetPen(const AValue: TChartPen); procedure SetPen(const AValue: TChartPen);
procedure SetStep(AValue: TFuncSeriesStep); procedure SetStep(AValue: TFuncSeriesStep);
protected protected
procedure GetBounds(out ABounds: TDoubleRect); override; procedure GetBounds(var ABounds: TDoubleRect); override;
procedure GetLegendItems(AItems: TChartLegendItems); override; procedure GetLegendItems(AItems: TChartLegendItems); override;
public public
@ -296,7 +296,7 @@ type
end; end;
TSeriesDrawEvent = procedure (ACanvas: TCanvas; const ARect: TRect) of object; TSeriesDrawEvent = procedure (ACanvas: TCanvas; const ARect: TRect) of object;
TSeriesGetBoundsEvent = procedure (out ABounds: TDoubleRect) of object; TSeriesGetBoundsEvent = procedure (var ABounds: TDoubleRect) of object;
{ TUserDrawnSeries } { TUserDrawnSeries }
@ -307,7 +307,7 @@ type
procedure SetOnDraw(AValue: TSeriesDrawEvent); procedure SetOnDraw(AValue: TSeriesDrawEvent);
procedure SetOnGetBounds(AValue: TSeriesGetBoundsEvent); procedure SetOnGetBounds(AValue: TSeriesGetBoundsEvent);
protected protected
procedure GetBounds(out ABounds: TDoubleRect); override; procedure GetBounds(var ABounds: TDoubleRect); override;
procedure GetLegendItems(AItems: TChartLegendItems); override; procedure GetLegendItems(AItems: TChartLegendItems); override;
public public
procedure Draw(ACanvas: TCanvas); override; procedure Draw(ACanvas: TCanvas); override;
@ -497,7 +497,7 @@ begin
end; end;
end; end;
procedure TLine.GetBounds(out ABounds: TDoubleRect); procedure TLine.GetBounds(var ABounds: TDoubleRect);
begin begin
if not UseBounds then exit; if not UseBounds then exit;
case LineStyle of case LineStyle of
@ -1138,7 +1138,7 @@ begin
end; end;
end; end;
procedure TFuncSeries.GetBounds(out ABounds: TDoubleRect); procedure TFuncSeries.GetBounds(var ABounds: TDoubleRect);
begin begin
with Extent do begin with Extent do begin
if UseXMin then ABounds.a.X := XMin; if UseXMin then ABounds.a.X := XMin;
@ -1194,7 +1194,7 @@ begin
FOnDraw(ACanvas, FChart.ClipRect); FOnDraw(ACanvas, FChart.ClipRect);
end; end;
procedure TUserDrawnSeries.GetBounds(out ABounds: TDoubleRect); procedure TUserDrawnSeries.GetBounds(var ABounds: TDoubleRect);
begin begin
if Assigned(FOnGetBounds) then if Assigned(FOnGetBounds) then
FOnGetBounds(ABounds); FOnGetBounds(ABounds);