ModelBuilder

Description

sealed class Tinman.Engine.Models.ModelBuilder

The ModelBuilder builds optimal IModel object hierarchies from iterative build steps.

The model builder is state based (see ModelBuilderState). Model hierarchies are built by and calling Begin1 and End, while modifying the builder state along the way.

See also

Model.Build

Public / Methods

Add

2 overloads


public method Add1 → (1)

model in : IModel

[not-null]
The child model to add.

Adds a child to the current model.


public method Add2 → (1)

part in : IModelPart

[not-null]
The part to add.

returns → ModelBuilder

this

Adds the given model part to the current model.

Begin

2 overloads


public method Begin1 → ()

returns → ModelBuilder

this

Begins to build a new model.

This method will save the current builder state and then reset all state to default values. Use Copy to inherit values from the saved builder state.

For each call to Begin1, there must be a matching call to End.


public method Begin2 → (1)

transform in : AffineTransform

The child-to-parent transformation, see IModel.ChildTransformAt.

returns → ModelBuilder

this

Begins to build a new model.

This method will save the current builder state and then reset all state to default values. Use Copy to inherit values from the saved builder state.

For each call to Begin2, there must be a matching call to End.

Build


public method Build → (1)

simplify opt : ModelSimplifyFlags = ModelSimplifyFlags.All

The simplification actions to perform before returning the built model.

returns → IModel

The built IModel object.

Finishes building and returns the final model.

This method will call End as many times as there are unmatched calls to any of the Begin methods.

After this method has returned, the builder will be in its initial state and may be used for building another model.

Copy


public method Copy → (1)

state opt : ModelBuilderState = ModelBuilderState.None

The builder state to copy.

returns → ModelBuilder

this

Copies builder state from the parent state.

End


public method End → (2)

allowMerge opt : bool = true

Allow the current model to be merged into the parent model?

simplify opt : ModelSimplifyFlags = ModelSimplifyFlags.All

The simplification actions to perform before adding the current model as a child to the parent model. Will be ignored when the current model is merged into the parent model.

returns → IModel

The built model or null iff merged with parent.

Finishes building of the current model.

This method will restore the builder state after building the model or part.

The calls to the Begin and End methods must be balanced and may be nested.

Fade​In

2 overloads


[Pure]
public method FadeIn1 → ()

returns → Fade

The current value.

Returns the current value for IModel.FadeIn.

Defaults to Fade.AlwaysOne.


public method FadeIn2 → (1)

value in : Fade

The current value.

returns → ModelBuilder

this

Specifies the current value for IModel.FadeIn

Fade​Out

2 overloads


[Pure]
public method FadeOut1 → ()

returns → Fade

The current value.

Returns the current value for IModel.FadeOut.

Defaults to Fade.AlwaysZero.


public method FadeOut2 → (1)

value in : Fade

The current value.

returns → ModelBuilder

this

Specifies the current value for IModel.FadeOut

Flags​Model

2 overloads


[Pure]
public method FlagsModel1 → ()

returns → ModelFlags

The current value.

Returns the current value for IModel.Flags.

Defaults to ModelFlags.None.


public method FlagsModel2 → (1)

value in : ModelFlags

The current value.

returns → ModelBuilder

this

Specifies the current value for IModel.Flags

Name

2 overloads


[Pure]
public method Name1 → ()

returns → string

The current value.

Returns the current value for IModel.Name.

Defaults to null.


public method Name2 → (1)

value in : string

The current value.

returns → ModelBuilder

this

Specifies the current value for IModel.Name

Reset


public method Reset → (1)

state opt : ModelBuilderState = ModelBuilderState.All

The builder state to reset.

returns → ModelBuilder

this

Resets the builder state to default values.

Unit

2 overloads


[Pure]
public method Unit1 → ()

returns → UnitOfMeasure

The current value.

Returns the current value for IModel.Unit.

Defaults to null.


public method Unit2 → (1)

value in : UnitOfMeasure

The current value.

returns → ModelBuilder

this

Specifies the current value for IModel.Unit