Enumeration FeatureManagerInterfaceSignal

The FeatureManagerInterfaceSignal lists all the signals that may be sent by the FeatureManagerInterface.

These signals are emitted by the FeatureManagerInterface when a feature hover result is changed, a measurement has been computed or an OOBB request result is ready .

/** 
* Sample to illustrate the retrieval of the OOBB of a geometry.
*/
import { FeatureManagerInterface, FeatureManagerInterfaceSignal, InfiniteEngineInterface, InfiniteEvent, OOBB, OOBBTypeAttachment } from 'generated_files/documentation/appinfiniteapi';

// created previously
let lInfiniteEngine : InfiniteEngineInterface;

// the geometric instance to retrieve OOBB from
let lGeometricInstanceId : number;

// retrieve the `feature` manager
const lFeatureManager : FeatureManagerInterface = lInfiniteEngine.getFeatureManager();
// the OOBB request id
let lRetrieveOobbRequestId : number = 0;

// the resulting OOBB
let lOobbResult : OOBB | undefined = undefined;

// the callback called when a OOBB result is ready
const onOobbRetrieved = (pEvent: InfiniteEvent) : void =>
{
const lOOBBAttachment : OOBBTypeAttachment | undefined = pEvent.attachments;
// is this event valid ?
if(lOOBBAttachment === undefined || lOOBBAttachment.oobb === undefined)
{
console.log('invalid oobb attachment');
return;
}
// is this the correct request ?
if(lOOBBAttachment.oobbRequestId !== lRetrieveOobbRequestId)
{
//
return;
}
// finally, we made it !
lOobbResult = lOOBBAttachment.oobb;
console.log('Found oobb', JSON.stringify(lOobbResult));
const lApplicationId : number = lFeatureManager.createOOBBApplicationFeature(lOobbResult);
if(lApplicationId <= 0)
{
console.log('feature creation failed');
}
};

// register our callback
lFeatureManager.addEventListener(FeatureManagerInterfaceSignal.OOBBReady, onOobbRetrieved);

// and request an oobb
lRetrieveOobbRequestId = lFeatureManager.retrieveOOBB(lGeometricInstanceId);
if(lRetrieveOobbRequestId <= 0)
{
console.log('Failed to query oobb, is the geometric instance id correct ?');
}

/** 
* Sample to illustrate the measurement between a geometry and an arc of circle.
*/
import {
AABB, ArcOfCircleFeature, DataSessionInterface, FeatureManagerInterface, FeatureManagerInterfaceSignal,
FeatureType, GeometryFeature, InfiniteEngineInterface, InfiniteEvent, MeasurementType, MeasurementTypeAttachment,
Unit, Vector3
} from 'generated_files/documentation/appinfiniteapi';

// the data session
// created previously
let lDataSession : DataSessionInterface;

// created previously
let lInfiniteEngine : InfiniteEngineInterface;

// the geometric instance to compute measurement from
let lGeometricInstanceId : number;

// retrieve the `feature` manager
const lFeatureManager : FeatureManagerInterface = lInfiniteEngine.getFeatureManager();
// the measurement request id
let lMeasurementRequestId : number = 0;

// the callback called when a measurement result is ready
const onMeasurementDone = (pEvent: InfiniteEvent) : void =>
{
const lMeasurementAttachment : MeasurementTypeAttachment | undefined = pEvent.attachments;
// is this event valid ?
if(lMeasurementAttachment === undefined || lMeasurementAttachment.contactPoint0 === undefined)
{
console.log('invalid measurement attachment');
return;
}
// is this the correct request ?
if(lMeasurementAttachment.measurementRequestId !== lMeasurementRequestId)
{
// bail out
return;
}
// finally, we made it !
console.log('Found 2 contact points', JSON.stringify(lMeasurementAttachment.contactPoint0), JSON.stringify(lMeasurementAttachment.contactPoint1));

// make two fancy points on the rendering
let lApplicationId : number = lFeatureManager.createPointApplicationFeature(lMeasurementAttachment.contactPoint0);
if(lApplicationId <= 0)
{
console.log('feature creation failed');
}
lApplicationId = lFeatureManager.createPointApplicationFeature(lMeasurementAttachment.contactPoint1);
if(lApplicationId <= 0)
{
console.log('feature creation failed');
}
// and show the result, we are here for that
console.log('Measurement distance', lMeasurementAttachment.contactPoint0.distanceToVector(lMeasurementAttachment.contactPoint1));
};

// register our callback
lFeatureManager.addEventListener(FeatureManagerInterfaceSignal.MeasurementReady, onMeasurementDone);

// retrieve the DMU center
const lDmuAABB : AABB = new AABB();
lDataSession.getDmuAABB(lDmuAABB);

// retrieve the up and front vectors of the scene
const lDmuUpVector : Vector3 = new Vector3();
const lDmuFrontVector : Vector3 = new Vector3();
lInfiniteEngine.getCameraManager().getFrameReference(lDmuFrontVector, lDmuUpVector);

// the arc of circle radius in meters
const lCircleFeatureRadiusInMeters : number = 1.3;

// first `feature` is a geometry
const lFirstFeature : GeometryFeature = {
type: FeatureType.FT_Geometry,
geometricInstanceId: lGeometricInstanceId
};

// second `feature` is an arc of circle
const lSecondFeature : ArcOfCircleFeature = {
type: FeatureType.FT_ArcOfCircle,
center: lDmuAABB.mCenter,
normal: lDmuUpVector,
startDirection: lDmuFrontVector,
radius: lCircleFeatureRadiusInMeters * lDataSession.convertUnitFactor(Unit.U_Meter, lDataSession.getDmuBuildUnit()),
angle: Math.PI * 0.5
};

// and make a measurement between the geometry and the given arc of circle (do not use item centers)
// the measure is the smallest distance between the 2 elements
lMeasurementRequestId = lFeatureManager.computeMeasurement(lFirstFeature, lSecondFeature, MeasurementType.MT_Item_Item);
if(lMeasurementRequestId <= 0)
{
console.log('Failed to make measurement, is the geometric instance id correct ?');
}

The FeatureManagerInterface is available through InfiniteEngineInterface.getFeatureManager.
Events

Enumeration Members

FeatureHoverChanged: "hoverChanged"

Signal sent by the FeatureManagerInterface when the feature below the pointer has changed.

The attachment is a PickingFeatureAttachmentItem if a feature is below the cursor, or undefined if nothing is below.

FeaturesInfoReady: "featuresInfoReady"

Signal sent by the FeatureManagerInterface when the feature infos asked by FeatureManagerInterface.retrieveFeaturesInfo has finished its computation.

The attachment is a FeaturesInfoTypeAttachment with the resulting infos.

MeasurementReady: "measurementReady"

Signal sent by the FeatureManagerInterface when the measurement asked by FeatureManagerInterface.computeMeasurement has finished its computation.

The attachment is a MeasurementTypeAttachment with the two contact points.

OOBBReady: "oobbReady"

Signal sent by the FeatureManagerInterface when the OOBB retrieval asked by FeatureManagerInterface.retrieveOOBB has finished its computation.

The attachment is a OOBBTypeAttachment with the resulting OOBB.