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
-
ObjectBaseSerializableObjectBaseManualSerializationColorMapping
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
Constructors
ColorMapping()
Creates ColorMapping with default values.
public ColorMapping()
ColorMapping(ColorMapping)
Copy constructor.
public ColorMapping(ColorMapping ColorMapping)
Parameters
ColorMappingColorMappingColor mapping to copy.
Properties
ColorFromWavelength
Shall the color be determined from the wavelength?
public bool ColorFromWavelength { get; set; }
Property Value
EndColor
Gets or sets current end color.
public Color EndColor { get; set; }
Property Value
EndValue
Gets or sets current end double value.
public double EndValue { get; set; }
Property Value
FieldQuantity
Gets the currently selected FieldQuantity.
public FieldQuantity FieldQuantity { get; }
Property Value
MidColor
Gets or sets current middle color, if enabled.
public Color MidColor { get; set; }
Property Value
StartColor
Gets or sets current start color.
public Color StartColor { get; set; }
Property Value
StartValue
Gets or sets current start double value.
public double StartValue { get; set; }
Property Value
UseMidColor
Enabled middle color.
public bool UseMidColor { get; set; }
Property Value
VectorialComponent
Gets or sets the currently selected VectorialComponent.
public VectorialComponent VectorialComponent { get; set; }
Property Value
Methods
AdjustMinMaxParameters(ComplexAmplitude)
Adjust StartValue and EndValue according to minimum and maximum of the given complex amplitude.
public void AdjustMinMaxParameters(ComplexAmplitude ca)
Parameters
caComplexAmplitudeThe 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
fieldQuantityFieldQuantityThe field quantity.
startValuedoubleOptional start value for the given field quantity. If not set the previously set start value for this field quantity remains unchanged.
endValuedoubleOptional end value for the given field quantity. If not set the previously set end value for this field quantity remains unchanged.
startColorColor?Optional start color for the given field quantity. If not set the previously set start color for this field quantity remains unchanged.
midColorColor?Optional middle color for the given field quantity. If not set the previously set middle color for this field quantity remains unchanged.
endColorColor?Optional end color for the given field quantity. If not set the previously set end color for this field quantity remains unchanged.
colorFromWavelengthbool?Optional boolean flag specifying whether the colors for the given field quantity are determined from the set wavelength. If this value is
true, the parametersstartColor,midColor, andendColorhave 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
otherObjectobjectThe object to compare with this instance.
equalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.
Returns
GetColor(double)
Get color for given double value.
public Color GetColor(double value)
Parameters
valuedoubleValue 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
nameOfTablestringName 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
colorColorColor 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
wavelengthdoubleWavelength to determine the color for.