Interface AnnotationCaptureInterface

** EXPERIMENTAL ** ** These API functions are expected to change in the near future **

When dealing with annotations, the DMU provider may have included additional information to correctly view a set of annotations. These added information are called an Annotations Capture. These information are stored with an AnnotationCaptureInterface.

Such information may contain :

  • The list of annotations that must be visible in order to correctly view the set of data.
  • An optional 3D point of interest.
  • An optional camera location to correctly view the set of data.
  • An optional cut plane (CutPlaneManagerInterface).

Captures are retrieved by an AnnotationGetterInterface inside an AnnotationResultInterface with AnnotationResultInterface.getAnnotationCaptures.

/** 
* Sample to illustrate the asynchronous use of an AnnotationGetterInterface to retrieve capture information.
*/
import {
DataSessionInterface, AsyncResultReason, AnnotationGroupInfoInterface, AnnotationGetterInterface,
AnnotationResultInterface, AsyncAnnotationResult, AnnotationCaptureInterface, Vector3, InfiniteEngineInterface,
AnnotationViewVisibilityInterface, AnnotationInstanceState, AsyncAnnotationViewParsingResult, tAnnotationId
} from 'generated_files/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// retrieved previously
let lAnnotationsToFetch : Array<AnnotationGroupInfoInterface>;
// retrieved previously
let lInfiniteEngine : InfiniteEngineInterface;

const getCaptures = async () : Promise<void> =>
{
// to retrieve the annotations
const lAnnotationViewGetter : AnnotationGetterInterface = lDataSession.createAnnotationGetter();

// and download
const lAnnotationContentResult : AsyncAnnotationResult = await lAnnotationViewGetter.asyncFetchAnnotationGroups(lAnnotationsToFetch);
// annotation are ready
if ((!lAnnotationContentResult.value) || (lAnnotationContentResult.value.length === 0))
{
console.log('error while fetching annotation content');
return;
}
// now annotation content is there, just need to display them
// use only the first view
const lCurAnnotationViewResult : AnnotationResultInterface = lAnnotationContentResult.value[0];
console.log('display annotation view ' + lCurAnnotationViewResult.getGroupName() + ' (of type ' + lCurAnnotationViewResult.getGroupTypeName() + ')');

const lCaptures : Array<AnnotationCaptureInterface> = lCurAnnotationViewResult.getAnnotationCaptures();
if (lCaptures.length === 0)
{
// no capture => useless
return;
}
const lAnnotationCapture : AnnotationCaptureInterface = lCaptures[0];
const lCapturePOI : Vector3 = new Vector3();
// find the point of interest of the capture
if(lAnnotationCapture.getTargetPosition(lCapturePOI))
{
lInfiniteEngine.getCameraManager().lookAt(lCapturePOI);
}
const lVisibleAnnotations : Array<AnnotationViewVisibilityInterface> = lAnnotationCapture.getVisibleAnnotations();
if(lVisibleAnnotations.length > 0)
{
// we want to set the depth and visible state of the annotation
// mask is AnnotationInstanceState.AIS_DepthPriorityMask | AnnotationInstanceState.AIS_Visible
// but we want to be depth std and invisible
// state is AnnotationInstanceState.AIS_DepthPriorityStd | 0 = AnnotationInstanceState.AIS_DepthPriorityStd
const lMask : number = AnnotationInstanceState.AIS_DepthPriorityMask | AnnotationInstanceState.AIS_Visible;
const lState : number = AnnotationInstanceState.AIS_DepthPriorityStd;
const lFirstViewToSee : AnnotationViewVisibilityInterface = lVisibleAnnotations[0];
const lAnnotationParsingResult : AsyncAnnotationViewParsingResult = await lInfiniteEngine.getAnnotationRenderer().asyncAddAnnotationView(lFirstViewToSee.getView(), lFirstViewToSee.getView().getDefaultMatrix(), lMask, lState);
if (lAnnotationParsingResult.reason !== AsyncResultReason.ARR_Success
|| lAnnotationParsingResult.value === undefined)
{
// weird error
console.log('The parsing procedure could not be started');
return;
}
const lAnnotationsToSee : Array<tAnnotationId> = [];
lFirstViewToSee.getVisibleAnnotationIds(lAnnotationsToSee);
// and set only annotation of the capture visible
lInfiniteEngine.getAnnotationRenderer().setAnnotationRenderingState(lAnnotationsToSee, AnnotationInstanceState.AIS_Visible, AnnotationInstanceState.AIS_Visible);
}
};

getCaptures();

Please see Annotations for more explanations about annotations.
3D Rendering

interface AnnotationCaptureInterface {
    getAnnotationCaptureName(): string;
    getCameraParameters(pCameraLocation, pCameraUp): boolean;
    getCutPlaneParameters(pCutPlanePosition, pCutPlaneNormal): boolean;
    getTargetPosition(pPosition): boolean;
    getVisibleAnnotations(): AnnotationViewVisibilityInterface[];
}

Methods

  • Gets the capture name.

    Returns string

    The capture name.

  • Gets the camera location, and basic orientation to set to view this capture.

    If no camera parameters are set, or if pCameraLocation is not a Vector3 or if pCameraUp is not a Vector3, returns false.

    Parameters

    • pCameraLocation: Vector3
      out
      The camera location to set to view this capture, unchanged if the call returns false.
    • pCameraUp: Vector3
      out
      The up direction to set for the camera to view this capture, unchanged if the call returns false.

    Returns boolean

    true if the capture has camera parameters and if the call succeeded.

  • Gets the cut plane parameters to set to view this capture.

    If no cut plane parameters are set, or if pCutPlanePosition is not a Vector3 or if pCutPlaneNormal is not a Vector3, returns false.

    Parameters

    • pCutPlanePosition: Vector3
      out
      The position of the cut plane, unchanged if the call returns false.
    • pCutPlaneNormal: Vector3
      out
      The normal of the cut plane, unchanged if the call returns false.

    Returns boolean

    true if the capture has cut plane parameters and if the call succeeded.

  • Gets the optional 3D position to look at for this capture (Point of Interest).

    If no position is set, or if pPosition is not a Vector3, returns false.

    Parameters

    • pPosition: Vector3
      out
      The 3d position to look at, unchanged if the call returns false.

    Returns boolean

    true if the capture has a target position and if the call succeeded.