IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Forms.ScalarFunctionScriptControl Class Reference

Control for definition of scalar functions by user defined expressions (through a script loader). More...

+ Inheritance diagram for IG.Forms.ScalarFunctionScriptControl:
+ Collaboration diagram for IG.Forms.ScalarFunctionScriptControl:

Public Member Functions

 ScalarFunctionScriptControl ()
 Constructs the scalar function script control. More...
 
 ScalarFunctionScriptControl (bool setTestDefinitions)
 Constructs the scalar function script control. More...
 
void SetTestDefinitions ()
 Setts a test definition. More...
 
bool HasParentUnsavedChanges (bool set=false)
 Get or sets a flag indicating whether the parent control has unsaved changes. More...
 
void CopyDataFromController ()
 Copies data from the internal DTO to the current control. More...
 
void ResetFunctionDefinition ()
 Resets function definition to simply "0". Gradients are redefined accordingly. More...
 
string CreateFunctonSummary ()
 

Protected Member Functions

string GetFunctionSignature ()
 Returns function signature created from the data. More...
 
override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Protected Attributes

bool _isGradientDefined = false
 

Properties

IG.Lib.IReporter Reporter [get]
 Reporter used for internal reporting. More...
 
string FunctionNameTitleNormal [get, set]
 Normal text of the label that introduces function name input box. More...
 
string FunctionNameTitleModified [get, set]
 Normal text of the label that introduces function name input box. More...
 
ScalarFunctionScriptController FunctionController [get, set]
 Cotroller that holds the definition data of the scalar function entered by the current control, and also holds mechanism for compiling and loading scalar function from these definitions. More...
 
ScalarFunctionLoader FunctionLoader [get, protected set]
 Scalar function loader that is responsible for creation of scalar function objects from data. More...
 
LoadableScalarFunctionBase Function [get]
 Gets the function generated by the function loader. More...
 
VectorFunctionScriptControl VectorFunctionControl [get, set]
 The parent vector function script control. When this control is embedded within the vector function script control, this property should be set such that communication back to parent is enabled (in particular, communication about unsaved changes). More...
 
bool HasUnsavedChanges [get, set]
 Whether the current function definition has unsaved changes. More...
 
bool IsLoaderConsistent [get, protected set]
 Whether function loader is in consistent state. More...
 
string FunctionName [get, set]
 Name of the function. More...
 
string FunctionDescription [get, set]
 
int Dimension [get, set]
 Gets or sets function dimension. More...
 
string[] ParameterNames [get, set]
 Names of function parameters. More...
 
string ValueDefinition [get, set]
 String that defines function value. More...
 
bool IsGradientDefined [get, set]
 
string[] GradientDefinitions [get, set]
 String that defines function gradients. More...
 
InputOutputDataDefiniton DataDefinition [get, set]
 Definition of input and output data for the represented scalar function. More...
 
FileSelector FileSelector [get]
 GUI component for seclecting files. More...
 

Private Member Functions

void CopyDataToController ()
 Copies data from the current control to the internal function DTO. More...
 
void btnSummary_Click (object sender, EventArgs e)
 
void txtName_Validated (object sender, EventArgs e)
 
void txtDescription_Validated (object sender, EventArgs e)
 
void txtParameterNames_Validated (object sender, EventArgs e)
 
void numDimension_Validated (object sender, EventArgs e)
 
void txtValue_Validated (object sender, EventArgs e)
 
void txtGradients_Validated (object sender, EventArgs e)
 
void chkGradients_CheckedChanged (object sender, EventArgs e)
 
void btnCreateFunction_Click (object sender, EventArgs e)
 Creates a function i advance (before it is eeded for any other operation). Error message is launched if creation is not successful. More...
 
void btnValueCalculator_Click (object sender, EventArgs e)
 Launches value calculator where user can calculate functio values with the function that was defined in the current control. More...
 
void btnPlot1d_Click (object sender, EventArgs e)
 Launches 1D parametric plots of the function defined in this control. More...
 
void btnPlot2d_Click (object sender, EventArgs e)
 Launches 2D parametric plots of the function defined in this control. More...
 
void btnSave_Click (object sender, EventArgs e)
 Saves the current fucntion definition to a JSON file. More...
 
void btnLoad_Click (object sender, EventArgs e)
 Loads the current function definition from a JSON file. More...
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 

Private Attributes

string _functionNameTitleNormal = "Function Name: "
 
string _functionNameTitleModified = "Function Name: (*)"
 
ScalarFunctionScriptController _functionController
 
VectorFunctionScriptControl _parentVectorFunctionControl = null
 
bool _hasUnsavedChanges = false
 
bool _isLoaderConsistent = false
 
Color _bgDefined = Color.White
 
Color _bgUndefined = Color.LightGray
 
InputOutputDataDefiniton _dataDefinition = null
 
System.ComponentModel.IContainer components = null
 Required designer variable. More...
 
System.Windows.Forms.Label lblTitle
 
System.Windows.Forms.Label lblDimension
 
System.Windows.Forms.Label lblName
 
System.Windows.Forms.TextBox txtName
 
System.Windows.Forms.NumericUpDown numDimension
 
System.Windows.Forms.Panel pnlOuter
 
System.Windows.Forms.TextBox txtValue
 
System.Windows.Forms.Label lblValue
 
System.Windows.Forms.TextBox txtParameterNames
 
System.Windows.Forms.Label lblParameterNames
 
System.Windows.Forms.CheckBox chkGradients
 
System.Windows.Forms.Button btnValueCalculator
 
System.Windows.Forms.Button btnCreateFunction
 
System.Windows.Forms.TextBox txtGradients
 
System.Windows.Forms.Label label1
 
System.Windows.Forms.Label lblFunctionSignature
 
System.Windows.Forms.Button btnSummary
 
System.Windows.Forms.TextBox txtDescription
 
System.Windows.Forms.Label lblDescription
 
System.Windows.Forms.Button btnPlot1d
 
System.Windows.Forms.Button btnPlot2d
 
System.Windows.Forms.Button btnSave
 
FileSelector fileSelector1
 
System.Windows.Forms.Panel pnlParameters
 
System.Windows.Forms.Panel pnlValues
 
System.Windows.Forms.Panel pnlGradients
 
System.Windows.Forms.Panel pnlButtons
 
System.Windows.Forms.Panel pnlPlotButtons
 
System.Windows.Forms.Panel pnlBasic
 
System.Windows.Forms.Panel pnlTop
 
System.Windows.Forms.Panel pnlBasicAndTitle
 
System.Windows.Forms.Button btnLoad
 

Detailed Description

Control for definition of scalar functions by user defined expressions (through a script loader).

$A Igor Jun14;

Constructor & Destructor Documentation

IG.Forms.ScalarFunctionScriptControl.ScalarFunctionScriptControl ( )
inline

Constructs the scalar function script control.

IG.Forms.ScalarFunctionScriptControl.ScalarFunctionScriptControl ( bool  setTestDefinitions)
inline

Constructs the scalar function script control.

Parameters
setTestDefinitionsIf true then control is filled with test definitions, such that the represented function can be immediately plotted, saved, etc.

Beside for debugging, this is convenient for testing by users who are not used to use the control.

Member Function Documentation

void IG.Forms.ScalarFunctionScriptControl.SetTestDefinitions ( )
inline

Setts a test definition.

bool IG.Forms.ScalarFunctionScriptControl.HasParentUnsavedChanges ( bool  set = false)
inline

Get or sets a flag indicating whether the parent control has unsaved changes.

The flag may only be set to false.

If there is no parent control (such as VectorFunctionScriptControl) then getter returns false and setter has no effect.

Parameters
setIf true then the "Has unsaved changes" is set on the parent. Otherwise, only the value indicating whether the parent has unsaved changes is returned. Default value is false.
Returns
Flag indicating whether parent control had unsaved changes before this method was called.
void IG.Forms.ScalarFunctionScriptControl.CopyDataToController ( )
inlineprivate

Copies data from the current control to the internal function DTO.

void IG.Forms.ScalarFunctionScriptControl.CopyDataFromController ( )
inline

Copies data from the internal DTO to the current control.

string IG.Forms.ScalarFunctionScriptControl.GetFunctionSignature ( )
inlineprotected

Returns function signature created from the data.

References IG.Lib.UtilStr.GetParametersStringPlain().

void IG.Forms.ScalarFunctionScriptControl.ResetFunctionDefinition ( )
inline

Resets function definition to simply "0". Gradients are redefined accordingly.

string IG.Forms.ScalarFunctionScriptControl.CreateFunctonSummary ( )
inline
void IG.Forms.ScalarFunctionScriptControl.btnSummary_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.txtName_Validated ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.txtDescription_Validated ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.txtParameterNames_Validated ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.numDimension_Validated ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.txtValue_Validated ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.txtGradients_Validated ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.chkGradients_CheckedChanged ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.btnCreateFunction_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Creates a function i advance (before it is eeded for any other operation). Error message is launched if creation is not successful.

void IG.Forms.ScalarFunctionScriptControl.btnValueCalculator_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Launches value calculator where user can calculate functio values with the function that was defined in the current control.

References IG.Lib.Function, IG.Forms.ScalarFunctionEvaluatorControl.FunctionDefinition, IG.Forms.ScalarFunctionEvaluatorForm.MainControl, and IG.Forms.ScalarFunctionEvaluatorControl.TreatScalarAsVectorFunction.

void IG.Forms.ScalarFunctionScriptControl.btnPlot1d_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.btnPlot2d_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ScalarFunctionScriptControl.btnSave_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Saves the current fucntion definition to a JSON file.

References IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveJson().

void IG.Forms.ScalarFunctionScriptControl.btnLoad_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Loads the current function definition from a JSON file.

References IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadJson().

override void IG.Forms.ScalarFunctionScriptControl.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
void IG.Forms.ScalarFunctionScriptControl.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

Member Data Documentation

string IG.Forms.ScalarFunctionScriptControl._functionNameTitleNormal = "Function Name: "
private
string IG.Forms.ScalarFunctionScriptControl._functionNameTitleModified = "Function Name: (*)"
private
ScalarFunctionScriptController IG.Forms.ScalarFunctionScriptControl._functionController
private
VectorFunctionScriptControl IG.Forms.ScalarFunctionScriptControl._parentVectorFunctionControl = null
private
bool IG.Forms.ScalarFunctionScriptControl._hasUnsavedChanges = false
private
bool IG.Forms.ScalarFunctionScriptControl._isLoaderConsistent = false
private
bool IG.Forms.ScalarFunctionScriptControl._isGradientDefined = false
protected
Color IG.Forms.ScalarFunctionScriptControl._bgDefined = Color.White
private
Color IG.Forms.ScalarFunctionScriptControl._bgUndefined = Color.LightGray
private
InputOutputDataDefiniton IG.Forms.ScalarFunctionScriptControl._dataDefinition = null
private
System.ComponentModel.IContainer IG.Forms.ScalarFunctionScriptControl.components = null
private

Required designer variable.

System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblTitle
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblDimension
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblName
private
System.Windows.Forms.TextBox IG.Forms.ScalarFunctionScriptControl.txtName
private
System.Windows.Forms.NumericUpDown IG.Forms.ScalarFunctionScriptControl.numDimension
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlOuter
private
System.Windows.Forms.TextBox IG.Forms.ScalarFunctionScriptControl.txtValue
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblValue
private
System.Windows.Forms.TextBox IG.Forms.ScalarFunctionScriptControl.txtParameterNames
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblParameterNames
private
System.Windows.Forms.CheckBox IG.Forms.ScalarFunctionScriptControl.chkGradients
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnValueCalculator
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnCreateFunction
private
System.Windows.Forms.TextBox IG.Forms.ScalarFunctionScriptControl.txtGradients
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.label1
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblFunctionSignature
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnSummary
private
System.Windows.Forms.TextBox IG.Forms.ScalarFunctionScriptControl.txtDescription
private
System.Windows.Forms.Label IG.Forms.ScalarFunctionScriptControl.lblDescription
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnPlot1d
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnPlot2d
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnSave
private
FileSelector IG.Forms.ScalarFunctionScriptControl.fileSelector1
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlParameters
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlValues
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlGradients
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlButtons
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlPlotButtons
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlBasic
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlTop
private
System.Windows.Forms.Panel IG.Forms.ScalarFunctionScriptControl.pnlBasicAndTitle
private
System.Windows.Forms.Button IG.Forms.ScalarFunctionScriptControl.btnLoad
private

Property Documentation

IG.Lib.IReporter IG.Forms.ScalarFunctionScriptControl.Reporter
getprotected

Reporter used for internal reporting.

string IG.Forms.ScalarFunctionScriptControl.FunctionNameTitleNormal
getsetprotected

Normal text of the label that introduces function name input box.

string IG.Forms.ScalarFunctionScriptControl.FunctionNameTitleModified
getsetprotected

Normal text of the label that introduces function name input box.

ScalarFunctionScriptController IG.Forms.ScalarFunctionScriptControl.FunctionController
getset

Cotroller that holds the definition data of the scalar function entered by the current control, and also holds mechanism for compiling and loading scalar function from these definitions.

ScalarFunctionLoader IG.Forms.ScalarFunctionScriptControl.FunctionLoader
getprotected set

Scalar function loader that is responsible for creation of scalar function objects from data.

LoadableScalarFunctionBase IG.Forms.ScalarFunctionScriptControl.Function
get

Gets the function generated by the function loader.

Function loader from the FunctionController is used.

VectorFunctionScriptControl IG.Forms.ScalarFunctionScriptControl.VectorFunctionControl
getset

The parent vector function script control. When this control is embedded within the vector function script control, this property should be set such that communication back to parent is enabled (in particular, communication about unsaved changes).

bool IG.Forms.ScalarFunctionScriptControl.HasUnsavedChanges
getset

Whether the current function definition has unsaved changes.

bool IG.Forms.ScalarFunctionScriptControl.IsLoaderConsistent
getprotected set

Whether function loader is in consistent state.

This method shoulld be elaborated or dropped.

string IG.Forms.ScalarFunctionScriptControl.FunctionName
getset

Name of the function.

string IG.Forms.ScalarFunctionScriptControl.FunctionDescription
getset
int IG.Forms.ScalarFunctionScriptControl.Dimension
getset

Gets or sets function dimension.

string [] IG.Forms.ScalarFunctionScriptControl.ParameterNames
getset

Names of function parameters.

string IG.Forms.ScalarFunctionScriptControl.ValueDefinition
getset

String that defines function value.

bool IG.Forms.ScalarFunctionScriptControl.IsGradientDefined
getset
string [] IG.Forms.ScalarFunctionScriptControl.GradientDefinitions
getset

String that defines function gradients.

InputOutputDataDefiniton IG.Forms.ScalarFunctionScriptControl.DataDefinition
getsetprivate

Definition of input and output data for the represented scalar function.

FileSelector IG.Forms.ScalarFunctionScriptControl.FileSelector
get

GUI component for seclecting files.


The documentation for this class was generated from the following files: