📄 iscopechannel.pas
字号:
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetCoupling(const Value: TiScopeChannelCoupling);
begin
FCoupling := Value;
DoChange;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetPosition(const Value: Double);
begin
if FPosition <> Value then
begin
FPosition := Value;
FSettingPosition := True;
try
if Assigned(FRefLine) then FRefLine.Line1Position := Value + 50;
finally
FSettingPosition := False;
end;
UpdateYAxis;
DoChange;
end;
end;
//****************************************************************************************************************************************************
function TiScopeChannel.GetPositionVoltage: Double;
begin
Result := -(FYAxis.Min + FYAxis.Span/2);
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.RefLimitLineChange(NewValue: Double);
var
NewPosition : Double;
begin
if FSettingPosition then Exit;
NewPosition := NewValue -50;
NewPosition := (Trunc(ABS(NewPosition) * 10 + 0.0001)/10) * GetSign(NewPosition);
Position := NewPosition;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetPositionVoltage(const Value: Double);
var
NewPosition : Double;
begin
NewPosition := Value/FYAxis.Span*100;
NewPosition := Trunc(NewPosition*10 + 0.0001)/10;
Position := NewPosition;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetVoltsPerDivision(const Value: Double);
begin
if FVoltsPerDivision <> Value then
begin
FVoltsPerDivision := Value;
UpdateYAxis;
DoChange;
end;
end;
//****************************************************************************************************************************************************
function TiScopeChannel.GetTitleText : String; begin if Assigned(FChannel) then Result := FChannel.TitleText else Result := FTitleText; end;
function TiScopeChannel.GetColor : TColor; begin if Assigned(FChannel) then Result := FChannel.Color else Result := FColor; end;
function TiScopeChannel.GetTraceLineWidth: Integer;begin if Assigned(FChannel) then Result := FChannel.TraceLineWidth else Result := FTraceLineWidth;end;
function TiScopeChannel.GetTraceVisible : Boolean;begin if Assigned(FChannel) then Result := FChannel.TraceVisible else Result := FTraceVisible; end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetTitleText (const Value: String );begin FTitleText :=Value;if Assigned(FChannel) then FChannel.TitleText :=Value;DoChange;end;
procedure TiScopeChannel.SetTraceLineWidth(const Value: Integer);begin FTraceLineWidth:=Value;if Assigned(FChannel) then FChannel.TraceLineWidth:=Value;DoChange;end;
procedure TiScopeChannel.SetTraceVisible (const Value: Boolean);begin FTraceVisible :=Value;if Assigned(FChannel) then FChannel.TraceVisible :=Value;DoChange;end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetColor(const Value: TColor);
begin
if FColor <> Value then
begin
FColor := Value;
if Assigned(FChannel) then FChannel.Color :=Value;
if Assigned(FAnnotation) then FAnnotation.Font.Color :=Value;
if Assigned(FRefLine) then FRefLine.Color :=Value;
DoChange;
end;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetScalerMultiplier(const Value: Double);
begin
FScalerMultiplier := Value;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetRefLineShow(const Value: Boolean);
begin
if FRefLineShow <> Value then
begin
FRefLineShow := Value;
if Assigned(FRefLine) then FRefLine.Visible := Value;
DoChange;
end;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetScalerOffset(const Value: Double);
begin
FScalerOffset := Value;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetYAxis(const Value: TiPlotYAxis);
begin
if FYAxis <> Value then
begin
FYAxis := Value;
UpdateYAxis
end;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetChannel(const Value: TiPlotChannel);
begin
FChannel := Value;
FChannel.Color := FColor;
FChannel.TitleText := FTitleText;
FChannel.TraceLineWidth := FTraceLineWidth;
FChannel.TraceVisible := FTraceVisible;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetAnnotation(const Value: TiPlotAnnotation);
begin
FAnnotation := Value;
FAnnotation.X := 5;
FAnnotation.Y := 7;
FAnnotation.Style := ipasText;
FAnnotation.Text := 'N/A';
FAnnotation.Font.Color := FColor;
FAnnotation.Font.Style := [fsBold];
FAnnotation.TextHorzAlignment := iahLeft;
FAnnotation.TextHorzMargin := 0;
FAnnotation.Visible := False;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.SetRefLine(const Value: TiPlotLimit);
begin
FRefLine := Value;
FRefLine.Style := iplsLineY;
FRefLine.YAxisName := TiScopeAccess(FScope as TiScope).Plot.YAxis[0].Name;
FRefLine.LineStyle := psDot;
FRefLine.Color := FColor;
FRefLine.Layer := 101;
FRefLine.UserCanMove := True;
FRefLine.UserCanEdit := False;
end;
//****************************************************************************************************************************************************
procedure TiScopeChannel.UpdateYAxis;
begin
if Assigned(FYAxis) then
begin
FYAxis.Span := 8*FVoltsPerDivision;
FYAxis.Min := -FYAxis.Span/2 - FYAxis.Span*FPosition/100;
FYAxis.DesiredIncrement := FVoltsPerDivision;
end;
end;
//****************************************************************************************************************************************************
function TiScopeChannel.GetYDisplay(Index: Integer): Double;
begin
case FCoupling of
isccDC : Result := FRawData.Y[Index];
isccAC : Result := FRawData.Y[Index] - FCapacitor;
else Result := FRawData.Y[Index];
end;
end;
//****************************************************************************************************************************************************
function TiScopeChannel.GetBufferCount: Integer;
begin
Result := FRawData.Count;
end;
//****************************************************************************************************************************************************
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -