📄 qiplotchannelcustom.pas
字号:
{*******************************************************}
{ }
{ TiPlotChannelCustom }
{ }
{ Copyright (c) 1997,2003 Iocomp Software }
{ }
{*******************************************************}
{$I iInclude.inc}
{$ifdef iVCL}unit iPlotChannelCustom;{$endif}
{$ifdef iCLX}unit QiPlotChannelCustom;{$endif}
interface
uses
{$I iIncludeUses.inc}
{$IFDEF iVCL} iPlotDataCustomList, iPlotDataFullList, iPlotDataNullList, iPlotDataCompactList, iPlotDataCompactIntervalList,{$ENDIF}
{$IFDEF iCLX}QiPlotDataCustomList, QiPlotDataFullList, QiPlotDataNullList, QiPlotDataCompactList, QiPlotDataCompactIntervalList,{$ENDIF}
{$IFDEF iVCL} Menus, iTypes, iGPFunctions, iClasses, iPlotObjects, iPlotAxis, iOPCItem;{$ENDIF}
{$IFDEF iCLX}QMenus, QiTypes, QiGPFunctions, QiClasses, QiPlotObjects, QiPlotAxis;{$ENDIF}
type
TiPlotDataCursorStyle = (ipcsValueXY, ipcsValueX, ipcsValueY, ipcsDeltaX, ipcsDeltaY, ipcsInverseDeltaX);
TiPlotDataPointStatus = (ipdpsValid, ipdpsNull, ipdpsEmpty);
TiPlotDataStyle = (ipdsStandard, ipdsCompact, ipdsCompactInterval, ipdsFullFeature);
TiPlotChannelCustom = class(TiPlotManagerObject)
private
FXAxis : TiPlotXAxis;
FYAxis : TiPlotYAxis;
{$IFDEF iVCL}FOPCItemManager : TiOPCItemManager;{$endif}
FSelectDataIndex : Integer;
FSelectHitTestRect : TRect;
FSelectMouseDown : Boolean;
FSelectMouseDownIndex : Integer;
FSelectDownRect : TRect;
FStartIndex : Integer;
FStopIndex : Integer;
FDataList : TiPlotDataCustomList;
FTitleText : String;
FYAxisName : String;
FXAxisName : String;
FXAxisTrackingEnabled : Boolean;
FYAxisTrackingEnabled : Boolean;
FLoggingActive : Boolean;
FLogBufferCount : Integer;
FMarkersAllowIndividual : Boolean;
FMarkersTurnOffLimit : Integer;
FLegendRect : TRect;
FVisibleInLegend : Boolean;
FMarkersBrushUseChannelColor : Boolean;
FMarkersPenUseChannelColor : Boolean;
FTraceVisible : Boolean;
FLogBufferSize : Integer;
FLogFileName : String;
FTag : OleVariant;
FRunningCount : Integer;
FRunningXMin : Double;
FRunningXMax : Double;
FRunningXMean : Double;
FRunningXTotal : Extended;
FRunningYMin : Double;
FRunningYMax : Double;
FRunningYMean : Double;
FRunningYTotal : Extended;
FDataStyle : TiPlotDataStyle;
FMarkersFont : TFont;
FLoadingSeparator : Char;
protected
FDataCursorXText : String;
FDataCursorYText : String;
FDataCursorYValue : Double;
FDataCursorXValue : Double;
FDataCursorStatus : TiPlotDataPointStatus;
procedure SetTitleText (const Value: String);
procedure SetColor (const Value: TColor);
procedure SetCount (const Value: Integer);
procedure SetLegendRect (const Value: TRect);
procedure SetXAxisName (const Value: String);
procedure SetYAxisName (const Value: String);
procedure SetMarkersVisible (const Value: Boolean);
procedure SetMarkersBrushColor (const Value: TColor);
procedure SetMarkersBrushStyle (const Value: TBrushStyle);
procedure SetMarkersPenColor (const Value: TColor);
procedure SetMarkersPenStyle (const Value: TPenStyle);
procedure SetMarkersPenWidth (const Value: Integer);
procedure SetMarkersSize (const Value: Integer);
procedure SetMarkersStyle (const Value: TiPlotMarkerStyle);
procedure SetMarkersFont (const Value: TFont);
procedure SetXAxisTrackingEnabled (const Value: Boolean);
procedure SetYAxisTrackingEnabled (const Value: Boolean);
procedure SetVisibleInLegend (const Value: Boolean);
procedure SetMarkersBrushUseChannelColor(const Value: Boolean);
procedure SetMarkersPenUseChannelColor (const Value: Boolean);
procedure SetTraceVisible (const Value: Boolean);
procedure SetTraceLineStyle (const Value: TiPlotLineStyle);
procedure SetTraceLineWidth (const Value: Integer);
procedure SetLogBufferSize (const Value: Integer);
procedure SetLogFileName (const Value: String);
procedure SetMarkersAllowIndividual (const Value: Boolean);
procedure SetMarkersTurnOffLimit (const Value: Integer);
procedure SetDataStyle (const Value: TiPlotDataStyle);
function GetTraceLineWidth : Integer;
function GetColor : TColor;
function GetTraceLineStyle : TiPlotLineStyle;
function GetMarkersVisible : Boolean;
function GetMarkersSize : Integer;
function GetMarkersStyle : TiPlotMarkerStyle;
function GetMarkersPenColor : TColor;
function GetMarkersBrushColor: TColor;
function GetMarkersBrushStyle: TBrushStyle;
function GetMarkersPenStyle : TPenStyle;
function GetMarkersPenWidth : Integer;
function GetCapacity : Integer;
function GetMemoryUsed : Integer;
function GetXAxis : TiPlotXAxis;
function GetYAxis : TiPlotYAxis;
function GetDataMarkerBrushColor(const Index: Integer): TColor;
function GetDataMarkerBrushStyle(const Index: Integer): TBrushStyle;
function GetDataMarkerPenColor (const Index: Integer): TColor;
function GetDataMarkerPenStyle (const Index: Integer): TPenStyle;
function GetDataMarkerPenWidth (const Index: Integer): Integer;
function GetDataMarkerSize (const Index: Integer): Integer;
function GetDataMarkerCharacter (const Index: Integer): Char;
function GetDataTraceLineColor (const Index: Integer): TColor;
function GetDataTraceLineStyle (const Index: Integer): TiPlotLineStyle;
function GetDataTraceLineWidth (const Index: Integer): Integer;
procedure SetDataMarkerBrushColor(const Index: Integer; const Value: TColor);
procedure SetDataMarkerBrushStyle(const Index: Integer; const Value: TBrushStyle);
procedure SetDataMarkerPenColor (const Index: Integer; const Value: TColor);
procedure SetDataMarkerPenStyle (const Index: Integer; const Value: TPenStyle);
procedure SetDataMarkerPenWidth (const Index, Value: Integer);
procedure SetDataMarkerSize (const Index, Value: Integer);
procedure SetDataMarkerCharacter (const Index: Integer; const Value: Char);
procedure SetDataTraceLineColor (const Index: Integer; const Value: TColor);
procedure SetDataTraceLineStyle (const Index: Integer; const Value: TiPlotLineStyle);
procedure SetDataTraceLineWidth (const Index, Value: Integer);
{$IFDEF iVCL}
procedure SetOPCGroupName (const Value: String);
procedure SetOPCComputerName(const Value: String);
procedure SetOPCItemName (const Value: String);
procedure SetOPCServerName (const Value: String);
procedure SetOPCUpdateRate (const Value: Integer);
procedure SetOPCAutoConnect (const Value: Boolean);
function GetOPCGroupName : String;
function GetOPCComputerName : String;
function GetOPCItemName : String;
function GetOPCServerName : String;
function GetOPCUpdateRate : Integer;
function GetOPCAutoConnect : Boolean;
function GetOPCActive : Boolean;
function GetOPCQualityGood : Boolean;
{$endif}
function GetDataPointSize: Integer;
function GetMaxDataPoints: Integer;
function GetDataMarkerShowing(const Index: Integer): Boolean;
procedure SetRingBufferSize(const Value: Integer);
function GetRingBufferSize: Integer;
procedure GetViewIntersectPoint(ValueXInView, ValueYInView: Double; var ValueXOutOfView: Double; var ValueYOutOfView: Double);
function GetNewY(DataX1, DataY1, DataX2, DataY2, NewX: Double): Double;
function GetNewX(DataX1, DataY1, DataX2, DataY2, NewY: Double): Double;
function GetDataEmpty(const Index: Integer): Boolean;
procedure SetDataEmpty(const Index: Integer; const Value: Boolean);
procedure GetPointPixels(ValueX, ValueY : Double; var PixelsX : Integer; var PixelsY : Integer);
function AxesValid : Boolean;
function GetCount : Integer;
function GetDataX (const Index: Integer): Double;
function GetDataY (const Index: Integer): Double;
function GetDataNull (const Index: Integer): Boolean;
function GetDataMarkerShow (const Index: Integer): Boolean;
function GetDataMarkerStyle(const Index: Integer): TiPlotMarkerStyle;
procedure SetDataX (const Index: Integer; const Value: Double);
procedure SetDataY (const Index: Integer; const Value: Double);
procedure SetDataNull (const Index: Integer; const Value: Boolean);
procedure SetDataMarkerShow (const Index: Integer; const Value: Boolean);
procedure SetDataMarkerStyle (const Index: Integer; const Value: TiPlotMarkerStyle);
function GetDataXDrawMax(Index: Integer): Double;
function GetDataXDrawMin(Index: Integer): Double;
function GetDataYDrawMax(Index: Integer): Double;
function GetDataYDrawMin(Index: Integer): Double;
procedure CalcStartXIndex; virtual; abstract;
procedure CalcStopXIndex; virtual; abstract;
function GetVisibleMaxX : Double; virtual; abstract;
function GetVisibleMinX : Double; virtual; abstract;
function GetVisibleMaxY : Double; virtual; abstract;
function GetVisibleMinY : Double; virtual; abstract;
procedure DataCursorUpate(Sender: TObject); virtual; abstract;
function GetXValueFromMousePoint(X, Y: Integer): Double;
{$IFDEF iVCL}
procedure OPCNewData(Sender: TObject); virtual;
{$endif}
procedure DrawConnectPoints(Canvas: TCanvas; XYAxisReverse: Boolean); virtual;
procedure DrawLine (Canvas: TCanvas; XYAxisReverse: Boolean; X1, Y1, X2, Y2: Double; YRef: TiPlotUnitReferenceStyle);
procedure DrawQuadPolygon (Canvas: TCanvas; XYAxisReverse: Boolean; Point1, Point2, Point3, Point4: TPointDouble);
procedure DrawMarkers (Canvas: TCanvas; XYAxisReverse: Boolean); virtual;
procedure DrawMarker (Canvas: TCanvas; Index: Integer; CenterPoint : TPoint);
procedure WriteLog;
procedure DoMouseLeft(MouseData: TiPlotMouseData); override;
procedure DoMouseUp (MouseData: TiPlotMouseData); override;
function GetMousePointer(APoint: TPoint): TCursor; override;
function iMouseHitTest(MouseData: TiPlotMouseData): Boolean; override;
procedure Loaded; override;
procedure NotificationRemove (Sender: TObject); override;
procedure NotificationRename (Sender: TObject); override;
procedure NotificationSetFocus(Sender: TObject); override;
procedure AddMenuItems(PopupMenu: TPopUpMenu); override;
property DataList : TiPlotDataCustomList read FDataList;
property LegendRect : TRect read FLegendRect write SetLegendRect;
property StartIndex : Integer read FStartIndex write FStartIndex;
property StopIndex : Integer read FStopIndex write FStopIndex;
public
constructor Create(AOwner: TObject; AOnChange, AOnInsert, AOnRemove, AOnRename: TNotifyEvent); override;
destructor Destroy; override;
function AddXY (const X, Y :Double): Integer;
procedure AddXYArrays(XData, YData: Variant);
procedure AddXYArray(Data: Variant);
procedure Clear;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -