Argument

References
public abstract class Argument : IStorable
An argument (or parameter) for a FunctionUi. This is either a 2D grip, or a 1D scalar/referent.

Constructors

Argument

#
protected Argument(IReader reader)
reader (IReader)

Fields

UnsetIndex

#
public const int UnsetIndex = -2147483648

Properties

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.

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.

IsScalar

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

IsVector

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

Nomen

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

Parent

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

Methods

AsScalar

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

AsVector

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

OnArgumentChanged

#
protected void OnArgumentChanged()

Store

#
public virtual void Store(IWriter writer)
writer (IWriter)
Store

ToFunction

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

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.

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.

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.