Programming Reference for VirtualLab Fusion  2022.1
Static Public Member Functions | List of all members
VL_GUI Class Reference

This class provides methods for interacting with the VirtualLab main window. More...

Static Public Member Functions

static Complex AskForComplex (Complex defaultValue=new Complex(), string dialogCaption="Enter Complex Number")
 Opens a dialog to enter a complex number. More...
 
static double AskForDouble (double defaultValue=0, string dialogCaption="Enter Floating Point Number", string name="Value", double minimumValue=double.NegativeInfinity, double maximumValue=double.PositiveInfinity, PhysicalProperty physicalProperty=PhysicalProperty.NoUnit)
 Opens a dialog to enter a floating point number in double precision. More...
 
static int AskForInteger (int defaultValue=0, string dialogCaption="Enter Integer", string name="Value")
 Opens a dialog to enter an integer number. More...
 
static void CreateAnimationFromDataArray (DataArray2D dataArray, FieldQuantity fieldQuantity=FieldQuantity.RealPart, PredefinedColorLookupTableType? colorLookupTable=null)
 Creates an animation from the given data array and shows it as separate document. More...
 
static DataArray1D GetLastActiveDataArray1D (int index=0)
 With this method you can copy a one-dimensional data array from a data array view already opened in VirtualLab. By default, the most recently activated data array view is used to this end. More...
 
static DataArray2D GetLastActiveDataArray2D (int index=0)
 With this method you can copy a two-dimensional gridded data array from a data array view already opened in VirtualLab. By default, the most recently activated data array view is used to this end. More...
 
static ComplexAmplitude GetLastActiveField (int index=0)
 With this method you can copy a harmonic field from a harmonic field view already opened in VirtualLab. By default, the most recently activated field view is used to this end. More...
 
static HarmonicFieldsSet GetLastActiveFieldsSet (int index=0)
 With this method you can copy a harmonic fields set from a harmonic fields set view already opened in VirtualLab. By default, the most recently activated fields set view is used to this end. More...
 
static RayDistribution GetLastActiveRayDistribution (int index=0)
 With this method you can copy a (two-dimensional) ray distribution from a ray distribution view already opened in VirtualLab. By default, the most recently activated ray distribution view is used to this end. More...
 
static DataArray1D SelectOpenDataArray1D (string caption="Select Data Array 1D")
 This method opens a dialog where all currently open one-dimensional data arrays are listed. You can select any of these documents. More...
 
static DataArray2D SelectOpenDataArray2D (string caption="Select Data Array 2D")
 This method opens a dialog where all currently open two-dimensional gridded data arrays are listed. You can select any of these documents. More...
 
static ComplexAmplitude SelectOpenField (string caption="Select Field")
 This method opens a dialog where all currently open harmonic field documents are listed. You can select any of these documents. More...
 
static HarmonicFieldsSet SelectOpenFieldsSet (string caption="Select Fields Set")
 This method opens a dialog where all currently open harmonic field documents are listed. You can select any of these documents. More...
 
static ComplexAmplitude SelectOpenTransmission (string caption="Select Transmission")
 This method opens a dialog where all currently open transmission documents are listed. You can select any of these documents. More...
 
static void ShowDocument (IDocument document, string windowCaption="")
 Shows a document (e. g. a ComplexAmplitude or a HarmonicFieldsSet object) in the VirtualLab main window. More...
 
static DialogResult ShowWindowsStandardDialog (CommonDialog dialog)
 Shows a Windows™ standard dialog, most notably the OpenFileDialog, but also SaveFileDialog, FolderBrowserDialog, and ColorDialog can be used. All these dialogs can be found in the System.Windows.Forms namespace. Opening these dialogs directly does not work and will make VirtualLab Fusion crash! More...
 
static void WriteLineToMessagesTab (string message, bool addTimeStamp=false)
 Writes a string as a separate line into the Messages tab of VirtualLab. More...
 
static void WriteToMessagesTab (string message)
 Writes a string into the Messages tab of VirtualLab. In contrast to the WriteLineToMessagesTab method, this method does not introduce a line break. More...
 

Detailed Description

This class provides methods for interacting with the VirtualLab main window.

Member Function Documentation

◆ AskForComplex()

static Complex AskForComplex ( Complex  defaultValue = new Complex(),
string  dialogCaption = "Enter Complex Number" 
)
static

Opens a dialog to enter a complex number.

Parameters
defaultValueOptional parameter to specify the Complex number preset in the dialog. Zero by default.
dialogCaptionOptional parameter to specify the caption of the dialog. "Enter Complex Number" by default.
Returns
The complex number set by the user. If the user clicks on "Cancel" in the dialog, an unspecified complex number is returned. That is Complex.IsNaN returns true in that case.

◆ AskForDouble()

static double AskForDouble ( double  defaultValue = 0,
string  dialogCaption = "Enter Floating Point Number",
string  name = "Value",
double  minimumValue = double.NegativeInfinity,
double  maximumValue = double.PositiveInfinity,
PhysicalProperty  physicalProperty = PhysicalProperty.NoUnit 
)
static

Opens a dialog to enter a floating point number in double precision.

Parameters
defaultValueOptional parameter to specify the double number preset in the dialog. Zero by default.
dialogCaptionOptional parameter to specify the caption of the dialog. "Enter Floating Point Number" by default.
nameThe name of the value, for example "Wavelength". If this optional parameter is not specified, "Value" is taken as default.
minimumValueOptional parameter to specify the minimum value the user can enter. For example 1e-9.
maximumValueOptional parameter to specify the minimum value the user can enter. For example 1e-6.
physicalPropertyOptional parameter to specify the physical property of the value to enter, for example PhysicalProperty.Length.
Returns
The double number set by the user. If the user clicks on "Cancel" in the dialog, an unspecified number is returned. That is double.IsNaN returns true in that case.

◆ AskForInteger()

static int AskForInteger ( int  defaultValue = 0,
string  dialogCaption = "Enter Integer",
string  name = "Value" 
)
static

Opens a dialog to enter an integer number.

Parameters
defaultValueOptional parameter to specify the integer number preset in the dialog. Zero by default.
dialogCaptionOptional parameter to specify the caption of the dialog. "Enter Integer" by default.
nameThe name of the value, for example "Number of Iterations". If this optional parameter is not specified, "Value" is taken as default.
Returns
The integer number set by the user. If the user clicks on "Cancel" in the dialog, int.MinValue is returned.

◆ CreateAnimationFromDataArray()

static void CreateAnimationFromDataArray ( DataArray2D  dataArray,
FieldQuantity  fieldQuantity = FieldQuantity.RealPart,
PredefinedColorLookupTableType colorLookupTable = null 
)
static

Creates an animation from the given data array and shows it as separate document.

Parameters
dataArrayThe data array to show as animation. It must contain at least two subsets.
fieldQuantityThe field quantity to show for complex-valued data arrays. If this parameter is not specified, the real part is shown.
colorLookupTableEnumeration specifying which of the predefined color look up tables shall be used. If this parameter is not specified the Default Color Lookup Table as defined in the Global Options dialog is used.

◆ GetLastActiveDataArray1D()

static DataArray1D GetLastActiveDataArray1D ( int  index = 0)
static

With this method you can copy a one-dimensional data array from a data array view already opened in VirtualLab. By default, the most recently activated data array view is used to this end.

Parameters
indexIf this optional index is not specified or if it is zero, the most recently activated one-dimensional data array is returned. If it is 1 you get the data array which was activated before the most recently activated data array and so on.
Returns
A DataArray1D object representing a copy of the selected data array. null if no matching data array view is opened in VirtualLab.

◆ GetLastActiveDataArray2D()

static DataArray2D GetLastActiveDataArray2D ( int  index = 0)
static

With this method you can copy a two-dimensional gridded data array from a data array view already opened in VirtualLab. By default, the most recently activated data array view is used to this end.

Parameters
indexIf this optional index is not specified or if it is zero, the most recently activated two-dimensional data array is returned. If it is 1 you get the data array which was activated before the most recently activated data array and so on.
Returns
A DataArray2D object representing a copy of the selected data array. null if no matching data array view is opened in VirtualLab.

◆ GetLastActiveField()

static ComplexAmplitude GetLastActiveField ( int  index = 0)
static

With this method you can copy a harmonic field from a harmonic field view already opened in VirtualLab. By default, the most recently activated field view is used to this end.

Parameters
indexIf this optional index is not specified or if it is zero, the most recently activated field is returned. If it is 1 you get the field which was activated before the most recently activated field and so on.
Returns
A ComplexAmplitude object representing a copy of the selected harmonic field. null if no harmonic field view is opened in VirtualLab.

◆ GetLastActiveFieldsSet()

static HarmonicFieldsSet GetLastActiveFieldsSet ( int  index = 0)
static

With this method you can copy a harmonic fields set from a harmonic fields set view already opened in VirtualLab. By default, the most recently activated fields set view is used to this end.

Parameters
indexIf this optional index is not specified or if it is zero, the most recently activated fields set is returned. If it is 1 you get the fields set which was activated before the most recently activated fields set and so on.
Returns
A HarmonicFieldsSet object representing a copy of the selected harmonic fields set. null if no harmonic fields set view is opened in VirtualLab.

◆ GetLastActiveRayDistribution()

static RayDistribution GetLastActiveRayDistribution ( int  index = 0)
static

With this method you can copy a (two-dimensional) ray distribution from a ray distribution view already opened in VirtualLab. By default, the most recently activated ray distribution view is used to this end.

Parameters
indexIf this optional index is not specified or if it is zero, the most recently activated two-dimensional ray distribution is returned. If it is 1 you get the ray distribution which was activated before the most recently activated ray distribution and so on.
Returns
A RayDistribution object representing a copy of the selected ray distribution. null if no matching ray distribution view is opened in VirtualLab.

◆ SelectOpenDataArray1D()

static DataArray1D SelectOpenDataArray1D ( string  caption = "Select Data Array 1D")
static

This method opens a dialog where all currently open one-dimensional data arrays are listed. You can select any of these documents.

Parameters
captionOptional caption of the dialog. "Select Data Array 1D" by default.
Returns
The selected data array. null if you no matching data array was available or the dialog was canceled.

◆ SelectOpenDataArray2D()

static DataArray2D SelectOpenDataArray2D ( string  caption = "Select Data Array 2D")
static

This method opens a dialog where all currently open two-dimensional gridded data arrays are listed. You can select any of these documents.

Parameters
captionOptional caption of the dialog. "Select Data Array 2D" by default.
Returns
The selected data array. null if you no matching data array was available or the dialog was canceled.

◆ SelectOpenField()

static ComplexAmplitude SelectOpenField ( string  caption = "Select Field")
static

This method opens a dialog where all currently open harmonic field documents are listed. You can select any of these documents.

Parameters
captionOptional caption of the dialog. "Select Field" by default.
Returns
The selected field. null if you no field was available or the dialog was canceled.

◆ SelectOpenFieldsSet()

static HarmonicFieldsSet SelectOpenFieldsSet ( string  caption = "Select Fields Set")
static

This method opens a dialog where all currently open harmonic field documents are listed. You can select any of these documents.

Parameters
captionOptional caption of the dialog. "Select Fields Set" by default.
Returns
The selected fields set. null if no fields set was available or the dialog was canceled.

◆ SelectOpenTransmission()

static ComplexAmplitude SelectOpenTransmission ( string  caption = "Select Transmission")
static

This method opens a dialog where all currently open transmission documents are listed. You can select any of these documents.

Parameters
captionOptional caption of the dialog. "Select Transmission" by default.
Returns
The selected transmission. null if you no transmission was available or the dialog was canceled.

◆ ShowDocument()

static void ShowDocument ( IDocument  document,
string  windowCaption = "" 
)
static

Shows a document (e. g. a ComplexAmplitude or a HarmonicFieldsSet object) in the VirtualLab main window.

Parameters
documentThe document to show.
windowCaptionThe optional caption of the document window to be created.

◆ ShowWindowsStandardDialog()

static DialogResult ShowWindowsStandardDialog ( CommonDialog  dialog)
static

Shows a Windows™ standard dialog, most notably the OpenFileDialog, but also SaveFileDialog, FolderBrowserDialog, and ColorDialog can be used. All these dialogs can be found in the System.Windows.Forms namespace. Opening these dialogs directly does not work and will make VirtualLab Fusion crash!

Parameters
dialogThe dialog to show, preconfigured to your needs.
Returns
The dialog result which indicates whether the dialog was closed with “OK” or “Cancel”.

◆ WriteLineToMessagesTab()

static void WriteLineToMessagesTab ( string  message,
bool  addTimeStamp = false 
)
static

Writes a string as a separate line into the Messages tab of VirtualLab.

Parameters
messageThe string to write into the Messages tab.
addTimeStampIf this optional parameter is set to true the string is prepended with the current time.

◆ WriteToMessagesTab()

static void WriteToMessagesTab ( string  message)
static

Writes a string into the Messages tab of VirtualLab. In contrast to the WriteLineToMessagesTab method, this method does not introduce a line break.

Parameters
messageThe string to write into the Messages tab.