Class TFitClient

Unit

Declaration

type TFitClient = class(TInterfacedObject, IClientCallback)

Description

Implements all client logic of the application. Must be completely independent from UI.

Hierarchy

  • TInterfacedObject
  • TFitClient

Overview

Fields

Protected FAnimationMode: boolean;
Protected FAsyncOperationFinished: TAsyncOperationFinished;
Protected FAsyncState: TAsyncState;
Protected FBackgroundPoints: TTitlePointsSet;
Protected FComputedProfile: TTitlePointsSet;
Protected FCurMin: double;
Protected FCurveAttributes: TMSCRCurveList;
Protected FCurvePositions: TTitlePointsSet;
Protected FCurves: TSelfCopiedCompList;
Protected FDataLoader: IDataLoader;
Protected FDataLoaderInjector: IDataLoaderInjector;
Protected FDeltaProfile: TTitlePointsSet;
Protected FExperimentalProfile: TTitlePointsSet;
Protected FFitService: IFitService;
Public FFitViewer: IFitViewer;
Protected FOpenState: TOpenState;
Protected FRFactorBounds: TTitlePointsSet;
Protected FSelectedArea: TTitlePointsSet;
Protected FSelectedAreaMode: boolean;
Protected FSelectedPoints: TTitlePointsSet;
Protected FSelectionMode: TSelMode;
Protected FWaveLength: double;

Methods

Public constructor CreateWithInjector( ADataLoaderInjector: IDataLoaderInjector);
Public destructor Destroy; override;
Public function AsyncOper: boolean;
Public function GetBackgroundPoints: TNeutronPointsSet;
Public function GetCalcTimeStr: string;
Public function GetCurrentPointsSet: TTitlePointsSet;
Public function GetCurveList: TMSCRCurveList;
Public function GetCurvePositions: TNeutronPointsSet;
Public function GetProfilePoints: TTitlePointsSet;
Public function GetRFactorBounds: TNeutronPointsSet;
Public function GetRFactorStr: string;
Public function GetSelectedPoints: TNeutronPointsSet;
Public function GetSpecialCurveParameters: Curve_parameters;
Public function GetWaveLength: double;
Protected function GetBackFactor: double;
Protected function GetBackgroundVariationEnabled: boolean;
Protected function GetCurveScalingEnabled: boolean;
Protected function GetCurveThresh: double;
Protected function GetCurveType: TCurveTypeId;
Protected function GetMaxRFactor: double;
Protected function GetSelectionMode: TSelMode;
Public procedure AddPointToActive(XValue, YValue: double);
Public procedure AddPointToBackground(XValue, YValue: double);
Public procedure AddPointToCurvePositions(XValue, YValue: double);
Public procedure AddPointToRFactorBounds(XValue, YValue: double);
Public procedure AddPointToSelected(XValue, YValue: double);
Public procedure ComputeBackgroundPoints;
Public procedure ComputeBackgroundPointsDone;
Public procedure ComputeCurveBounds;
Public procedure ComputeCurveBoundsDone;
Public procedure ComputeCurvePositions;
Public procedure ComputeCurvePositionsDone;
Public procedure CreateCurveList;
Public procedure DoAllAutomatically;
Public procedure Done;
Public procedure LoadDataSet(FileName: string);
Public procedure MinimizeDifference;
Public procedure MinimizeNumberOfCurves;
Public procedure Reload;
Public procedure RemoveBackgroundPoints;
Public procedure RemoveCurvePositions;
Public procedure RemoveRFactorBounds;
Public procedure ReplacePointInBackground( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
Public procedure ReplacePointInCurvePositions( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
Public procedure ReplacePointInProfile( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
Public procedure ReplacePointInRFactorBounds( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
Public procedure ReplacePointInSelected( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
Public procedure SelectAllPointsAsCurvePositions;
Public procedure SelectEntireProfile;
Public procedure SelectProfileInterval(StartPointIndex, StopPointIndex: longint);
Public procedure SetSpecialCurveParameters(ACurveExpr: string; CP: Curve_parameters);
Public procedure SetWaveLength(AWaveLength: double);
Public procedure ShowCurMin(Min: double);
Public procedure ShowProfile;
Public procedure SmoothProfile;
Public procedure StopAsyncOper;
Public procedure SubtractBackground(Auto: boolean);
Protected procedure AddPoint(var Points: TTitlePointsSet; XValue, YValue: double; Plot: TPlotProc);
Protected procedure Clear;
Protected procedure ClearExpProfile;
Protected procedure CopyProfileDataFromLoader;
Protected procedure FillDatasheetTable;
Protected procedure Hide(ToRefresh: TNeutronPointsSet);
Protected procedure HideBackground;
Protected procedure HideCurvePositions;
Protected procedure HideCurves;
Protected procedure HideExpProfile;
Protected procedure HideRFactorBounds;
Protected procedure PlotBackground;
Protected procedure PlotComputedProfile;
Protected procedure PlotCurvePositions;
Protected procedure PlotCurves;
Protected procedure PlotDeltaProfile;
Protected procedure PlotExpProfile;
Protected procedure PlotRFactorBounds;
Protected procedure PlotSelectedPoints;
Protected procedure PlotSelectedProfileInterval;
Protected procedure RecreateAndShowSelectedPoints(Title: string);
Protected procedure Refresh;
Protected procedure RefreshPointsSet(ToRefresh: TNeutronPointsSet);
Protected procedure RemoveComputedProfile;
Protected procedure RemoveDeltaProfile;
Protected procedure RemoveSelectedArea;
Protected procedure RemoveSelectedPoints;
Protected procedure ReplacePoint(Points: TTitlePointsSet; PrevXValue, PrevYValue, NewXValue, NewYValue: double; Plot: TPlotProc);
Protected procedure SelectProfileIntervalActual(ANeutronPoints: TNeutronPointsSet; StartPointIndex, StopPointIndex: longint);
Protected procedure SetBackFactor(ABackFactor: double);
Protected procedure SetBackgroundVariationEnabled(AEnable: boolean);
Protected procedure SetCurveScalingEnabled(AEnabled: boolean);
Protected procedure SetCurvesListLambda;
Protected procedure SetCurveThresh(ACurveThresh: double);
Protected procedure SetCurveType(ACurveType: TCurveTypeId);
Protected procedure SetExpProfile(AExpProfile: TTitlePointsSet);
Protected procedure SetMaxRFactor(AMaxRFactor: double);
Protected procedure SetSelectionMode(ASelectionMode: TSelMode);
Protected procedure UpdateComputedData(ShowExtraData: boolean);

Properties

Public property AnimationMode: boolean read FAnimationMode write FAnimationMode;
Public property AsyncState: TAsyncState read FAsyncState;
Public property BackFactor: double read GetBackFactor write SetBackFactor;
Public property BackgroundVariationEnabled: boolean read GetBackgroundVariationEnabled write SetBackgroundVariationEnabled;
Public property CurveScalingEnabled: boolean read GetCurveScalingEnabled write SetCurveScalingEnabled;
Public property CurveThresh: double read GetCurveThresh write SetCurveThresh;
Public property CurveTypeId: TCurveTypeId read GetCurveType write SetCurveType ;
Public property FitService: IFitService read FFitService write FFitService;
Public property MaxRFactor: double read GetMaxRFactor write SetMaxRFactor;
Public property OnAsyncOperationFinished: TAsyncOperationFinished read FAsyncOperationFinished write FAsyncOperationFinished;
Public property OpenState: TOpenState read FOpenState;
Public property SelectedAreaMode: boolean read FSelectedAreaMode;
Public property SelectionMode: TSelMode read FSelectionMode write SetSelectionMode;

Description

Fields

Protected FAnimationMode: boolean;

Enables animation mode in which UI is updated on every computation cycle not only on finishing. By default is false.

Protected FAsyncOperationFinished: TAsyncOperationFinished;

Callback on asynchronous operation finishing.

Protected FAsyncState: TAsyncState;
 
Protected FBackgroundPoints: TTitlePointsSet;

List of background points which is used for transmission between manual and automatic selection modes.

Protected FComputedProfile: TTitlePointsSet;

Sum of all model curces which is compared with experimental data.

Protected FCurMin: double;
 
Protected FCurveAttributes: TMSCRCurveList;

Containers of parameters of curves.

Protected FCurvePositions: TTitlePointsSet;

Positions of curves. Only X-coordinates are used.

Protected FCurves: TSelfCopiedCompList;

Containers of calculated curves. Each object contains data of specimen curve.

Protected FDataLoader: IDataLoader;
 
Protected FDataLoaderInjector: IDataLoaderInjector;
 
Protected FDeltaProfile: TTitlePointsSet;
 
Protected FExperimentalProfile: TTitlePointsSet;

All the data displayed on the chart. They are required to be able control of X-coordinate.

Protected FFitService: IFitService;
 
Public FFitViewer: IFitViewer;
 
Protected FOpenState: TOpenState;
 
Protected FRFactorBounds: TTitlePointsSet;

List of point pairs which limit interval of R-factor calculation. Always must be displayed in order to show user in which mode R-factor is calculated.

Protected FSelectedArea: TTitlePointsSet;

Region of given profile data with which user is working at the given moment.

Protected FSelectedAreaMode: boolean;

If True then in all operations only data belonging to selected ared are used otherwise all profile data are used.

Protected FSelectedPoints: TTitlePointsSet;

Set of points selected by user.

Protected FSelectionMode: TSelMode;
 
Protected FWaveLength: double;

TODO: remove this attribute.

Methods

Public constructor CreateWithInjector( ADataLoaderInjector: IDataLoaderInjector);
 
Public destructor Destroy; override;
 
Public function AsyncOper: boolean;

Gets state of asynchronous operation from the server.

Public function GetBackgroundPoints: TNeutronPointsSet;
 
Public function GetCalcTimeStr: string;
 
Public function GetCurrentPointsSet: TTitlePointsSet;

Returns a set with which user works at the moment.

Public function GetCurveList: TMSCRCurveList;
 
Public function GetCurvePositions: TNeutronPointsSet;
 
Public function GetProfilePoints: TTitlePointsSet;

Returns full profile or part of profile selected at the moment.

Public function GetRFactorBounds: TNeutronPointsSet;
 
Public function GetRFactorStr: string;
 
Public function GetSelectedPoints: TNeutronPointsSet;
 
Public function GetSpecialCurveParameters: Curve_parameters;
 
Public function GetWaveLength: double;
 
Protected function GetBackFactor: double;
 
Protected function GetBackgroundVariationEnabled: boolean;
 
Protected function GetCurveScalingEnabled: boolean;
 
Protected function GetCurveThresh: double;
 
Protected function GetCurveType: TCurveTypeId;
 
Protected function GetMaxRFactor: double;
 
Protected function GetSelectionMode: TSelMode;
 
Public procedure AddPointToActive(XValue, YValue: double);
 
Public procedure AddPointToBackground(XValue, YValue: double);
 
Public procedure AddPointToCurvePositions(XValue, YValue: double);
 
Public procedure AddPointToRFactorBounds(XValue, YValue: double);
 
Public procedure AddPointToSelected(XValue, YValue: double);

All call AddPoint method.

Public procedure ComputeBackgroundPoints;
 
Public procedure ComputeBackgroundPointsDone;
 
Public procedure ComputeCurveBounds;
 
Public procedure ComputeCurveBoundsDone;
 
Public procedure ComputeCurvePositions;
 
Public procedure ComputeCurvePositionsDone;
 
Public procedure CreateCurveList;
 
Public procedure DoAllAutomatically;
 
Public procedure Done;
 
Public procedure LoadDataSet(FileName: string);
 
Public procedure MinimizeDifference;
 
Public procedure MinimizeNumberOfCurves;
 
Public procedure Reload;
 
Public procedure RemoveBackgroundPoints;
 
Public procedure RemoveCurvePositions;
 
Public procedure RemoveRFactorBounds;

Do only cleaning of sets.

Public procedure ReplacePointInBackground( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
 
Public procedure ReplacePointInCurvePositions( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
 
Public procedure ReplacePointInProfile( PrevXValue, PrevYValue, NewXValue, NewYValue: double);

All call ReplacePoint method.

Public procedure ReplacePointInRFactorBounds( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
 
Public procedure ReplacePointInSelected( PrevXValue, PrevYValue, NewXValue, NewYValue: double);
 
Public procedure SelectAllPointsAsCurvePositions;
 
Public procedure SelectEntireProfile;
 
Public procedure SelectProfileInterval(StartPointIndex, StopPointIndex: longint);

Cleans chart and moves data from full profile to data of selected iterval.

Public procedure SetSpecialCurveParameters(ACurveExpr: string; CP: Curve_parameters);
 
Public procedure SetWaveLength(AWaveLength: double);
 
Public procedure ShowCurMin(Min: double);

Callbacks from the server.

Public procedure ShowProfile;
 
Public procedure SmoothProfile;

Wrappers for server methods. Mustn't create messages because this is responsibility of GUI. Instead of this must throw exceptions.

Public procedure StopAsyncOper;
 
Public procedure SubtractBackground(Auto: boolean);
 
Protected procedure AddPoint(var Points: TTitlePointsSet; XValue, YValue: double; Plot: TPlotProc);

Adds new point to the given set. Second call removes point from the set. In last case the set is recreated.

Protected procedure Clear;
 
Protected procedure ClearExpProfile;
 
Protected procedure CopyProfileDataFromLoader;
 
Protected procedure FillDatasheetTable;
 
Protected procedure Hide(ToRefresh: TNeutronPointsSet);
 
Protected procedure HideBackground;
 
Protected procedure HideCurvePositions;
 
Protected procedure HideCurves;
 
Protected procedure HideExpProfile;
 
Protected procedure HideRFactorBounds;
 
Protected procedure PlotBackground;
 
Protected procedure PlotComputedProfile;
 
Protected procedure PlotCurvePositions;
 
Protected procedure PlotCurves;

Wrappers for calls to external displaying methods. They are necessary to check that external interface methods are connected. Opposite means that there aren't corresponding GUI elements.

Protected procedure PlotDeltaProfile;
 
Protected procedure PlotExpProfile;
 
Protected procedure PlotRFactorBounds;
 
Protected procedure PlotSelectedPoints;
 
Protected procedure PlotSelectedProfileInterval;
 
Protected procedure RecreateAndShowSelectedPoints(Title: string);

Creates list of selected points and inserts new item into chart legend (CheckListBox).

Protected procedure Refresh;
 
Protected procedure RefreshPointsSet(ToRefresh: TNeutronPointsSet);
 
Protected procedure RemoveComputedProfile;
 
Protected procedure RemoveDeltaProfile;
 
Protected procedure RemoveSelectedArea;
 
Protected procedure RemoveSelectedPoints;
 
Protected procedure ReplacePoint(Points: TTitlePointsSet; PrevXValue, PrevYValue, NewXValue, NewYValue: double; Plot: TPlotProc);

Replaces point and updates chart.

Protected procedure SelectProfileIntervalActual(ANeutronPoints: TNeutronPointsSet; StartPointIndex, StopPointIndex: longint);

Copies data from the given point set to the set of selected interval.

Protected procedure SetBackFactor(ABackFactor: double);
 
Protected procedure SetBackgroundVariationEnabled(AEnable: boolean);
 
Protected procedure SetCurveScalingEnabled(AEnabled: boolean);
 
Protected procedure SetCurvesListLambda;
 
Protected procedure SetCurveThresh(ACurveThresh: double);
 
Protected procedure SetCurveType(ACurveType: TCurveTypeId);
 
Protected procedure SetExpProfile(AExpProfile: TTitlePointsSet);
 
Protected procedure SetMaxRFactor(AMaxRFactor: double);
 
Protected procedure SetSelectionMode(ASelectionMode: TSelMode);
 
Protected procedure UpdateComputedData(ShowExtraData: boolean);

Updates all the data and refreshes chart.

Properties

Public property AnimationMode: boolean read FAnimationMode write FAnimationMode;
 
Public property AsyncState: TAsyncState read FAsyncState;
 
Public property BackFactor: double read GetBackFactor write SetBackFactor;
 
Public property BackgroundVariationEnabled: boolean read GetBackgroundVariationEnabled write SetBackgroundVariationEnabled;

Server attributes.

Public property CurveScalingEnabled: boolean read GetCurveScalingEnabled write SetCurveScalingEnabled;
 
Public property CurveThresh: double read GetCurveThresh write SetCurveThresh;
 
Public property CurveTypeId: TCurveTypeId read GetCurveType write SetCurveType ;
 
Public property FitService: IFitService read FFitService write FFitService;
 
Public property MaxRFactor: double read GetMaxRFactor write SetMaxRFactor;
 
Public property OnAsyncOperationFinished: TAsyncOperationFinished read FAsyncOperationFinished write FAsyncOperationFinished;

Callbacks for updating user interface. They are called from main thread of client application. Callbacks can throw exceptions. They can be not assigned (nil).

Public property OpenState: TOpenState read FOpenState;
 
Public property SelectedAreaMode: boolean read FSelectedAreaMode;
 
Public property SelectionMode: TSelMode read FSelectionMode write SetSelectionMode;
 

Generated by PasDoc 0.15.0.