Enumeration PartInstanceMatrixGetterInterfaceSignal

The PartInstanceMatrixGetterInterfaceSignal lists all the signals that may be sent by the PartInstanceMatrixGetterInterface.

These signals are emitted by the PartInstanceMatrixGetterInterface when a part instance matrix fetch result is ready.

/** 
* Sample to illustrate the use of an PartInstanceMatrixGetterInterface to retrieve multiple matrices.
*/
import {
DataSessionInterface, PartInstanceMatrixGetterInterfaceSignal,
InfiniteEvent, PartInstanceMatrixResultInterface, PartInstanceMatrixGetterInterface
} from 'generated_files/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// the part instance ids to fetch
let lPartInstanceIds: Array<number>;

// to retrieve the matrices
const lPartInstanceMatrixGetter : PartInstanceMatrixGetterInterface = lDataSession.createPartInstanceMatrixGetter();

// what to do when matrix data has been downloaded ?
let onMatricesReady : (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) => void;

// what to do when the download of the matrices is ready ?
lPartInstanceMatrixGetter.addEventListener(PartInstanceMatrixGetterInterfaceSignal.MatrixFetchReady, onMatricesReady);

// what to do when matrix data has been downloaded ?
onMatricesReady = (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
// matrices are ready
const lMatricesContent : Array<PartInstanceMatrixResultInterface> | undefined = lPartInstanceMatrixGetter.getMatricesResult();
if ((!lMatricesContent) || (lMatricesContent.length === 0))
{
console.log('error while fetching matrices content');
return;
}
// now matrix content is there, just need to display them
// use only the first part instance
const lCurMatrixResult : PartInstanceMatrixResultInterface = lMatricesContent[0];
console.log('Matrices info : instance:', lCurMatrixResult.getInstanceId(), 'local matrix:', lCurMatrixResult.getLocalMatrix(), 'world matrix:', lCurMatrixResult.getWorldMatrix(), ')');
};

lPartInstanceMatrixGetter.fetchMatrices(lPartInstanceIds);

Please refer to PartInstanceMatrixGetterInterface for more information.
Events

Enumeration Members

MatrixFetchCancelled: "cancelled"

Signal sent by the PartInstanceMatrixGetterInterface when it has been cancelled.

Such an event is fired if the PartInstanceMatrixGetterInterface was fetching some matrices and PartInstanceMatrixGetterInterface.cancelFetch is called. The MatrixFetchReady signal will be triggered shortly after.

No attachment for events of this type.

MatrixFetchReady: "ready"

Signal sent by the PartInstanceMatrixGetterInterface when PartInstanceMatrixGetterInterface.fetchMatrices is ready, i.e. PartInstanceMatrixGetterInterface.getMatricesResult can be called.

Such a signal does not tell if the call was successful or not but that the result is ready to be fetched.

Warning, the MatrixFetchReady signal is sent later when PartInstanceMatrixGetterInterface.cancelFetch is called and the PartInstanceMatrixGetterInterface is fetching.

The attachment is a string telling the request id of the call to PartInstanceMatrixGetterInterface.fetchMatrices (PartInstanceMatrixGetterInterface.getLastRequestId).