Skip to content

Mapper

Introduction

vtkMapper is an abstract class to specify interface between data and graphics primitives. Subclasses of vtkMapper map data through a lookuptable and control the creation of rendering primitives that interface to the graphics library. The mapping can be controlled by supplying a lookup table and specifying a scalar range to map data through.

There are several important control mechanisms affecting the behavior of this object. The ScalarVisibility flag controls whether scalar data (if any) controls the color of the associated actor(s) that refer to the mapper. The ScalarMode ivar is used to determine whether scalar point data or cell data is used to color the object. By default, point data scalars are used unless there are none, then cell scalars are used. Or you can explicitly control whether to use point or cell scalar data. Finally, the mapping of scalars through the lookup table varies depending on the setting of the ColorMode flag. See the documentation for the appropriate methods for an explanation.

Another important feature of this class is whether to use immediate mode rendering (ImmediateModeRenderingOn) or display list rendering (ImmediateModeRenderingOff). If display lists are used, a data structure is constructed (generally in the rendering library) which can then be rapidly traversed and rendered by the rendering library. The disadvantage of display lists is that they require additional memory which may affect the performance of the system.

Another important feature of the mapper is the ability to shift the Z-buffer to resolve coincident topology. For example, if you’d like to draw a mesh with some edges a different color, and the edges lie on the mesh, this feature can be useful to get nice looking lines. (See the ResolveCoincidentTopology-related methods.)

Methods

acquireInvertibleLookupTable

clearInvertibleColor

colorToValue

extend

Method used to decorate a given object (publicAPI+model) with vtkMapper characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIMapperInitialValuesNo(default: {})

getBounds

Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].

getCustomShaderAttributes

getIsOpaque

Check if the mapper does not expect to have translucent geometry. This may happen when using ColorMode is set to not map scalars i.e. render the scalar array directly as colors and the scalar array has opacity i.e. alpha component. Default implementation simply returns true. Note that even if this method returns true, an actor may treat the geometry as translucent since a constant translucency is set on the property, for example.

getPopulateSelectionSettings

Get whether selection ID mappings should be populated.

getPrimitiveCount

getRenderTime

Get the time required for the last render.

getSelectionWebGLIdsToVTKIds

Get the mapping from WebGL selection IDs to VTK point and cell IDs.

getStatic

Check whether the mapper’s data is static.

getViewSpecificProperties

newInstance

Method used to create a new instance of vtkMapper

ArgumentTypeRequiredDescription
initialValuesIMapperInitialValuesNofor pre-setting some of its content

processSelectorPixelBuffers

Convert selector pixel buffers from WebGL IDs to VTK IDs.

setCustomShaderAttributes

Sets point data array names that will be transferred to the VBO

ArgumentTypeRequiredDescription
customShaderAttributesArray[String]Yes

setForceCompileOnly

ArgumentTypeRequiredDescription
forceCompileOnlyNumberYes

setPopulateSelectionSettings

Set whether selection ID mappings should be populated.

setRenderTime

Set the time required for the last render.

setSelectionWebGLIdsToVTKIds

Set the mapping from WebGL selection IDs to VTK point and cell IDs.

setStatic

Turn on/off flag to control whether the mapper’s data is static. Static data means that the mapper does not propagate updates down the pipeline, greatly decreasing the time it takes to update many mappers. This should only be used if the data never changes.

ArgumentTypeRequiredDescription
staticBooleanYes

setViewSpecificProperties

If you want to provide specific properties for rendering engines you can use viewSpecificProperties.

You can go and have a look in the rendering backend of your choice for details on specific properties. For example, for OpenGL/WebGL see OpenGL/PolyDataMapper/api.md If there is no details, viewSpecificProperties is not supported.

ArgumentTypeRequiredDescription
viewSpecificPropertiesYes

useInvertibleColorFor

valueToColor