vtkOrientationMarkerWidget is a 2D widget for manipulating a marker prop
Methods
computeViewport
Get the computed viewport size. The format is [left, bottom, right, top].
delete
Dereference any internal object and remove any subscription. It gives custom class to properly detach themselves from the DOM or any external dependency that could prevent their deletion when the GC runs.
extend
Method used to decorate a given object (publicAPI+model) with vtkOrientationMarkerWidget characteristics.
Argument
Type
Required
Description
publicAPI
Yes
object on which methods will be bounds (public)
model
Yes
object on which data structure will be bounds (protected)
initialValues
IOrientationMarkerWidgetInitialValues
No
(default: {})
getActor
getEnabled
Get wheter the orientation marker is enabled.
getInteractiveRenderer
An instance of this class will spawn its own renderer, by default non interactive. This behavior is configurable through the interactiveRenderer property when initializing the instance.
Returns
Type
Description
true if the renderer was created as interactive, false otherwise.
getInteractor
Get the render window interactor associated with the widget.
getMaxPixelSize
Get the maximum side length, in pixels, for the orientation marker widget viewport.
getMinPixelSize
Get the minimum side length, in pixels, for the orientation marker widget viewport.
getParentRenderer
Gets the parent renderer, if any.
getRenderer
Get the renderer associated with the widget.
getViewportCorner
Get the viewport corner.
getViewportSize
Get the viewport size.
newInstance
Method used to create a new instance of vtkOrientationMarkerWidget
Argument
Type
Required
Description
initialValues
IOrientationMarkerWidgetInitialValues
No
for pre-setting some of its content
setActor
Get the actor associated with the widget.
Argument
Type
Required
Description
actor
vtkActor
Yes
The actor instance.
setEnabled
Set the widget enabled status, i.e. to show the widget or not.
Argument
Type
Required
Description
enabled
Boolean
Yes
setInteractor
Set the render window interactor associated with the widget.
Argument
Type
Required
Description
interactor
vtkRenderWindowInteractor
Yes
setMaxPixelSize
Set the maximum side length, in pixels, for the orientation marker widget viewport.
Argument
Type
Required
Description
pixelSize
Number
Yes
setMinPixelSize
Set the minimum side length, in pixels, for the orientation marker widget viewport.
Argument
Type
Required
Description
pixelSize
Number
Yes
setParentRenderer
Sets the parent renderer
Argument
Type
Required
Description
ren
vtkRenderer
Yes
The parent renderer
setViewportCorner
Set which corner to put the widget’s viewport.
Argument
Type
Required
Description
viewportCorner
Corners
Yes
setViewportSize
Set the viewport size. The sizeFactor should be between 0.0 and 1.0. It says how much of the main render window to color.
export interface vtkOrientationMarkerWidget extends vtkObject { /** * Get the computed viewport size. * The format is `[left, bottom, right, top]`. */ computeViewport(): [number, number, number, number];
/** * Dereference any internal object and remove any subscription. * It gives custom class to properly detach themselves from the DOM * or any external dependency that could prevent their deletion * when the GC runs. */ delete(): void;
/** * */ getActor(): vtkActor;
/** * Gets the parent renderer, if any. */ getParentRenderer(): Nullable<vtkRenderer>;
/** * Get wheter the orientation marker is enabled. */ getEnabled(): boolean;
/** * Get the render window interactor associated with the widget. */ getInteractor(): vtkRenderWindowInteractor;
/** * Get the maximum side length, in pixels, for the orientation marker widget * viewport. */ getMaxPixelSize(): number;
/** * Get the minimum side length, in pixels, for the orientation marker widget * viewport. */ getMinPixelSize(): number;
/** * Get the renderer associated with the widget. */ getRenderer(): vtkRenderer;
/** * Get the viewport corner. */ getViewportCorner(): Corners;
/** * Get the viewport size. */ getViewportSize(): number;
/** * Get the actor associated with the widget. * @param {vtkActor} actor The actor instance. */ setActor(actor: vtkActor): void;
/** * Sets the parent renderer * @param {vtkRenderer} ren The parent renderer */ setParentRenderer(ren: vtkRenderer): boolean;
/** * Set the widget enabled status, i.e. to show the widget or not. * @param {Boolean} enabled */ setEnabled(enabled: boolean): void;
/** * Set the render window interactor associated with the widget. * @param {vtkRenderWindowInteractor} interactor */ setInteractor(interactor: vtkRenderWindowInteractor): boolean;
/** * Set the maximum side length, in pixels, for the orientation marker widget * viewport. * @param {Number} pixelSize * @default 200 */ setMaxPixelSize(pixelSize: number): boolean;
/** * Set the minimum side length, in pixels, for the orientation marker widget * viewport. * @param {Number} pixelSize * @default 50 */ setMinPixelSize(pixelSize: number): boolean;
/** * Set which corner to put the widget's viewport. * @param {Corners} viewportCorner * @defaultBOTTOM_LEFT */ setViewportCorner(viewportCorner: Corners): boolean;
/** * Set the viewport size. * The sizeFactor should be between 0.0 and 1.0. * It says how much of the main render window to color. * @param {Number} sizeFactor * @default 0.2 */ setViewportSize(sizeFactor: number): void;
/** * Manually updates the marker's orientation. */ updateMarkerOrientation(): void;
/** * An instance of this class will spawn its own renderer, by default non interactive. * This behavior is configurable through the interactiveRenderer property when initializing the instance. * @returns true if the renderer was created as interactive, false otherwise. */ getInteractiveRenderer(): boolean; }
/** * Method used to decorate a given object (publicAPI+model) with vtkOrientationMarkerWidget characteristics. * * @param publicAPI object on which methods will be bounds (public) * @param model object on which data structure will be bounds (protected) * @param {IOrientationMarkerWidgetInitialValues} [initialValues] (default: {}) */ exportfunctionextend( publicAPI: object, model: object, initialValues?: IOrientationMarkerWidgetInitialValues ): void;
/** * Method used to create a new instance of vtkOrientationMarkerWidget * @param {IOrientationMarkerWidgetInitialValues} [initialValues] for pre-setting some of its content */ exportfunctionnewInstance( initialValues?: IOrientationMarkerWidgetInitialValues ): vtkOrientationMarkerWidget;
/** * vtkOrientationMarkerWidget is a 2D widget for manipulating a marker prop */ export declare constvtkOrientationMarkerWidget: { newInstance: typeof newInstance; extend: typeof extend; Corners: typeofCorners; };
functionvtkOrientationMarkerWidget(publicAPI, model) { // Set our className model.classHierarchy.push('vtkOrientationMarkerWidget');
const superClass = { ...publicAPI };
// Private variables
const previousCameraInput = []; const selfRenderer = vtkRenderer.newInstance(); const resizeObserver = newResizeObserver((entries) => { publicAPI.updateViewport(); }); let onCameraChangedSub = null; let onCameraModifiedSub = null; let onAnimationSub = null; let onEndAnimationSub = null; let selfSubscription = null;
functiononCameraModified() { // If animating, marker will be updated on Animation event if (!model._interactor.isAnimating()) { publicAPI.updateMarkerOrientation(); } }
// NOTE: setting these while the widget is enabled will // not update the widget. macro.setGet(publicAPI, model, [ '_interactor', 'minPixelSize', 'maxPixelSize', 'parentRenderer', ]); macro.get(publicAPI, model, ['actor']); macro.moveToProtected(publicAPI, model, ['interactor']);