** 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.
/** * 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 letlDataSession : DataSessionInterface; // retrieved previously letlAnnotationsToFetch : Array<AnnotationGroupInfoInterface>; // retrieved previously letlInfiniteEngine : InfiniteEngineInterface;
constgetCaptures = async () : Promise<void> => { // to retrieve the annotations constlAnnotationViewGetter : AnnotationGetterInterface = lDataSession.createAnnotationGetter();
// and download constlAnnotationContentResult : AsyncAnnotationResult = awaitlAnnotationViewGetter.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 constlCurAnnotationViewResult : AnnotationResultInterface = lAnnotationContentResult.value[0]; console.log('display annotation view ' + lCurAnnotationViewResult.getGroupName() + ' (of type ' + lCurAnnotationViewResult.getGroupTypeName() + ')');
constlCaptures : Array<AnnotationCaptureInterface> = lCurAnnotationViewResult.getAnnotationCaptures(); if (lCaptures.length === 0) { // no capture => useless return; } constlAnnotationCapture : AnnotationCaptureInterface = lCaptures[0]; constlCapturePOI : Vector3 = newVector3(); // find the point of interest of the capture if(lAnnotationCapture.getTargetPosition(lCapturePOI)) { lInfiniteEngine.getCameraManager().lookAt(lCapturePOI); } constlVisibleAnnotations : 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 constlMask : number = AnnotationInstanceState.AIS_DepthPriorityMask | AnnotationInstanceState.AIS_Visible; constlState : number = AnnotationInstanceState.AIS_DepthPriorityStd; constlFirstViewToSee : AnnotationViewVisibilityInterface = lVisibleAnnotations[0]; constlAnnotationParsingResult : AsyncAnnotationViewParsingResult = awaitlInfiniteEngine.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; } constlAnnotationsToSee : 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.
** 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.
Please see Annotations for more explanations about annotations.
See