Interface AnnotationViewVisibilityInterface

** 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.

Such annotations are gathered by their ownership to an AnnotationViewInterface. A subset of annotations of a given AnnotationViewInterface is stored in an AnnotationViewVisibilityInterface.

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 AnnotationViewVisibilityInterface {
    getView(): AnnotationViewInterface;
    getVisibleAnnotationIds(pAnnotationsIds): boolean;
}

Methods

  • Gets the visible annotation ids the capture visibility refers to.

    Parameters

    • pAnnotationsIds: number[]
      out
      The visible annotation ids.

    Returns boolean

    true is the call succeeded.