Enumeration FilterSolverInterfaceSignal

The FilterSolverInterfaceSignal lists all the signals that may be sent by the abstract FilterSolverInterface.

These signals are emitted by the FilterSolverInterface when it is modified and more importantly ready.

A FilterSolverInterface is ready when it has computed the result of its set of FilterItemInterfaces, such a result being a list of geometric instance ids and part instance ids.

The FilterSolverInterface may fire the following signals :

/** 
* Sample to illustrate how to use a FilterDiagonalInterface and the unit conversion system.
*/
import {
FilterSolverInterface,
Unit, FilterRangeItemInterface,
ConfContextInterface, VisibilityContextInterface, FilterSolverInterfaceSignal, tListenerCallback, FilterDiagonalInterface, DataSessionInterface,
} from 'generated/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;

// what to do when result has been computed ?
let onResultReady : tListenerCallback;

/* FILTERING CONTEXT / CONF CONTEXT */
// create the resolution chain :
// create a filtering context "unconfigured"
// first create ConfContextInterface "unconfigured"
const lConfCtx : ConfContextInterface = lDataSession.createConfContext();
// and create the filtering context and bind it to the unconfigured ConfContextInterface
const lConfVisibilityCtx: VisibilityContextInterface = lDataSession.createVisibilityContext();
lConfVisibilityCtx.setConfContext(lConfCtx);

/* SOLVER */
// create the solver to retrieve the result
const lGlobalSolver : FilterSolverInterface = lDataSession.createFilterSolver();
lGlobalSolver.setVisibilityContext(lConfVisibilityCtx);
// we want to retrieve `geometric instance ids` and `part instance ids` on the solver
lGlobalSolver.setRetrievePartInstanceIds(true);
// bind the solver to custom implementation when the result is ready
lGlobalSolver.addEventListener(FilterSolverInterfaceSignal.SolverReady, onResultReady);

/* DIAGONAL FILTER */
// get the DMU build unit
const lDMUUnit : Unit = lDataSession.getDmuBuildUnit();
// we want to get values in DMU units
const lConvertFactor : number = lDataSession.convertUnitFactor(Unit.U_Millimeter, lDMUUnit);

// all leaves whose diagonal is contained within 2 and 3 millimeters
let lMinValue : number = 2 * lConvertFactor;
let lMaxValue : number = 3 * lConvertFactor;

// diagonal SQUARED
lMinValue *= lMinValue;
lMaxValue *= lMaxValue;

// create a diagonal filter
const lDiagonalFilter : FilterDiagonalInterface = lDataSession.createDiagonalFilter();
// useless, FilterOperator.FO_UNION is the default operator when creating a new filter
// lDiagonalFilter.setFilterOperator(FilterOperator.FO_UNION);

// and add a range to test ([2mm, 3mm] included)
const lDiagonalFilterContent : FilterRangeItemInterface = lDiagonalFilter.createFilterRangeItem();
// include lower bound
lDiagonalFilterContent.setIncludedLower(true);
// include upper bound
lDiagonalFilterContent.setIncludedUpper(true);
// set the lower bound as 2 mm in DMU units SQUARED
lDiagonalFilterContent.setLowerBound(lMinValue);
// set the upper bound as 3 mm in DMU units SQUARED
lDiagonalFilterContent.setUpperBound(lMaxValue);

// add the filter to the solver
lGlobalSolver.insertFilter(0, lDiagonalFilter);
// and go => make the DataSessionInterface compute the result
lDataSession.update();

Please refer to the [FilterSolverInterface](../interfaces/FilterSolverInterface.html) for more information.
Events

See

Enumeration Members

SolverCancelled: "cancelled"

Signal sent by the FilterSolverInterface when the FilterSolverInterface is cancelled, i.e. when the FilterSolverInterface is running and the content of the solver is modified.

No attachment for events of this type.

SolverChanged: "changed"

Signal sent by the FilterSolverInterface when any FilterItemInterface has changed, a FilterItemInterface has been added or removed, or the VisibilityContextInterface inside the FilterSolverInterface has changed.

No attachment for events of this type.

SolverFilterAdded: "added"

Signal sent by the FilterSolverInterface when a FilterItemInterface has been added.

The attachment is the FilterItemInterface that was added.

SolverFilterBulkChanged: "bulkChanged"

Signal sent by the FilterSolverInterface when a lot of changes occur inside.

No attachment for events of this type.

SolverFilterMoved: "moved"

Signal sent by the FilterSolverInterface when a FilterItemInterface has been moved.

The attachment is a FilterMoveInfoInterface :

{
"filter": "the id of the {@link FilterItemInterface} that changed",
"to": pOrder // the new position of the {@link FilterItemInterface} in the list of children of the container
}

Please refer to [moveFilter](../interfaces/FilterSetInterface.html#moveFilter).

See

SolverFilterRemoved: "removed"

Signal sent by the FilterSolverInterface when a FilterItemInterface has been removed.

The attachment is the id of FilterItemInterface that was removed.

SolverReady: "ready"

Signal sent by the FilterSolverInterface when the FilterSolverInterface is ready, i.e. getGeometricInstanceIds, getPartInstanceIds and getTrianglesCount can be called.

No attachment for events of this type.

SolverVisibilityContextChanged: "visibilityContextChanged"

Signal sent by the FilterSolverInterface a new [VisibilityContextInterface]] has been set or cleared.

The attachment is the VisibilityContextInterface that was set, or undefined if the VisibilityContextInterface has been cleared.