Interface DataSessionInterface

The DataSessionInterface is the formalization of the connection between a 3djuump infinite proxy and the client.

The DataSessionInterface is created from a connected DirectorySessionInterface and a proxy by the use of the createDataSession function. This function also allows the user to choose a specific proxy by the use of a tChooseProxyCallback.

/** 
* Sample to illustrate the use of the the choice of a proxy for the open data procedure (DataSessionInterface).
*/
import {
tChooseProxyCallback, ProxyChoiceInterface, tSetProxyCallback, InfiniteCacheInterface,
DirectorySessionInterface, DataSessionInterface, DataSessionInterfaceSignal, tListenerCallback
} from 'generated/documentation/appinfiniteapi';

// lDirectorySession has been created previously, the user is now logged in and knows the 3djuump infinite available builds.
let lDirectorySession : DirectorySessionInterface;
// lInfiniteCache may has been created previously (not required)
let lInfiniteCache : InfiniteCacheInterface | undefined;
// the build id to connect to
let lBuildId : string;
// the callback that will be called when the DMU has finished loading
let myDMULoadedCallback : tListenerCallback;

// very simple callback, choose the first available proxy
const lChooseProxyCallback : tChooseProxyCallback = (pProxies: Array<ProxyChoiceInterface>, pFinishLoadingCallback : tSetProxyCallback) : void =>
{
let i : number;
const lLength : number = pProxies.length;
// output all proxies
for (i = 0; i < lLength; ++i)
{
console.log(pProxies[0].getLabel());
}
// DO NOT forget to call pFinishLoadingCallback, if not, the DMU loading process will never finish
// and with the url of the chosen proxy
pFinishLoadingCallback(pProxies[0].getUrl());
}

// connect the data session to the build, the proxy choice is asynchronous, and will
// trigger lChooseProxyCallback when the dev chooses a proxy
const lDataSession : DataSessionInterface | undefined = lDirectorySession.createDataSession(lBuildId, lInfiniteCache, lChooseProxyCallback);
if (!lDataSession)
{
console.log('something weird happened, the directory session cannot create a data session');
console.log('Perhaps the directory session is already closed, or closing, or the login procedure failed');
}
else
{
// we sure want to be notified when the DMU has finished loading
lDataSession.addEventListener(DataSessionInterfaceSignal.DMULoadingSuccess, myDMULoadedCallback);

// and GO => open the data session
if (!lDataSession.openDataSession())
{
console.log('something weird happened, this session has already been used, this is not a freshly created one');
}

// and wait for myDMULoadedCallback to be called
}

The open data session procedure is detailed below : open data session sequence
The DataSession can only be opened once, when closed, there is no way to reuse this object. You will have to call again the [createDataSession](DirectorySessionInterface.html#createDataSession) function.
/** 
* Sample to illustrate the use of the open data session procedure with the DataSessionInterface.
*/
import { DataSessionInterface, DataSessionInterfaceSignal, DirectorySessionInterface, InfiniteCacheInterface, tListenerCallback } from 'generated/documentation/appinfiniteapi';

// callbacks called when IdleDataSession, DataSessionClosed, DMULoadingSuccess and DMULoadingFailed events are triggered
let onInactivityDetection : tListenerCallback;
let onCloseDBSuccess : tListenerCallback;
let onDMULoaded : tListenerCallback;
let onOpenDBFailed : tListenerCallback;

// the id of the build to open (retrieved previously)
let sBuildId : string;
// the optional cache (may be created previously)
let lCache : InfiniteCacheInterface | undefined;
// the directory session should have been created previously
let lDirectorySession : DirectorySessionInterface;

const lDataSession : DataSessionInterface | undefined = lDirectorySession.createDataSession(sBuildId, lCache);
// open the database
if (lDataSession)
{
// do something with your GUI
// ...
// when the data session is closed due to inactivity
lDataSession.addEventListener(DataSessionInterfaceSignal.IdleDataSession, onInactivityDetection);
// when the data session is closed
lDataSession.addEventListener(DataSessionInterfaceSignal.DataSessionClosed, onCloseDBSuccess);
// when the data session has retrieved all required data
lDataSession.addEventListener(DataSessionInterfaceSignal.DMULoadingSuccess, onDMULoaded);
// if unfortunately something went wrong with the loading
lDataSession.addEventListener(DataSessionInterfaceSignal.DMULoadingFailed, onOpenDBFailed);
// and trigger the data session loading
lDataSession.openDataSession();
}

Idle System.

In order to save resources on the proxy, the api features an automatic data session closing mechanism when the user is not interacting with the application. The DataSessionInterface will be closed if restartIdleTimer is not called on user interactions.

It is composed of three pseudo-states :

  • Normal : the user is interacting regularly with the system.
  • Warning : the user has not interacted with the system from some time (2/3 of the idle duration as configured in the architecture).
  • Idle : the server resources have been cleaned up, the session is closed with no possibility to resume or recover. This state happens after the "warning" state.
idle system
The idle system.
/** 
* Sample to illustrate the binding of events to avoid being idle and disconnected.
*/
import { DataSessionInterface } from 'generated/documentation/appinfiniteapi';

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

// restart the timer on user interactions
const cActiveCallback = (_event: Event): void => {
if (lDataSession && lDataSession.isConnected())
{
lDataSession.restartIdleTimer();
}
};

// and bind to specific event
// you may choose your own callbacks
document.addEventListener('keydown', cActiveCallback);
document.addEventListener('mousedown', cActiveCallback);
document.addEventListener('mousemove', cActiveCallback);
document.addEventListener('wheel', cActiveCallback);
document.addEventListener('contextmenu', cActiveCallback);
document.addEventListener('touchstart', cActiveCallback);
document.addEventListener('touchmove', cActiveCallback);
document.addEventListener('touchend', cActiveCallback);

Please see [DirectorySessionInterface](DirectorySessionInterface.html) for more explanations about sessions.

All metadata filters, search procedure, data retrieval procedures are created from this interface.

The DataSessionInterface, once successfully connected to a 3djuump infinite build (see DMULoadingSuccess) provides access to

Id converters and data retrieval interfaces are somewhat autonomous. They only rely on a filtering Context to be used.

However, filtering interfaces are linked together, making difficult to find the correct order to update them and when. For these reasons, and to avoid too many requests being sent to the 3djuump infinite server, the update is triggered by the DataSessionInterface that handles the dependency graph of all these items, and updates only the required interfaces with update.

All these interfaces (filtering, id conversion, data retrieval) work asynchronously : they all feature some kind of "ready" signal telling the result is available, just call addEventListener with the correct signal on the required interfaces.

These interfaces has a dispose function to get rid of them. Do not forget to call these functions to save memory and CPU usage.

The only way to create sets of part instances is to use a FilterSolverInterface that allows computing the result of the intersection of filtering queries with some infinite configurations (see ConfigurationInterface, ConfContextInterface) and optionally other FilterSolverInterface(s). Available configurations (created by the 3djuump infinite maintainer) are accessed through getConfigurationList, they are then "included" by id in a ConfContextInterface.

DMU statistics (Axis Aligned Bounding Box (AABB) of each geometric instance, diagonal length of each geometric instance, min/max of diagonal length, DMU AABB, DMU Unit, maximum geometric instance id, maximum part instance id) and the metadata dictionary (AttributesDictionaryInterface) are accessed through the DataSessionInterface.

/** 
* Sample to illustrate the use of multiple FilterSolverInterfaces to define a set of visible pieces, and
* colorize a subset.
* The visibility is composed of all the part instances included in a Box, that have the "CompletionStatus" attribute
* set to "done".
* The colorization set is based on the visibility, the part instances that have the attribute "ToBeRedesigned"
* true should be colored in yellow.
* This colors all part instance in yellow in the given box, that ave the attribute "ToBeRedesigned"
* true and "CompletionStatus" attribute set to "done".
* This sample uses multiple FilterSolverInterface, VisibilityContextInterface,
* It uses some FilterAABBInterface, FilterAttributeInterface, FilterBooleanInterface.
*/
import {
AttributesDictionaryInterface, AttributeInfoInterface, AttributeType, DataSessionInterface,
InfiniteEngineInterface, ConfContextInterface, Vector3, AABB, FilterSolverInterface, VisibilityContextInterface, FilterAABBInterface, FilterAttributeInterface, FilterOperator, FilterSolverInterfaceSignal, VisualStates, FilterBooleanInterface,
} from 'generated/documentation/appinfiniteapi';

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

// MAKE SURE the attributes "CompletionStatus", "ToBeRedesigned" are relevant
const lAttributeDictionary : AttributesDictionaryInterface = lDataSession.getAttributesDictionary();
let lAttributeInfo : AttributeInfoInterface | undefined = lAttributeDictionary.getAttributeInfo('CompletionStatus');
// make sure the attribute is a string one
console.assert((lAttributeInfo !== undefined) && (lAttributeInfo.getAttributeType() === AttributeType.ATTR_STRING));

lAttributeInfo = lAttributeDictionary.getAttributeInfo('ToBeRedesigned');
// make sure the attribute is a date one
console.assert((lAttributeInfo !== undefined) && (lAttributeInfo.getAttributeType() === AttributeType.ATTR_BOOLEAN));

// create a custom material yellow
const lMaterialId : number = lEngineInterface.getMaterialManager().createNewMaterial(new Vector3(1, 1, 0));
// create a conf context
const lConfContext : ConfContextInterface = lDataSession.createConfContext();
// no configuration for the moment (all `part instances`)
lConfContext.setActiveConfs([]);
// the AABB to use
const lABB : AABB = new AABB();
lABB.mCenter.x = 3.0;
lABB.mCenter.y = 3.0;
lABB.mCenter.z = 3.0;

lABB.mHalfExtent.x = 10.0;
lABB.mHalfExtent.y = 10.0;
lABB.mHalfExtent.z = 10.0;

// create the visibility Filter Solver
const lVisibilityFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();

// create the filtering context of the filter solver
const lInnerFilteringContext : VisibilityContextInterface = lDataSession.createVisibilityContext();
lInnerFilteringContext.setConfContext(lConfContext);
lVisibilityFilterSolver.setVisibilityContext(lInnerFilteringContext);

// create a box filter
const lFilterAABB : FilterAABBInterface = lDataSession.createFilterAABB();
// useless, FilterOperator.FO_UNION is the default operator when creating a new filter
// lFilterAABB.setFilterOperator(FilterOperator.FO_UNION);
lFilterAABB.setAABB(lABB);

// create a FilterAttributeInterface
const lFilterAttributes : FilterAttributeInterface = lDataSession.createFilterAttribute();
// completion status to done
lFilterAttributes.setAttributeName('CompletionStatus');
lFilterAttributes.setExactValues(['done']);
// no n/a
lFilterAttributes.setNaValueChecked(false);

// intersection is the way to go since intersection of box and instances that have the field "CompletionStatus"
// to "done"
// only change the operator of the filters except the first
lFilterAttributes.setFilterOperator(FilterOperator.FO_INTERSECTION);

// and add the filters
// push back (-1) the AABB filter
lVisibilityFilterSolver.insertFilter(-1, lFilterAABB);
// push back (-1) the FilterAttributeInterface, as it is the second one, its operator is used and therefore
// intersection is used
lVisibilityFilterSolver.insertFilter(-1, lFilterAttributes);

// create the filtering context
const lFilteringContext : VisibilityContextInterface = lDataSession.createVisibilityContext();
// sets the conf context
lFilteringContext.setConfContext(lConfContext);
// the colorize filter should be set a sub set of the visibility
lFilteringContext.insertFilterSolver(-1, lVisibilityFilterSolver);

lVisibilityFilterSolver.addEventListener(FilterSolverInterfaceSignal.SolverReady, () =>
{
const lGeometries : Uint32Array | undefined = lVisibilityFilterSolver.getGeometricInstanceIds();
if (lGeometries)
{
// set hidden and not ghosted for everyone
lEngineInterface.updateGeometricStateForAll(VisualStates.S_Ghost | VisualStates.S_Hidden, (~VisualStates.S_Ghost) | VisualStates.S_Hidden);
// and set not hidden for the given geometries
lEngineInterface.updateGeometricState(lGeometries, VisualStates.S_Hidden, ~VisualStates.S_Hidden);
}
});

// create the colorize Filter Solver
const lColorizeFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();
// create an attribute filter
const lColorizeFilterAttributes : FilterBooleanInterface = lDataSession.createBooleanFilter();
// search ToBeRedesigned attribute
lColorizeFilterAttributes.setAttributeName('ToBeRedesigned');
// value should be true
lColorizeFilterAttributes.setBooleanValue(true);

// when the FilterSolverInterface is ready, colorize the given `geometric instances`
lColorizeFilterSolver.addEventListener(FilterSolverInterfaceSignal.SolverReady, () =>
{
const lGeomIds : Uint32Array | undefined = lColorizeFilterSolver.getGeometricInstanceIds();
if (lGeomIds)
{
// change material for these elements
lEngineInterface.getMaterialManager().changeMaterialOfInstances(lGeomIds, lMaterialId);
}
});

// set the filtering context of the given `part instances` list
lColorizeFilterSolver.setVisibilityContext(lFilteringContext);
// add the colorize filter
lColorizeFilterSolver.insertFilter(-1, lColorizeFilterAttributes);
// and tell the DataSessionInterface to update the modified ConfContextInterface, VisibilityContextInterface and FilterSolverInterfaces
lDataSession.update();
// the filtering context may then be used to restrict a search, or a metadata retrieval to the given FilteringContext.

or asynchronously :
/** 
* Sample to illustrate the asynchronous use of multiple FilterSolverInterfaces to define a set of visible pieces, and
* colorize a subset.
* The visibility is composed of all the part instances included in a Box, that have the "CompletionStatus" attribute
* set to "done".
* The colorization set is based on the visibility, the part instances that have the attribute "ToBeRedesigned"
* true should be colored in yellow.
* This colors all part instance in yellow in the given box, that ave the attribute "ToBeRedesigned"
* true and "CompletionStatus" attribute set to "done".
* This sample uses multiple FilterSolverInterface, VisibilityContextInterface,
* It uses some FilterAABBInterface, FilterAttributeInterface, FilterBooleanInterface.
*/
import {
AttributesDictionaryInterface, AttributeInfoInterface, AttributeType, DataSessionInterface,
InfiniteEngineInterface, ConfContextInterface, Vector3, AABB, FilterSolverInterface, VisibilityContextInterface,
FilterAABBInterface, FilterAttributeInterface, FilterOperator, VisualStates, FilterBooleanInterface,
AsyncUInt32ArrayResult,
} from 'generated/documentation/appinfiniteapi';

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

// MAKE SURE the attributes "CompletionStatus", "ToBeRedesigned" are relevant
const lAttributeDictionary : AttributesDictionaryInterface = lDataSession.getAttributesDictionary();
let lAttributeInfo : AttributeInfoInterface | undefined = lAttributeDictionary.getAttributeInfo('CompletionStatus');
// make sure the attribute is a string one
console.assert((lAttributeInfo !== undefined) && (lAttributeInfo.getAttributeType() === AttributeType.ATTR_STRING));

lAttributeInfo = lAttributeDictionary.getAttributeInfo('ToBeRedesigned');
// make sure the attribute is a date one
console.assert((lAttributeInfo !== undefined) && (lAttributeInfo.getAttributeType() === AttributeType.ATTR_BOOLEAN));

// create a custom material yellow
const lMaterialId : number = lEngineInterface.getMaterialManager().createNewMaterial(new Vector3(1, 1, 0));
// create a conf context
const lConfContext : ConfContextInterface = lDataSession.createConfContext();
// no configuration for the moment (all `part instances`)
lConfContext.setActiveConfs([]);
// the AABB to use
const lABB : AABB = new AABB();
lABB.mCenter.x = 3.0;
lABB.mCenter.y = 3.0;
lABB.mCenter.z = 3.0;

lABB.mHalfExtent.x = 10.0;
lABB.mHalfExtent.y = 10.0;
lABB.mHalfExtent.z = 10.0;

// create the visibility Filter Solver
const lVisibilityFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();

// create the filtering context of the filter solver
const lInnerFilteringContext : VisibilityContextInterface = lDataSession.createVisibilityContext();
lInnerFilteringContext.setConfContext(lConfContext);
lVisibilityFilterSolver.setVisibilityContext(lInnerFilteringContext);

// create a box filter
const lFilterAABB : FilterAABBInterface = lDataSession.createFilterAABB();
// useless, FilterOperator.FO_UNION is the default operator when creating a new filter
// lFilterAABB.setFilterOperator(FilterOperator.FO_UNION);
lFilterAABB.setAABB(lABB);

// create a FilterAttributeInterface
const lFilterAttributes : FilterAttributeInterface = lDataSession.createFilterAttribute();
// completion status to done
lFilterAttributes.setAttributeName('CompletionStatus');
lFilterAttributes.setExactValues(['done']);
// no n/a
lFilterAttributes.setNaValueChecked(false);

// intersection is the way to go since intersection of box and instances that have the field "CompletionStatus"
// to "done"
// only change the operator of the filters except the first
lFilterAttributes.setFilterOperator(FilterOperator.FO_INTERSECTION);

// and add the filters
// push back (-1) the AABB filter
lVisibilityFilterSolver.insertFilter(-1, lFilterAABB);
// push back (-1) the FilterAttributeInterface, as it is the second one, its operator is used and therefore
// intersection is used
lVisibilityFilterSolver.insertFilter(-1, lFilterAttributes);

// create the filtering context
const lFilteringContext : VisibilityContextInterface = lDataSession.createVisibilityContext();
// sets the conf context
lFilteringContext.setConfContext(lConfContext);
// the colorize filter should be set a sub set of the visibility
lFilteringContext.insertFilterSolver(-1, lVisibilityFilterSolver);

// create the colorize Filter Solver
const lColorizeFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();
// create an attribute filter
const lColorizeFilterAttributes : FilterBooleanInterface = lDataSession.createBooleanFilter();
// search ToBeRedesigned attribute
lColorizeFilterAttributes.setAttributeName('ToBeRedesigned');
// value should be true
lColorizeFilterAttributes.setBooleanValue(true);

// set the filtering context of the given `part instances` list
lColorizeFilterSolver.setVisibilityContext(lFilteringContext);
// add the colorize filter
lColorizeFilterSolver.insertFilter(-1, lColorizeFilterAttributes);

// the filtering context may then be used to restrict a search, or a metadata retrieval to the given FilteringContext.

const waitForResult = async () : Promise<any> =>
{
// and tell the DataSessionInterface to update the modified ConfContextInterface, VisibilityContextInterface and FilterSolverInterfaces (true)
const lVisibleResult : AsyncUInt32ArrayResult = await lVisibilityFilterSolver.asyncGetGeometricInstanceIds(true);
// no need to call DataSessionInterface update again (false)
const lColorizeResult : AsyncUInt32ArrayResult = await lColorizeFilterSolver.asyncGetGeometricInstanceIds(false);

if (lVisibleResult.value)
{
// set hidden and not ghosted for everyone
lEngineInterface.updateGeometricStateForAll(VisualStates.S_Ghost | VisualStates.S_Hidden, (~VisualStates.S_Ghost) | VisualStates.S_Hidden);
// and set not hidden for the given geometries
lEngineInterface.updateGeometricState(lVisibleResult.value, VisualStates.S_Hidden, ~VisualStates.S_Hidden);
}
if (lColorizeResult.value)
{
// change material for these elements
lEngineInterface.getMaterialManager().changeMaterialOfInstances(lColorizeResult.value, lMaterialId);
}
}

waitForResult();

The DataSessionInterface now offers the same functionalities than the former [MetadataManagerInterface](MetadataManagerInterface.html).
Sessions

See

DataSessionInterfaceSignal

Hierarchy

Methods

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal. It is possible to add an object that will be included in the callback to avoid creating too many closures.

    Returns

    The id of the inserted callback (actually an UUID).

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.
    • pObject: undefined | Object
      in
      The optional object the callback will be called with when the given event fires.

    Returns string

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal.

    Returns

    The id of the inserted callback (actually an UUID).

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.

    Returns string

  • Asynchronous - Sends a close request concerning the current data session on the proxy.

    This actually cleans up the data retained by the proxy and cleans up the resources allocated to the InfiniteEngineInterface.

    When the data session is effectively closed, the promise is resolved.

    Returns

    A promise.

    Returns Promise<void>

  • Asynchronous - starts the open data session procedure.

    A connection is established between the client and the 3djuump infinite proxy. Security tokens are exchanged and initialization data is retrieved from the proxy and the cache if relevant. This operation may take from a few seconds to several minutes depending on the size of the build to work with.

    The promise is then resolved with the correct AsyncDataSessionInterfaceOpenResult value.

    Returns

    A promise. The promise is resolved with the reason (success, failed, already closed).

    Returns Promise<AsyncDataSessionInterfaceOpenResult>

  • Sends a close request concerning the current data session on the proxy.

    This actually cleans up the data retained by the proxy and cleans up the resources allocated to the InfiniteEngineInterface.

    When the data session is effectively closed, then the DataSessionClosed signal is sent.

    Parameters

    • Optional _pDoNotCareAboutResult: boolean
      in
      Ignored, just here for compatibility with prior versions.

    Returns void

  • Gets the conversion ratio between two units.

    Returns

    A floating number corresponding to the Unit conversion ratio.

    Parameters

    • pFrom: Unit
      in
      The reference [Unit](../enums/Unit.html) where the conversion starts from.
    • pTo: Unit
      in
      The [Unit](../enums/Unit.html) to convert to.

    Returns number

  • Gets the list of available annotation types.

    Please see Annotations for more explanations about annotations.

    Modifying this array in place results in undefined behavior.

    DO NOT modify this array.

    Returns

    const
    The list of annotation types.

    Returns string[]

  • Gets the list of configurations.

    Please see configurations for more explanations about configurations.

    Modifying this array in place results in undefined behavior.

    DO NOT modify this array.

    Returns

    const
    The list of configurations.

    Returns ConfigurationInterface[]

  • Gets the data session token that may be used in other requests to prove the authentication to the 3djuump infinite architecture.

    Any http request should have the header x-infinite-bearer : <DataSessionInterface.getDataSessionBearer()>. If the data session is not connected, returns an empty string.

    Returns

    The data session token used to prove the authentication.

    Returns string

  • Gets the Axis Aligned Bounding Box of the currently loaded DMU.

    Returns false if no DMU is loaded (DMULoadingSuccess).

    Returns

    true if a DMU is loaded and pDmuAABBOut is updated.

    Parameters

    • pDmuAABBOut: AABB
      out
      AABB of the DMU.

    Returns boolean

  • Gets the extended data session token that may be used in other requests to prove the authentication to the 3djuump infinite architecture.

    The extended bearer is heavier than getDataSessionBearer and is available only if the directory session was connected with an extended bearer request (Please refer to getSamePageAuthenticationUrl and getPopupBasedAuthenticationUrl).

    Any http request may have the header x-infinite-bearer : <DataSessionInterface.getExtendedDataSessionBearer()>. If the data session is not connected, returns an empty string.

    Returns

    The extended data session token used to prove the authentication.

    Returns string

  • Gets the axis aligned bounding box of the given geometric instance id.

    Call this function after the DMU has been loaded (DMULoadingSuccess) with a previously created AABB.

    Returns true if the given geometric instance id is valid.

    Returns

    true if pAABBOut is updated.

    Parameters

    • pGeometricInstanceId: number
      in
      The geometric instance id to query.
    • pAABBOut: AABB
      out
      The resulting AABB of the geometric instance.

    Returns boolean

  • Gets the diagonal squared length of the Oriented Bounding Box (OBB) of the given geometric instance id.

    Returns -1 if pGeometricInstanceId is an invalid geometric instance id, or the diagonal squared length of the OBB if it is valid.

    Returns

    The diagonal squared length of the OBB of the geometric instance or -1 if invalid.

    Parameters

    • pGeometricInstanceId: number
      in
      The geometric instance id to query.

    Returns number

  • Gets the maximum diagonal squared length of all the Oriented Bounding Box (OBB) of all the geometric instances.

    Returns the maximum diagonal squared length of the current DMU, or -1 if a DMU has not been loaded (DMULoadingSuccess).

    Returns

    The maximum diagonal squared length of the current DMU, or -1 if no DMU is loaded.

    Returns number

  • Gets the minimum diagonal squared length of all the Oriented Bounding Box (OBB) of all the geometric instances.

    Returns the minimum diagonal squared length of the current DMU, or -1 if a DMU has not been loaded ().

    Returns

    The minimum diagonal squared length of the current DMU, or -1 if no DMU is loaded.

    Returns number

  • Gets the maximum geometric instance id of the DMU.

    Valid geometric instance ids range from 1 to getMaximumGeometricId() included. Please refer to Main ID Types for more information.

    Returns the maximum geometric instance id if a DMU is loaded (DMULoadingSuccess, 0 else.

    Returns

    The maximum geometric instance id, 0 if no DMU is loaded.

    Returns number

  • Gets the maximum part instance id of the DMU.

    Valid part instance ids range from 1 to getMaximumPartInstanceId() included. Please refer to Main ID Types for more information.

    Returns the maximum part instance id if a DMU is loaded (DMULoadingSuccess, 0 else.

    Returns

    The maximum part instance id, 0 if no DMU is loaded.

    Returns number

  • Gets a project document by its id.

    Available project documents are :

    • com.3djuump:scripts (idcard customization script) (deprecated).
    • com.3djuump:defaultsettings (field of view, orientation, etc).
    • com.3djuump:indexinfo (elasticsearch index information) : this information is accessible through the AttributesDictionaryInterface.

    Please refer to the integration manual to have more information about these documents.

    It is very unlikely any developer will use these versioned documents.

    Example (illustration purpose only):

    const lDocs = [
    {
    "id": "com.3djuump:defaultsettings",
    "profiles": [],
    "settings": {
    "backfaceculling": false,
    "dynamiclowdefprofiles": {
    "high": 2097152,
    "standard": 1048576
    },
    "fieldofview": {
    "degree": 25,
    "orientation": "vertical"
    },
    "frameorientation": {
    "dir": [
    -1,
    0,
    0
    ],
    "up": [
    0,
    0,
    1
    ]
    }
    },
    "subtype": "defaultsettings",
    "tasksettings": {
    "PresentationTask": {
    "aspectratio": [
    16,
    9
    ]
    }
    },
    "ts": 1591950944,
    "type": "projectdocument",
    "version": "8.0"
    },
    {
    "id": "com.3djuump:indexinfo",
    "internal": {
    "effectivity": {
    "SB": {
    "nested": [
    "effectivity"
    ],
    "type": "keyword",
    "values": [
    "SB1",
    "not_SB1"
    ]
    },
    "engine": {
    "nested": [
    "effectivity"
    ],
    "type": "keyword",
    "values": [
    "A",
    "B"
    ]
    }
    },
    "metadata": {
    "system": {
    "type": "text",
    "values": [
    "Structure",
    "Interior",
    "Exterior",
    "windows",
    "Wheel base"
    ]
    },
    "test.nested.text": {
    "nested": [
    "metadata",
    "test",
    "nested"
    ],
    "type": "text",
    "values": [
    "A",
    "B",
    "C"
    ]
    },
    "test.bool": {
    "type": "boolean"
    },
    "test.date": {
    "max": 1528114033000,
    "min": 1528114033000,
    "type": "date"
    },
    "test.date_range": {
    "type": "date_range"
    },
    "test.double_range": {
    "type": "double_range"
    },
    "test.int": {
    "max": 1,
    "min": 1,
    "type": "double"
    }
    }
    },
    "seq": 814,
    "subtype": "indexinfo",
    "type": "indexdocument",
    "version": 1
    },
    {
    "id": "com.3djuump:scripts",
    "scriptbase64": "base64 string",
    "subtype": "scripts",
    "taskscripts": {
    "AnnotationTask": "base64 string"
    },
    "ts": 1598877573,
    "type": "projectdocument",
    "version": "8.0"
    }
    ];

    These documents are json documents.

    Returns the json document as a string if the given document is available in the 3djuump infinite project.

    It is very unlikely any developer will use getProjectDocument("com.3djuump:scripts") as this script should be used for the 3djuump infinite native client.

    Returns

    The document as a string, or undefined if the document could not be found or the DMU is not loaded.

    Parameters

    • pDocumentId: string
      in
      The project document id to fetch.

    Returns undefined | string

  • Computes the axis aligned bounding box of the given geometric instances.

    This consists in the union of all the AABB of the geometric instances expressed by their geometric instance ids.

    Call this function once the DMU has been loaded (DMULoadingSuccess) with a previously created AABB.

    Returns true if at least one geometric instance id inside pGeometricInstanceIds is valid. Invalid geometric instance ids are silently discarded.

    Returns

    true if at least one geometric instance id inside pGeometricInstanceIds is valid and pAABBOut is therefore updated.

    Parameters

    • pGeometricInstanceIds: number[] | Uint32Array
      in
      the list of geometric instance ids to query.
    • pAABBOut: AABB
      out
      the union of all the [AABB](../classes/AABB.html) o the geometric instance.

    Returns boolean

  • Tells if the EventDispatcher has such a callback registered for the given event type.

    Returns

    true if such a listener is installed for the given type of event.

    Parameters

    • pType: string
      in
      The type of the event to test.
    • pListener: tListenerCallback
      in
      The listener function that gets tested.

    Returns boolean

  • Tells if the data session is connected to a proxy.

    If the proxy has not yet received the DMULoadingSuccess or DMULoadingFailed signal, returns false.

    Returns true if openDataSession has been called and closeDataSession has not yet been called.

    Returns

    true if all initialization data have been parsed.

    Returns boolean

  • Starts the open data session procedure.

    A connection is established between the client and the 3djuump infinite proxy. Security tokens are exchanged and initialization data is retrieved from the proxy and the cache if relevant. This operation may take from a few seconds to several minutes depending on the size of the build to work with.

    When data is ready, the [[DataSessionInterfaceSignal.DMULoadingSuccess] signal is sent.

    If an error occurs, then the [[DataSessionInterfaceSignal.DMULoadingFailed] signal is sent.

    Returns

    true if the data session open procedure can be started. Returns false in case the DataSessionInterface has already been opened.

    Returns boolean

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    • pObject: undefined | Object

      The listener object that was used when addEventListener was called.

    Returns boolean

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    Returns boolean

  • Removes a listener by its id.

    If no such listener is found, then the function returns false and does nothing. You must use the return value of addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pId: string
      in
      The id returned by the call to [addEventListener](DataSessionInterface.html#addEventListener) that you want to remove.

    Returns boolean

  • Relaunches the idle timer.

    For security reasons, the data session is closed when no event has been received for a long time, this duration depends on the server configuration. You may reset the idle timer at some time to avoid the user from being disconnected.

    When the user will be soon disconnected, then the IdleWarningDataSession signal is sent, if the user interacts with the system or restartIdleTimer is called, then the DataSessionReactivated signal is sent.
    If no user interaction takes place, then the data session is closed, the IdleDataSession signal is sent (no DataSessionClosed signal will be sent). You will have to call closeDataSession to clean up the resources.

    Returns void