As part of our future roadmap for VTK, we are planning to upgrade the VTK widgets framework to better support applications in managing and synchronizing widgets and their properties. This mainly includes synchronization of widgets and their corresponding representations across multiple viewports (vtkRenderer) and render windows (vtkRenderWindow). This is a very common use case for multi-view / multi-window applications that display widgets and annotations across multiple views. Current VTK widget classes are not designed to explicitly support this use case. As an extension of this effort, we also plan to introduce a higher level widget management structure to simplify the construction and management of widgets in an application.
State synchronization for representing widgets across multiple views
We plan to introduce a set of widget state classes (e.g. vtkLineWidgetState) that can be used to synchronize widget states across multiple views. Multiple widgets that wish to share state with each other will essentially point to the same state object as their model.
Simplifying widget instantiation and management
Instantiating and adding specific widgets to a renderer often requires understanding multiple classes and how they interconnect, for example, knowing about the multiple 2D / 3D representations and corresponding widget classes. There are multiple widgets serving similar functionality such as vtkLineWidget, vtkLineWidget2, and vtkMultilineWidget. We plan to introduce a vtkWidgetManager class (similar to what is implemented in vtk-js: https://kitware.github.io/vtk-js/docs/develop_widget.html) that will manage the life cycle of a widget and support synchronization of properties. The vtkWidgetManager will support pre-built recipes for the common use cases for widgets to simplify this process of choosing which classes to instantiate and which representations to use for common use cases. The utility of the widget manager could be extended further to features such as setting the current “in-focus” widget that will grab all interaction events (similar to vtk-js).
We would like to receive ideas and suggestions from the community within the scope of the above mentioned task.
References
-
vtk-js widget concept: https://kitware.github.io/vtk-js/docs/concepts_widgets.html
-
vtk-js develop widgets: https://kitware.github.io/vtk-js/docs/develop_widget.html
-
Widget Manager Trame: https://github.com/Kitware/trame-vtk/blob/master/examples/widgets/clip.py
