TAChart: Use SameValue in floating point comparisons.

git-svn-id: trunk@55104 -
This commit is contained in:
wp 2017-05-26 13:15:42 +00:00
parent 4eb46c28f3
commit 92595f0745
5 changed files with 20 additions and 20 deletions

View File

@ -631,7 +631,7 @@ end;
function TChartAxis.IsDefaultPosition: Boolean;
begin
Result := (PositionUnits = cuPercent) and (Position = 0);
Result := (PositionUnits = cuPercent) and SameValue(Position, 0.0);
end;
function TChartAxis.IsFlipped: Boolean;
@ -781,7 +781,7 @@ end;
function TChartAxis.PositionIsStored: Boolean;
begin
Result := Position <> 0;
Result := not SameValue(Position, 0.0);
end;
function TChartAxis.PositionToCoord(const ARect: TRect): Integer;
@ -914,7 +914,7 @@ end;
procedure TChartAxis.SetPosition(AValue: Double);
begin
if FPosition = AValue then exit;
if SameValue(FPosition, AValue) then exit;
FPosition := AValue;
StyleChanged(Self);
end;

View File

@ -709,17 +709,17 @@ end;
function TParametricCurveSeries.ParamMaxIsStored: Boolean;
begin
Result := ParamMax <> DEF_PARAM_MAX;
Result := not SameValue(ParamMax, DEF_PARAM_MAX);
end;
function TParametricCurveSeries.ParamMaxStepIsStored: Boolean;
begin
Result := ParamMaxStep > 0;
Result := not SameValue(ParamMaxStep, 0.0) and (ParamMaxStep > 0);
end;
function TParametricCurveSeries.ParamMinIsStored: Boolean;
begin
Result := ParamMin <> DEF_PARAM_MIN;
Result := not SameValue(ParamMin, DEF_PARAM_MIN);
end;
procedure TParametricCurveSeries.SetOnCalculate(
@ -732,21 +732,21 @@ end;
procedure TParametricCurveSeries.SetParamMax(AValue: Double);
begin
if FParamMax = AValue then exit;
if SameValue(FParamMax, AValue) then exit;
FParamMax := AValue;
UpdateParentChart;
end;
procedure TParametricCurveSeries.SetParamMaxStep(AValue: Double);
begin
if FParamMaxStep = AValue then exit;
if SameValue(FParamMaxStep, AValue) then exit;
FParamMaxStep := AValue;
UpdateParentChart;
end;
procedure TParametricCurveSeries.SetParamMin(AValue: Double);
begin
if FParamMin = AValue then exit;
if SameValue(FParamMin, AValue) then exit;
FParamMin := AValue;
UpdateParentChart;
end;

View File

@ -772,12 +772,12 @@ end;
function TPolarSeries.IsOriginXStored: Boolean;
begin
Result := OriginX <> 0;
Result := not SameValue(OriginX, 0.0);
end;
function TPolarSeries.IsOriginYStored: Boolean;
begin
Result := OriginY <> 0;
Result := not SameValue(OriginY, 0.0);
end;
{ ANewPos is in cartesioan coordinates. Convert to polar coordinates and store
@ -859,14 +859,14 @@ end;
procedure TPolarSeries.SetOriginX(AValue: Double);
begin
if FOriginX = AValue then exit;
if SameValue(FOriginX, AValue) then exit;
FOriginX := AValue;
UpdateParentChart;
end;
procedure TPolarSeries.SetOriginY(AValue: Double);
begin
if FOriginY = AValue then exit;
if SameValue(FOriginY, AValue) then exit;
FOriginY := AValue;
UpdateParentChart;
end;

View File

@ -600,26 +600,26 @@ end;
function TLinearAxisTransform. OffsetIsStored: Boolean;
begin
Result := Offset <> 0;
Result := not SameValue(Offset, 0.0);
end;
function TLinearAxisTransform.ScaleIsStored: Boolean;
begin
Result := Scale <> 1.0;
Result := not SameValue(Scale, 1.0);
end;
procedure TLinearAxisTransform.SetOffset(AValue: Double);
begin
if FOffset = AValue then exit;
if SameValue(FOffset, AValue) then exit;
FOffset := AValue;
Changed;
end;
procedure TLinearAxisTransform.SetScale(AValue: Double);
begin
if FScale = AValue then exit;
if SameValue(FScale, AValue) then exit;
FScale := AValue;
if FScale = 0 then FScale := 1.0;
if SameValue(FScale, 0.0) then FScale := 1.0;
Changed;
end;

View File

@ -579,7 +579,7 @@ end;
function TChartRange.IsBoundsStored(AIndex: Integer): Boolean;
begin
Result := FBounds[AIndex] <> 0;
Result := not SameValue(FBounds[AIndex], 0);
end;
procedure TChartRange.SetBounds(AIndex: Integer; const AValue: Double);
@ -639,7 +639,7 @@ end;
function TChartExtent.IsBoundsStored(AIndex: Integer): Boolean;
begin
Result := FExtent.coords[AIndex] <> 0;
Result := not SameValue(FExtent.coords[AIndex], 0.0);
end;
procedure TChartExtent.SetBounds(AIndex: Integer; const AValue: Double);