Table of Contents

Class VL_GUI

Namespace
VirtualLab.Programming
Assembly
VirtualLab.Programming.dll

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

public static class VL_GUI
Inheritance
VL_GUI
Inherited Members

Methods

AskForComplex(Complex, string)

Opens a dialog to enter a complex number.

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

Parameters

defaultValue Complex

Optional parameter to specify the Complex number preset in the dialog. Zero by default.

dialogCaption string

Optional parameter to specify the caption of the dialog. "Enter Complex Number" by default.

Returns

Complex

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(double, string, string, double, double, PhysicalProperty)

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

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

Parameters

defaultValue double

Optional parameter to specify the double number preset in the dialog. Zero by default.

dialogCaption string

Optional parameter to specify the caption of the dialog. "Enter Floating Point Number" by default.

name string

The name of the value, for example "Wavelength". If this optional parameter is not specified, "Value" is taken as default.

minimumValue double

Optional parameter to specify the minimum value the user can enter. For example 1e-9.

maximumValue double

Optional parameter to specify the minimum value the user can enter. For example 1e-6.

physicalProperty PhysicalProperty

Optional parameter to specify the physical property of the value to enter, for example PhysicalProperty.Length.

Returns

double

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(int, string, string)

Opens a dialog to enter an integer number.

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

Parameters

defaultValue int

Optional parameter to specify the integer number preset in the dialog. Zero by default.

dialogCaption string

Optional parameter to specify the caption of the dialog. "Enter Integer" by default.

name string

The name of the value, for example "Number of Iterations". If this optional parameter is not specified, "Value" is taken as default.

Returns

int

The integer number set by the user. If the user clicks on "Cancel" in the dialog, int.MinValue is returned.

CreateAnimationFromDataArray(DataArray2D, FieldQuantity, PredefinedColorLookupTableType?, double)

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

public static void CreateAnimationFromDataArray(DataArray2D dataArray, FieldQuantity fieldQuantity = FieldQuantity.RealPart, PredefinedColorLookupTableType? colorLookupTable = null, double relativeThresholdForPhaseArtifacts = 0)

Parameters

dataArray DataArray2D

The data array to show as animation. It must contain at least two subsets.

fieldQuantity FieldQuantity

The field quantity to show for complex-valued data arrays. If this parameter is not specified, the real part is shown.

colorLookupTable PredefinedColorLookupTableType?

Enumeration 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.

relativeThresholdForPhaseArtifacts double

Threshold for suppressing phase artifacts. If set to zero or below, no suppression will be done. Applies only if parameter fieldQuantity is set to FieldQuantity.Phase.

GetLastActiveDataArray1D(int)

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.

public static DataArray1D GetLastActiveDataArray1D(int index = 0)

Parameters

index int

If 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

DataArray1D

A DataArray1D object representing a copy of the selected data array. null if no matching data array view is opened in VirtualLab.

GetLastActiveDataArray2D(int)

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.

public static DataArray2D GetLastActiveDataArray2D(int index = 0)

Parameters

index int

If 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

DataArray2D

A DataArray2D object representing a copy of the selected data array. null if no matching data array view is opened in VirtualLab.

GetLastActiveField(int)

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.

public static ComplexAmplitude GetLastActiveField(int index = 0)

Parameters

index int

If 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

ComplexAmplitude

A ComplexAmplitude object representing a copy of the selected harmonic field. null if no harmonic field view is opened in VirtualLab.

GetLastActiveFieldsSet(int)

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.

public static HarmonicFieldsSet GetLastActiveFieldsSet(int index = 0)

Parameters

index int

If 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

HarmonicFieldsSet

A HarmonicFieldsSet object representing a copy of the selected harmonic fields set. null if no harmonic fields set view is opened in VirtualLab.

GetLastActiveRayDistribution(int)

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.

public static RayDistribution GetLastActiveRayDistribution(int index = 0)

Parameters

index int

If 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

RayDistribution

A RayDistribution object representing a copy of the selected ray distribution. null if no matching ray distribution view is opened in VirtualLab.

SelectOpenDataArray1D(string)

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

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

Parameters

caption string

Optional caption of the dialog. "Select Data Array 1D" by default.

Returns

DataArray1D

The selected data array. null if you no matching data array was available or the dialog was canceled.

SelectOpenDataArray2D(string)

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

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

Parameters

caption string

Optional caption of the dialog. "Select Data Array 2D" by default.

Returns

DataArray2D

The selected data array. null if you no matching data array was available or the dialog was canceled.

SelectOpenField(string)

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

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

Parameters

caption string

Optional caption of the dialog. "Select Field" by default.

Returns

ComplexAmplitude

The selected field. null if you no field was available or the dialog was canceled.

SelectOpenFieldsSet(string)

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

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

Parameters

caption string

Optional caption of the dialog. "Select Fields Set" by default.

Returns

HarmonicFieldsSet

The selected fields set. null if no fields set was available or the dialog was canceled.

SelectOpenTransmission(string)

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

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

Parameters

caption string

Optional caption of the dialog. "Select Transmission" by default.

Returns

ComplexAmplitude

The selected transmission. null if you no transmission was available or the dialog was canceled.

ShowDocument(IDocument, string)

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

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

Parameters

document IDocument

The document to show.

windowCaption string

The optional caption of the document window to be created.

ShowWindowsStandardDialog(CommonDialog)

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!

public static DialogResult ShowWindowsStandardDialog(CommonDialog dialog)

Parameters

dialog CommonDialog

The dialog to show, preconfigured to your needs.

Returns

DialogResult

The dialog result which indicates whether the dialog was closed with “OK” or “Cancel”.

WriteLineToMessagesTab(string, bool)

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

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

Parameters

message string

The string to write into the Messages tab.

addTimeStamp bool

If this optional parameter is set to true the string is prepended with the current time.

WriteToMessagesTab(string)

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

public static void WriteToMessagesTab(string message)

Parameters

message string

The string to write into the Messages tab.