[vtkusers] Was vtkWidgetSet never finished...?

James Johnston JamesJ at motionview3d.com
Mon Dec 17 16:53:31 EST 2012


Hi,

Was vtkWidgetSet never finished?  Tracing file history in Git shows that
nothing substantial has been modified in it ever since the first commit that
created it in the first place, 4 - 5 years ago.  My reason for concern is
that vtkWidgetSet seems very closely coupled to vtkParallelopipedWidget and
is not usable with any other kind of widget - which seems to greatly limit
the scope of the class far beyond what the original author seemed to intend.

1.  The vtkWidgetSet.cxx implementation file contains the following:

#include "vtkParallelopipedWidget.h" // REMOVE

I do not know why this "generic" class should be including any very specific
header file other than widget base class headers.  This seems clear since
the original author left the "// REMOVE" comment.

2.  The vtkWidgetSet::AddWidget implementation contains the following:

  // TODO : Won't be necessary if we move this to the AbstractWidget..
superclass
  static_cast<vtkParallelopipedWidget*>(w)->WidgetSet = this;

The code is again suggestive that the original implementation was never
finished.  In this case, the code ensures that any program attempting to use
vtkWidgetSet with any other kind of widget will corrupt the widgets memory
and eventually crash the program.

3.  The vtkWidgetSet::RemoveWidget implementation again contains the
following:

      static_cast<vtkParallelopipedWidget*>(w)->WidgetSet = NULL;

similar problems as noted in #2

4.  The vtkParallelopipedWidget class declares that vtkWidgetSet is a friend
class - again, creating what appears to be poor coupling:

  friend class vtkWidgetSet;

The reason I would like to use this class, of course, is to "share" widgets
across renderers.  But I'm not using vtkParallelopipedWidget.

Best regards,

James Johnston





More information about the vtkusers mailing list