Class TfrmDataSets

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TfrmDataSets = class(TfrmCustomGoPhast)

Description

TfrmDataSets provides a mechanism for the user to edit the TDataArrays and their properties.

When the TfrmDataSets is created, a number of variables are initialized and then GetData is called. GetData reads all the TDataArrays and displays their properties. If the user clicks on the OK button, the data sets are updated to reflect any changes that the user has made. The data sets are stored in instances of TDataArrayEdit that are stored in FArrayEdits.

CurrentInterpolator is the TCustom2DInterpolater of the currently selected data set. Its properties are displayed in other controls.

If the user presses the OK button, SetData will be called and the changes that the user made will be accepted. If the user closes the dialog box in some other way (such as by pressing the Cancel button), the changes the user made will be ignored.

Hierarchy

Overview

Fields

Implicit btnAdd: TButton;
Implicit btnCancel: TBitBtn;
Implicit btnDelete: TButton;
Implicit btnHelp: TBitBtn;
Implicit btnOK: TBitBtn;
Implicit pnlButtons: TPanel;
Implicit rpFrontFormulaCompiler: TRbwParser;
Implicit rpFrontFormulaCompilerNodes: TRbwParser;
Implicit rpSideFormulaCompiler: TRbwParser;
Implicit rpSideFormulaCompilerNodes: TRbwParser;
Implicit rpThreeDFormulaCompiler: TRbwParser;
Implicit rpThreeDFormulaCompilerNodes: TRbwParser;
Implicit rpTopFormulaCompiler: TRbwParser;
Implicit rpTopFormulaCompilerNodes: TRbwParser;
Implicit sbStatusBar: TStatusBar;
Implicit tvDataSets: TTreeView;
Implicit pcDataSets: TJvPageControl;
Implicit tabBasic: TTabSheet;
Implicit lblName: TLabel;
Implicit edName: TRbwEdit;
Implicit lblType: TLabel;
Implicit lblOrientation: TLabel;
Implicit comboType: TJvImageComboBox;
Implicit comboOrientation: TJvImageComboBox;
Implicit lblEvaluatedAt: TLabel;
Implicit lblUnits: TLabel;
Implicit comboEvaluatedAt: TJvImageComboBox;
Implicit lblInterpolation: TLabel;
Implicit lblAnisotropy: TLabel;
Implicit comboInterpolation: TJvImageComboBox;
Implicit rdeAnisotropy: TRbwDataEntry;
Implicit lblDefaultFormula: TLabel;
Implicit btnEditFormula: TButton;
Implicit tabPHAST: TTabSheet;
Implicit framePhastInterpolation: TframePhastInterpolation;
Implicit tabComment: TTabSheet;
Implicit Splitter1: TSplitter;
Implicit pnlComment: TPanel;
Implicit Comment: TLabel;
Implicit pnlDescription: TPanel;
Implicit lblAssociatedDataSets: TLabel;
Implicit memoAssociatedDataSets: TMemo;
Implicit Splitter2: TSplitter;
Implicit reDefaultFormula: TRichEdit;
Implicit reComment: TRichEdit;
Implicit comboUnits: TComboBox;
Private FDefaultConvertChoice: integer;
Private FDeletedDataSets: TList;
Private FInterpolatorList: TList;
Private FLoading: boolean;
Private FPriorModelUpToDate: boolean;
Private FArrayEdits: TList;
Private FSelectedEdit: TDataArrayEdit;

Methods

Implicit procedure btnAddClick(Sender: TObject);
Implicit procedure btnCancelClick(Sender: TObject);
Implicit procedure btnDeleteClick(Sender: TObject);
Implicit procedure btnOKClick(Sender: TObject);
Implicit procedure FormCreate(Sender: TObject); override;
Implicit procedure FormDestroy(Sender: TObject); override;
Implicit procedure framePhastInterpolationbtnEditMixtureFormulaClick( Sender: TObject);
Implicit procedure framePhastInterpolationcbPhastInterpolationClick( Sender: TObject);
Implicit procedure framePhastInterpolationedMixFormulaChange(Sender: TObject);
Implicit procedure framePhastInterpolationrdeDistance1Change(Sender: TObject);
Implicit procedure framePhastInterpolationrdeDistance2Change(Sender: TObject);
Implicit procedure framePhastInterpolationrdeValue1Change(Sender: TObject);
Implicit procedure framePhastInterpolationrdeValue2Change(Sender: TObject);
Implicit procedure framePhastInterpolationrgInterpolationDirectionClick( Sender: TObject);
Implicit procedure rdeAnisotropyChange(Sender: TObject);
Implicit procedure comboTypeChange(Sender: TObject);
Implicit procedure comboOrientationChange(Sender: TObject);
Implicit procedure comboEvaluatedAtChange(Sender: TObject);
Implicit procedure comboInterpolationChange(Sender: TObject);
Implicit procedure reDefaultFormulaExit(Sender: TObject);
Implicit procedure tvDataSetsChange(Sender: TObject; Node: TTreeNode);
Implicit procedure btnEditFormulaClick(Sender: TObject);
Implicit procedure edNameExit(Sender: TObject);
Implicit procedure reCommentExit(Sender: TObject);
Implicit procedure FormActivate(Sender: TObject);
Implicit procedure FormClose(Sender: TObject; var Action: TCloseAction);
Implicit procedure reCommentEnter(Sender: TObject);
Implicit procedure comboUnitsChange(Sender: TObject);
Private procedure CreateFormula(const DataArrayEdit: TDataArrayEdit);
Private function CreateMixtureFormula: TExpression;
Private procedure CreateVariable(const DataArrayEdit: TDataArrayEdit);
Private procedure DeleteVariable(const DataEdit: TDataArrayEdit);
Private procedure EnableOK_Button(ForceCheck: boolean = False);
Private function GenerateNewName(Root: string; const CurrentDataEdit: TDataArrayEdit): string;
Private function Get3DCompiler(const EvaluatedAt: TEvaluatedAt): TRbwParser;
Private function GetCompiler(const Orientation: TDataSetOrientation; const EvaluatedAt: TEvaluatedAt): TRbwParser;
Private procedure GetData;
Private procedure SetCurrentInterpolator(const Value: TCustom2DInterpolater);
Private procedure SetData;
Private procedure UpdateLinkages;
Private procedure UpdateVariableName(const DataEdit: TDataArrayEdit; NewName: string);
Private procedure GetGlobalVariables;
Private procedure FillDataSetsTreeView;
Private procedure SetSelectedEdit(const Value: TDataArrayEdit);
Private procedure UpdateInterpolationChoice(const DataEditor: TDataArrayEdit);
Private function GetDataSetIndex(DataSetName: string): integer;
Private procedure ValidateFormula(const DataEdit: TDataArrayEdit; NewFormula: string);
Private procedure InitializeNewDataEdit(DataEdit: TDataArrayEdit);
Private function GetCurrentInterpolator: TCustom2DInterpolater;
Private procedure InitializeControls;
Private procedure UpdateMixtureAllowed(ADataSet: TDataArray);
Private procedure SetInterpolationMethod(NewInterpolatorName: string);
Private procedure UpdateInterpolationControl;
Private procedure UpdateOkVariables(VariablePosition: Integer; const VariableName: string; var OK_Var: TOK_Variables);
Private procedure InitializeOK_Variables(var OK_Var: TOK_Variables; EvaluatedAt: TEvaluatedAt);
Private procedure FillCompilerList(CompilerList: TList);
Private procedure ClearVariables;
Public constructor Create(AOwner: TComponent); override;

Properties

Private property CurrentInterpolator: TCustom2DInterpolater read GetCurrentInterpolator write SetCurrentInterpolator;
Protected property SelectedEdit: TDataArrayEdit read FSelectedEdit write SetSelectedEdit;

Description

Fields

Implicit btnAdd: TButton;

btnAdd is used to add a new TDataArray. See btnAddClick.

Implicit btnCancel: TBitBtn;

btnCancel is used to close the dialog box without doing anything. See btnCancelClick.

Implicit btnDelete: TButton;

btnDelete is used to delete a TDataArray. See btnDeleteClick.

Implicit btnHelp: TBitBtn;

btnHelp: TBitBtn; btnHelp is used to show help for the TfrmDataSets.

Implicit btnOK: TBitBtn;

btnOK is used to accept all changes made in the dialog box and close the dialog box. See btnOKClick.

Implicit pnlButtons: TPanel;

pnlButtons is the TPanel holding buttons at the bottom of the TfrmDataSets.

Implicit rpFrontFormulaCompiler: TRbwParser;

rpFrontFormulaCompiler is used to handle formulas for 2D TDataArrays evaluated at elements on the front view of the model.

Implicit rpFrontFormulaCompilerNodes: TRbwParser;

rpFrontFormulaCompilerNodes is used to handle formulas for 2D TDataArrays evaluated at nodes on the front view of the model.

Implicit rpSideFormulaCompiler: TRbwParser;

rpSideFormulaCompiler is used to handle formulas for 2D TDataArrays evaluated at elements on the side view of the model.

Implicit rpSideFormulaCompilerNodes: TRbwParser;

rpSideFormulaCompilerNodes is used to handle formulas for 2D TDataArrays evaluated at nodes on the side view of the model.

Implicit rpThreeDFormulaCompiler: TRbwParser;

rpThreeDFormulaCompiler is used to handle formulas for 3D TDataArrays evaluated at elements.

Implicit rpThreeDFormulaCompilerNodes: TRbwParser;

rpThreeDFormulaCompilerNodes is used to handle formulas for 3D TDataArrays evaluated at nodes.

Implicit rpTopFormulaCompiler: TRbwParser;

rpTopFormulaCompiler is used to handle formulas for 2D TDataArrays evaluated at elements on the top view of the model.

Implicit rpTopFormulaCompilerNodes: TRbwParser;

rpTopFormulaCompilerNodes is used to handle formulas for 2D TDataArrays evaluated at nodes on the top view of the model.

Implicit sbStatusBar: TStatusBar;

sbStatusBar is the status bar at the bottom of the dialog box.

Implicit tvDataSets: TTreeView;

The terminal nodes of tvDataSets are used to select a TDataArray to be edited.

Implicit pcDataSets: TJvPageControl;
 
Implicit tabBasic: TTabSheet;
 
Implicit lblName: TLabel;
 
Implicit edName: TRbwEdit;
 
Implicit lblType: TLabel;
 
Implicit lblOrientation: TLabel;
 
Implicit comboType: TJvImageComboBox;
 
Implicit comboOrientation: TJvImageComboBox;
 
Implicit lblEvaluatedAt: TLabel;
 
Implicit lblUnits: TLabel;
 
Implicit comboEvaluatedAt: TJvImageComboBox;
 
Implicit lblInterpolation: TLabel;
 
Implicit lblAnisotropy: TLabel;
 
Implicit comboInterpolation: TJvImageComboBox;
 
Implicit rdeAnisotropy: TRbwDataEntry;
 
Implicit lblDefaultFormula: TLabel;
 
Implicit btnEditFormula: TButton;
 
Implicit tabPHAST: TTabSheet;
 
Implicit framePhastInterpolation: TframePhastInterpolation;
 
Implicit tabComment: TTabSheet;
 
Implicit Splitter1: TSplitter;
 
Implicit pnlComment: TPanel;
 
Implicit Comment: TLabel;
 
Implicit pnlDescription: TPanel;
 
Implicit lblAssociatedDataSets: TLabel;
 
Implicit memoAssociatedDataSets: TMemo;
 
Implicit Splitter2: TSplitter;
 
Implicit reDefaultFormula: TRichEdit;
 
Implicit reComment: TRichEdit;
 
Implicit comboUnits: TComboBox;

comboUnits displays the units with which the selected data set is measured.

Private FDefaultConvertChoice: integer;

When the user makes a change that could make a formula invalid, the user will be prompted to either automatically adjust the formula or to change the data type of the data set. The most suitable default response will vary depending on what the user has done. FDefaultConvertChoice is used to store the default response that will be presented to the user. -1: The user must select what to do. 0: change the data type of the data set. 1: automatically adjust the formula.

Private FDeletedDataSets: TList;

As its name implies, FDeletedDataSets contains the TDataArrays that the user wants to delete.

Private FInterpolatorList: TList;

FInterpolatorList contains a list of TInterpolatorTypes. It is used to retrieve the type of a TCustom2DInterpolater based on its InterpolatorName and to create new interpolator instances when the user changes the type of interpolation to be performed.

Private FLoading: boolean;

FLoading is set to True in GetData and elsewhere to prevent certain methods from going into infinite loops.

Private FPriorModelUpToDate: boolean;

FPriorModelUpToDate is used to restore the value of frmGoPhast.Model.UpToDate after it has been changed in GetData.

Private FArrayEdits: TList;

FArrayEdits stores a TDataArrayEdit for each TDataArray.

Private FSelectedEdit: TDataArrayEdit;

See SelectedEdit.

Methods

Implicit procedure btnAddClick(Sender: TObject);

btnAddClick adds a new TDataArray at the end of tvDataSets.

Implicit procedure btnCancelClick(Sender: TObject);

btnCancelClick closes the TfrmDataSets without making any changes to the TDataArrays.

Implicit procedure btnDeleteClick(Sender: TObject);

btnDeleteClick deletes the TDataArray in the selected item of tvDataSets.

Implicit procedure btnOKClick(Sender: TObject);

btnOKClick accepts the changes in the TDataArrays and closes the TfrmDataSets.

Implicit procedure FormCreate(Sender: TObject); override;

FormCreate initializes many things when TfrmDataSets is created.

Implicit procedure FormDestroy(Sender: TObject); override;

FormDestroy frees private fields of TfrmDataSets when TfrmDataSets is destroyed.

Implicit procedure framePhastInterpolationbtnEditMixtureFormulaClick( Sender: TObject);

framePhastInterpolationbtnEditMixtureFormulaClick responds to framePhastInterpolation.btnEditMixtureFormula being clicked. It allows the user to edit the formula for mixtures.

Implicit procedure framePhastInterpolationcbPhastInterpolationClick( Sender: TObject);

framePhastInterpolationcbPhastInterpolationClick responds to framePhastInterpolation.cbPhastInterpolation being clicked. It activates or deactivates PHAST-style interpolation.

Implicit procedure framePhastInterpolationedMixFormulaChange(Sender: TObject);

framePhastInterpolationedMixFormulaChange responds to the user editing the formula for mixtures by storing the new value. See TPhastInterpolationValues.

Implicit procedure framePhastInterpolationrdeDistance1Change(Sender: TObject);

framePhastInterpolationrdeDistance1Change responds to the user editing the first distance by storing the new value. See TPhastInterpolationValues.

Implicit procedure framePhastInterpolationrdeDistance2Change(Sender: TObject);

framePhastInterpolationrdeDistance2Change responds to the user editing the second distance by storing the new value. See TPhastInterpolationValues.

Implicit procedure framePhastInterpolationrdeValue1Change(Sender: TObject);

framePhastInterpolationrdeValue1Change responds to the user editing the first value by storing the new value. See TPhastInterpolationValues.

Implicit procedure framePhastInterpolationrdeValue2Change(Sender: TObject);

framePhastInterpolationrdeValue2Change responds to the user editing the second value by storing the new value. See TPhastInterpolationValues.

Implicit procedure framePhastInterpolationrgInterpolationDirectionClick( Sender: TObject);

framePhastInterpolationrgInterpolationDirectionClick responds to the user editing the interpolation direction by storing the new value. See TPhastInterpolationValues.

Implicit procedure rdeAnisotropyChange(Sender: TObject);

rdeAnisotropyChange responds to the user editing the anisotropy by storing the new value.

Implicit procedure comboTypeChange(Sender: TObject);

See comboType.

Implicit procedure comboOrientationChange(Sender: TObject);

See comboOrientation.

Implicit procedure comboEvaluatedAtChange(Sender: TObject);

See comboEvaluatedAt.

Implicit procedure comboInterpolationChange(Sender: TObject);

See comboInterpolation.

Implicit procedure reDefaultFormulaExit(Sender: TObject);

See reDefaultFormula.

Implicit procedure tvDataSetsChange(Sender: TObject; Node: TTreeNode);

tvDataSetsChange changes the selected TDataArray.

Implicit procedure btnEditFormulaClick(Sender: TObject);

See btnEditFormula.

Implicit procedure edNameExit(Sender: TObject);

See edName.

Implicit procedure reCommentExit(Sender: TObject);
 
Implicit procedure FormActivate(Sender: TObject);
 
Implicit procedure FormClose(Sender: TObject; var Action: TCloseAction);
 
Implicit procedure reCommentEnter(Sender: TObject);
 
Implicit procedure comboUnitsChange(Sender: TObject);
 
Private procedure CreateFormula(const DataArrayEdit: TDataArrayEdit);

When a new data set has been added or the formula for a data set has changed, CreateFormula creates a TExpression for that new formula. If the formula is not valid, CreateFormula fixes it.

Private function CreateMixtureFormula: TExpression;

CreateMixtureFormula creates a TExpression for the formula in framePhastInterpolation.edMixFormula.

Private procedure CreateVariable(const DataArrayEdit: TDataArrayEdit);

CreateVariable creates a TCustomVariable that represents a TDataArray in the formula compilers. If a TDataArray is already represented by a variable, DeleteVariable should be called before CreateVariable.

Private procedure DeleteVariable(const DataEdit: TDataArrayEdit);

DeleteVariable deletes the variable that represents the TDataArray in Row in the formula compilers.

Private procedure EnableOK_Button(ForceCheck: boolean = False);

EnableOK_Button allows the user to click the OK button (btnOK) only if all the formulas are valid.

Private function GenerateNewName(Root: string; const CurrentDataEdit: TDataArrayEdit): string;

GenerateNewName generates a name for a TDataArray that is valid and does not conflict with the names of any existing TDataArrays.

Private function Get3DCompiler(const EvaluatedAt: TEvaluatedAt): TRbwParser;

Get3DCompiler returns the TRbwParser that is used with TDataArrays with a dso3D TDataSetOrientation and the TEvaluatedAt specified in its parameter.

Private function GetCompiler(const Orientation: TDataSetOrientation; const EvaluatedAt: TEvaluatedAt): TRbwParser;

GetCompiler returns the TRbwParser that is used with the combination of Orientation and Evaluated specified in its parameters.

Private procedure GetData;

GetData stores the data from all the TDataArrays in the TfrmDataSets so the user can edit the TDataArrays.

Private procedure SetCurrentInterpolator(const Value: TCustom2DInterpolater);

SetCurrentInterpolator sets the CurrentInterpolator.

Private procedure SetData;

When the user presses the OK button. SetData will be called to update all the TDataArrays that have been added, deleted, or changed.

Private procedure UpdateLinkages;

UpdateLinkages updates which TDataArray depends on which when a formula is changed. The linkage information is stored in NewUses.

Private procedure UpdateVariableName(const DataEdit: TDataArrayEdit; NewName: string);

UpdateVariableName renames the variables that represent the DataArray in the formulu compiler.

Private procedure GetGlobalVariables;

GetGlobalVariables creates variables in each of the TRbwParser to represent the global variables.

Private procedure FillDataSetsTreeView;

FillDataSetsTreeView fills tvDataSets with a hierarchical view of the TDataArrays in the model.

Private procedure SetSelectedEdit(const Value: TDataArrayEdit);

See SelectedEdit.

Private procedure UpdateInterpolationChoice(const DataEditor: TDataArrayEdit);

UpdateInterpolationChoice updates the items shown in comboInterpolation so that only valid choices are shown.

Private function GetDataSetIndex(DataSetName: string): integer;

GetDataSetIndex returns the position in FArrayEdits of the TDataArrayEdit whose Name is DataSetName.

Private procedure ValidateFormula(const DataEdit: TDataArrayEdit; NewFormula: string);

ValidateFormula checks that a formula is valid. A formula is invalid if it can not be compiled or contains a circular reference.

Private procedure InitializeNewDataEdit(DataEdit: TDataArrayEdit);

If a new TDataArray has been added, InitializeNewDataEdit initializes the TDataArrayEdit used to edit it.

Private function GetCurrentInterpolator: TCustom2DInterpolater;
 
Private procedure InitializeControls;
 
Private procedure UpdateMixtureAllowed(ADataSet: TDataArray);
 
Private procedure SetInterpolationMethod(NewInterpolatorName: string);
 
Private procedure UpdateInterpolationControl;
 
Private procedure UpdateOkVariables(VariablePosition: Integer; const VariableName: string; var OK_Var: TOK_Variables);
 
Private procedure InitializeOK_Variables(var OK_Var: TOK_Variables; EvaluatedAt: TEvaluatedAt);
 
Private procedure FillCompilerList(CompilerList: TList);
 
Private procedure ClearVariables;
 
Public constructor Create(AOwner: TComponent); override;
 

Properties

Private property CurrentInterpolator: TCustom2DInterpolater read GetCurrentInterpolator write SetCurrentInterpolator;

CurrentInterpolator is the TCustom2DInterpolater of the currently selected item in tvDataSets.

Protected property SelectedEdit: TDataArrayEdit read FSelectedEdit write SetSelectedEdit;

SelectedEdit is the TDataArrayEdit that is currently being edited.


Generated by PasDoc 0.12.1 on 2013-05-13 15:41:35