Table of Contents

Class ColorMapping

Namespace
VirtualLabAPI.Core.Numerics
Assembly
VirtualLabAPI.dll

Used to describe the color mapping between a ComplexAmplitude and a bitmap. Colors from StartColor to EndColor are linearly mapped to double values from StartValue to EndValue. Optional a third color can be inserted in the middle. All parameters are stored separately for each FieldQuantity.

[Serializable]
public class ColorMapping : ManualSerialization, IEquatable<IObjectBase>, ISerializable, IDeserializationCallback, ICloneable
Inheritance
ObjectBase
SerializableObjectBase
ManualSerialization
ColorMapping
Implements
IEquatable<IObjectBase>
Inherited Members

Constructors

ColorMapping()

Creates ColorMapping with default values.

public ColorMapping()

ColorMapping(ColorMapping)

Copy constructor.

public ColorMapping(ColorMapping ColorMapping)

Parameters

ColorMapping ColorMapping

Color mapping to copy.

Properties

ColorFromWavelength

Shall the color be determined from the wavelength?

public bool ColorFromWavelength { get; set; }

Property Value

bool

EndColor

Gets or sets current end color.

public Color EndColor { get; set; }

Property Value

Color

EndValue

Gets or sets current end double value.

public double EndValue { get; set; }

Property Value

double

FieldQuantity

Gets the currently selected FieldQuantity.

public FieldQuantity FieldQuantity { get; }

Property Value

FieldQuantity

MidColor

Gets or sets current middle color, if enabled.

public Color MidColor { get; set; }

Property Value

Color

StartColor

Gets or sets current start color.

public Color StartColor { get; set; }

Property Value

Color

StartValue

Gets or sets current start double value.

public double StartValue { get; set; }

Property Value

double

UseMidColor

Enabled middle color.

public bool UseMidColor { get; set; }

Property Value

bool

VectorialComponent

Gets or sets the currently selected VectorialComponent.

public VectorialComponent VectorialComponent { get; set; }

Property Value

VectorialComponent

Methods

AdjustMinMaxParameters(ComplexAmplitude)

Adjust StartValue and EndValue according to minimum and maximum of the given complex amplitude.

public void AdjustMinMaxParameters(ComplexAmplitude ca)

Parameters

ca ComplexAmplitude

The complex amplitude for which the currently set FieldQuantity is evaluated.

Clone()

Create deep copy of object.

public override object Clone()

Returns

object

The cloned object.

DefineFieldQuantity(FieldQuantity, double, double, Color?, Color?, Color?, bool?)

Defines the setting for one field quantity. As the value range, the colors and the ColorFromWavelength flag are stored per field quantity, changing the field quantity might change for example the ColorFromWavelength property unexpectedly. Thus you can set also all these values for the new field quantity.

public void DefineFieldQuantity(FieldQuantity fieldQuantity, double startValue = NaN, double endValue = NaN, Color? startColor = null, Color? midColor = null, Color? endColor = null, bool? colorFromWavelength = null)

Parameters

fieldQuantity FieldQuantity

The field quantity.

startValue double

Optional start value for the given field quantity. If not set the previously set start value for this field quantity remains unchanged.

endValue double

Optional end value for the given field quantity. If not set the previously set end value for this field quantity remains unchanged.

startColor Color?

Optional start color for the given field quantity. If not set the previously set start color for this field quantity remains unchanged.

midColor Color?

Optional middle color for the given field quantity. If not set the previously set middle color for this field quantity remains unchanged.

endColor Color?

Optional end color for the given field quantity. If not set the previously set end color for this field quantity remains unchanged.

colorFromWavelength bool?

Optional boolean flag specifying whether the colors for the given field quantity are determined from the set wavelength. If this value is true, the parameters startColor, midColor, and endColor have no effect. If not set the previously set flag for this field quantity remains unchanged.

Equals(object, EqualityIntent)

Determines whether the specified object is equal to this instance.

public override bool Equals(object otherObject, EqualityIntent equalityIntent)

Parameters

otherObject object

The object to compare with this instance.

equalityIntent EqualityIntent

Defines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

GetColor(double)

Get color for given double value.

public Color GetColor(double value)

Parameters

value double

Value to get color for.

Returns

Color

Result of operation.

GetColorTable(string)

Creates a color table from the two or three single colors.

public ColorLookUpTableForDataView2D GetColorTable(string nameOfTable)

Parameters

nameOfTable string

Name of the new color table.

Returns

ColorLookUpTableForDataView2D

The color table with the given name.

GetValue(Color)

Calculates the value matching the given color.

public double GetValue(Color color)

Parameters

color Color

Color to get value for.

Returns

double

Value for given color.

SetColorFromWavelength(double)

Calculates the color from a given wavelength.

public void SetColorFromWavelength(double wavelength)

Parameters

wavelength double

Wavelength to determine the color for.