vtkActor2D is used to represent a 2D entity in a rendering scene. It inherits functions related to the actors position, and orientation from vtkProp. The actor also has scaling and maintains a reference to the defining geometry (i.e., the mapper), rendering properties, and possibly a texture map.
Method use to decorate a given object (publicAPI+model) with vtkActor2D 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
IActor2DInitialValues
No
(default: {})
getActors2D
getActualPositionCoordinate
Return the actual vtkCoordinate reference that the mapper should use to position the actor. This is used internally by the mappers and should be overridden in specialized subclasses and otherwise ignored.
getActualPositionCoordinate2
getBounds
Get the bounds as [xmin, xmax, ymin, ymax, zmin, zmax].
getHeight
getIsOpaque
getMapper
Gets the 2D mapper.
getProperty
Return the property object that controls this actors surface properties. This should be an instance of a vtkProperty2D object. Every actor must have a property associated with it. If one isn’t specified, then one will be generated automatically. Multiple actors can share one property object.
getWidth
hasTranslucentPolygonalGeometry
makeProperty
Create a new property suitable for use with this type of Actor.
/** * Return the property object that controls this actors surface * properties. This should be an instance of a vtkProperty2D object. Every * actor must have a property associated with it. If one isn’t specified, * then one will be generated automatically. Multiple actors can share one * property object. */ getProperty(): vtkProperty2D;
/** * Create a new property suitable for use with this type of Actor. * @param {IProperty2DInitialValues} [initialValues] (default: {}) */ makeProperty(initialValues?: IProperty2DInitialValues): vtkProperty2D;
/** * Sets the 2D mapper. */ setMapper(mapper: vtkMapper2D): boolean;
/** * Gets the 2D mapper. */ getMapper(): vtkMapper2D;
/** * Set the Prop2D's position in display coordinates. * @paramXPos * @paramYPos */ setDisplayPosition(XPos: any, YPos: any): void;
/** * * @paramw */ setWidth(w: number): void;
/** * * @paramw */ setHeight(h: number): void;
/** * */ getWidth(): number;
/** * */ getHeight(): number;
/** * Get the bounds as [xmin, xmax, ymin, ymax, zmin, zmax]. * @return {Bounds} The bounds for the mapper. */ getBounds(): Bounds;
/** * Return the actual vtkCoordinate reference that the mapper should use * to position the actor. This is used internally by the mappers and should * be overridden in specialized subclasses and otherwise ignored. */ getActualPositionCoordinate(): vtkCoordinate;
/** * Method use to decorate a given object (publicAPI+model) with vtkActor2D characteristics. * * @param publicAPI object on which methods will be bounds (public) * @param model object on which data structure will be bounds (protected) * @param {IActor2DInitialValues} [initialValues] (default: {}) */ exportfunctionextend( publicAPI: object, model: object, initialValues?: IActor2DInitialValues ): void;
/** * Method use to create a new instance of vtkActor2D * @param {IActor2DInitialValues} [initialValues] for pre-setting some of its content */ exportfunctionnewInstance(initialValues?: IActor2DInitialValues): vtkActor2D;
/** * vtkActor2D is used to represent a 2D entity in a rendering scene. It inherits * functions related to the actors position, and orientation from * vtkProp. The actor also has scaling and maintains a reference to the * defining geometry (i.e., the mapper), rendering properties, and possibly a * texture map. * @see [vtkMapper2D](./Rendering_Core_Mapper2D.html) * @see [vtkProperty2D](./Rendering_Core_Property2D.html) */ export declare constvtkActor2D: { newInstance: typeof newInstance; extend: typeof extend; }; exportdefault vtkActor2D;
functionvtkActor2D(publicAPI, model) { // Set our className model.classHierarchy.push('vtkActor2D');
publicAPI.getActors2D = () => publicAPI;
publicAPI.getIsOpaque = () => { // make sure we have a property if (!model.property) { // force creation of a property publicAPI.getProperty(); }
let isOpaque = model.property.getOpacity() >= 1.0;
// are we using an opaque texture, if any? isOpaque = isOpaque && (!model.texture || !model.texture.isTranslucent());
return isOpaque; };
publicAPI.hasTranslucentPolygonalGeometry = () => { if (model.mapper === null) { returnfalse; } // make sure we have a property if (model.property === null) { // force creation of a property publicAPI.setProperty(publicAPI.makeProperty()); }
// is this actor opaque ? return !publicAPI.getIsOpaque(); };
//---------------------------------------------------------------------------- // Set the Prop2D's position in display coordinates. publicAPI.setDisplayPosition = (XPos, YPos) => { model.positionCoordinate.setCoordinateSystem(Coordinate.DISPLAY); model.positionCoordinate.setValue(XPos, YPos, 0.0); };
publicAPI.getRedrawMTime = () => { let mt = model.mtime; if (model.mapper !== null) { let time = model.mapper.getMTime(); mt = time > mt ? time : mt; if (model.mapper.getInput() !== null) { // FIXME !!! getInputAlgorithm / getInput model.mapper.getInputAlgorithm().update(); time = model.mapper.getInput().getMTime(); mt = time > mt ? time : mt; } } return mt; };
publicAPI.getBounds = () => { // does our mapper support bounds if (typeof publicAPI.getMapper().getBounds === 'function') { model.useBounds = true; return publicAPI.getMapper().getBounds(); } model.useBounds = false; return []; };
// Description: // Return the actual vtkCoordinate reference that the mapper should use // to position the actor. This is used internally by the mappers and should // be overridden in specialized subclasses and otherwise ignored. publicAPI.getActualPositionCoordinate = () => model.positionCoordinate; publicAPI.getActualPositionCoordinate2 = () => model.positionCoordinate2; }