ScalarArgument

ArgumentReferences
[IoId("00000000-4667-44E6-B66B-55D79EF1788D")] public sealed class ScalarArgument : Argument
A one-dimensional scalar function argument. Scalars manifest themselves as sliders in the function editor.

Constructors

ScalarArgument

#
public ScalarArgument(IReader reader)
reader (IReader)

Properties

CanBeReferenced

#
public bool CanBeReferenced { get; set; }
Gets or sets whether this scalar has support for referenced functions.

Id

public Guid Id { get; }
The id of this parameter. This is how the function editor UI can tell apart various parameters for various functions.
inherited fromArgument

Index

public int Index { get; }
The index of this parameter. This is used by the FunctionUI to access specific parameters. It can therefore not be modified during the lifetime of the parameter.
inherited fromArgument

IsReferenced

#
public bool IsReferenced { get; }
Gets whether this scalar is a reference to a function, rather than some constant value.

IsScalar

public bool IsScalar { get; }
Gets whether this parameter is a 1D scalar.
inherited fromArgument

IsVector

public bool IsVector { get; }
Gets whether this parameter is a 2D vector.
inherited fromArgument

Nomen

public Nomen Nomen { get; set; }
Description of this argument. Used to populate tooltips.
inherited fromArgument

Number

#
public UiNumber Number { get; }
Gets the limits for this scalar.

Parent

public int Parent { get; }
Grip or Scalar which serves as a parent for this argument.
inherited fromArgument

Referent

#
public Function Referent { get; }
Gets the assigned referent, if any.

ReferentId

#
public Guid ReferentId { get; }
Gets the ID of the function UI which provides the current referent. If this ID is Guid.Empty, no function is referenced, although a function may still be assigned.

ReferentName

#
public string ReferentName { get; }
Gets the name of the referent function, if any.

Methods

AsScalar

public bool AsScalar(out ScalarArgument scalar)
Cast this parameter to a scalar.
inherited fromArgument
scalar (out ScalarArgument)

AsVector

public bool AsVector(out VectorArgument vector)
Cast this parameter to a vector.
inherited fromArgument
vector (out VectorArgument)

OnArgumentChanged

protected void OnArgumentChanged()
inherited fromArgument

RevertToSavedState

#
public void RevertToSavedState()
Revert the Number to the most recently saved state.

Store

#
public override void Store(IWriter writer)
writer (IWriter)
Argument.Store

ToFunction

public Function ToFunction()
Convert the value inside this argument to a function. This method will fail if the argument is a Vector.
inherited fromArgument

ToScalar

public double ToScalar()
Convert the value inside this argument to a scalar. This method will fail if the argument is a Referent, or if the argument is a Vector.
inherited fromArgument

ToVector

public Point2d ToVector()
Convert the value inside this argument to a vector. This method will fail if the argument is not of type vector.
inherited fromArgument

TryAssignDomain

#
public bool TryAssignDomain(decimal lower, decimal upper, int decimals)
Assign a new slider domain to this scalar, dropping any referent and clamping the current value into the new range. This is how a referenced parameter is turned back into a plain slider with a chosen domain.
lower (decimal)New lower limit.
upper (decimal)New upper limit.
decimals (int)Number of decimals to show.
True if the state actually changed.

TryAssignValue

#
public bool TryAssignValue(decimal newValue)
Set and update the current state.
newValue (decimal)New value.
True if the state actually changed.

TryAssignValue

#
public bool TryAssignValue(double newValue)
Set and update the current state.
newValue (double)New value.
True if the state actually changed.

TryAssignValue

#
public bool TryAssignValue(Function value, Guid source)
Try and assign a new value.
value (Function)
source (Guid)

UpdateSavedState

#
public void UpdateSavedState()
Create a new most recent saved state based on the current Number.

Events

ArgumentChanged

public event EventHandler<EventArgs> ArgumentChanged
Raised whenever one of the arguments in this collection is given a different value. Oftentimes arguments are modified in quick succession, so it's best to not take immediate action based on this event, but merely to expire caches or set dirty flags.
inherited fromArgument