Enumeration AnnotationRendererInterfaceSignal

The AnnotationRendererInterfaceSignal lists the signal that may be sent by the AnnotationRendererInterface.

These signals are emitted by the AnnotationRendererInterface when it is modified.

The AnnotationRendererInterface may fire the following signal :

/** 
* Sample to illustrate the displaying of annotations.
*/
import {
AnnotationGetterInterface, AnnotationGetterInterfaceSignal, InfiniteEvent,
AnnotationResultInterface, InfiniteEngineInterface, AnnotationRendererInterface, AnnotationRendererInterfaceSignal,
tAnnotationViewId, AnnotationInstanceState, AnnotationViewParsingResultInterface, AnnotationViewInterface
} from 'generated_files/documentation/appinfiniteapi';

// created previously
let lAnnotationViewGetter : AnnotationGetterInterface;
// created previously
let lInfiniteEngine : InfiniteEngineInterface;
// retrieve the annotation renderer
const lAnnotationRenderer : AnnotationRendererInterface = lInfiniteEngine.getAnnotationRenderer();

// the annotation view id that has just been parsed
let lAnnotationViewId : tAnnotationViewId = -1;

// what to do when an annotation has been downloaded ?
let onAnnotationRetrieved : (pEvent: InfiniteEvent, pCallbackData: Object | undefined) => void;

// what to do when an annotation is ready to be displayed ?
let onAnnotationReady : (pEvent: InfiniteEvent, pCallbackData: Object | undefined) => void;

// connect to signals
lAnnotationViewGetter.addEventListener(AnnotationGetterInterfaceSignal.AnnotationFetchReady, onAnnotationRetrieved);
lAnnotationRenderer.addEventListener(AnnotationRendererInterfaceSignal.AnnotationViewParsed, onAnnotationReady);

// what to do when an annotation has been downloaded ?
onAnnotationRetrieved = (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
// the result of the download
const lAnnotationViewsContent : Array<AnnotationResultInterface> | undefined = lAnnotationViewGetter.getAnnotationGroupsResult();
if (!lAnnotationViewsContent || (lAnnotationViewsContent.length === 0))
{
console.log('Weird, annotation is downloaded but no content');
return;
}
if (lAnnotationViewsContent.length > 1)
{
console.log('Only displaying one annotation view at the moment, other annotation views will be discarded');
return;
}
// take the first annotation result, discarding others
const lAnnotationResult : AnnotationResultInterface = lAnnotationViewsContent[0];

// and add the annotation view to be displayed with standard depth
// 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 lAnnotationViews : Array<AnnotationViewInterface> = lAnnotationResult.getAnnotationViews();
if(lAnnotationViews.length === 0)
{
console.log('Weird, annotation is downloaded but no result');
return;
}
const lMask : number = AnnotationInstanceState.AIS_DepthPriorityMask | AnnotationInstanceState.AIS_Visible;
const lState : number = AnnotationInstanceState.AIS_DepthPriorityStd;
const lRequestId : number = lAnnotationRenderer.addAnnotationView(lAnnotationViews[0], lAnnotationResult.getGroupMatrix(), lMask, lState);
if (lRequestId < 0)
{
// weird error
console.log('The parsing procedure could not be started');
}
};

// what to do when an annotation is ready to be displayed ?
onAnnotationReady = (pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
// fancy log
console.log('annotation view has finished parsing');

// take the parsing result
const lParsingResult : AnnotationViewParsingResultInterface = pEvent.attachments;
if (lParsingResult.annotationView === undefined)
{
// this is an error
console.log('annotation view parsing has failed ' + JSON.stringify(lParsingResult.error));
return;
}

// store the annotation view id
lAnnotationViewId = lParsingResult.annotationView.getViewId();
const lNbAnnotations : number = lParsingResult.annotationView.getAnnotationsCount();
const lAnnotationStartId : number = lParsingResult.annotationView.getFirstAnnotationId();
// create the list of annotation ids from lParsingResult.annotationIdStart to lParsingResult.annotationIdStart + lParsingResult.nbAnnotations - 1
const lAnnotationIds : number [] = [];
lAnnotationIds.length = lNbAnnotations;
let i : number;
for (i = 0; i < lNbAnnotations; i += 1)
{
lAnnotationIds[i] = lAnnotationStartId + i;
}
// mask for all rendering flags (except priority)
const lMask : number = AnnotationInstanceState.AIS_AppearThroughGeometry | AnnotationInstanceState.AIS_Highlight
| AnnotationInstanceState.AIS_Overprint | AnnotationInstanceState.AIS_Visible;
// state is visible (but we may add AnnotationInstanceState.AIS_AppearThroughGeometry just for fun)
const lState : number = AnnotationInstanceState.AIS_Visible; // | AnnotationInstanceState.AIS_AppearThroughGeometry

lAnnotationRenderer.setAnnotationRenderingState(lAnnotationIds, lMask, lState);
// you should now see the annotation on the next rendering
};

Please see Annotations for more explanations about annotations.
Events

Enumeration Members

AnnotationRenderingChanged: "annotationRenderingChanged"

Signal sent by the AnnotationRendererInterface when the rendering of the annotations has changed.

No attachment for events of this type.

This signal is emitted after a successful call to AnnotationRendererInterface.setAnnotationRenderingState, AnnotationRendererInterface.setAnnotationRenderingStateForAll.

AnnotationViewParsed: "annotationViewParsed"

Signal sent by the AnnotationRendererInterface when it has finished parsing an AnnotationViewInterface.

The attachment for events of this type is an AnnotationViewParsingResultInterface.

This signal is emitted after a successful call to AnnotationRendererInterface.addAnnotationView.

AnnotationViewsChanged: "annotationViewsChanged"

Signal sent by the AnnotationRendererInterface when the list of views has changed.

No attachment for events of this type.

This signal is emitted after either :