[vtkusers] vtkObject.toString() for java

Steve M. Robbins steven.robbins at videotron.ca
Sun Feb 20 02:12:13 EST 2005


Hello java-vtk-users

On Wed, Feb 16, 2005 at 02:40:22PM -0500, David Marshburn wrote:

> to be honest, steve, i saw your message and thought, "yep, that's a known 
> bug."  sorry if the lack of response left you thinking no one was using 
> vtk44 w/java.

I'm heartened to hear that we're not alone in using vtk with java.

I wonder if other java/vtk users have an opinion on implementing the
toString() method.  The patch below implements the toString() method
on vtkObjects such that it returns the result of Print().  Does that
seem reasonable?

-Steve

Index: Wrapping/vtkParseJava.c
===================================================================
RCS file: /cvsroot/VTK/VTK/Wrapping/vtkParseJava.c,v
retrieving revision 1.30
diff -u -b -B -r1.30 vtkParseJava.c
--- Wrapping/vtkParseJava.c	14 Nov 2003 20:43:38 -0000	1.30
+++ Wrapping/vtkParseJava.c	20 Feb 2005 07:05:28 -0000
@@ -493,6 +493,7 @@
     fprintf(fp,"  public native String Print();\n");
     /* Add the PrintRevisions method to vtkObject. */
     fprintf(fp,"  public native String PrintRevisions();\n");
+    fprintf(fp,"  public String toString() { return Print(); }\n");
     }
 
   if (!strcmp("vtkObject",data->ClassName))




More information about the vtkusers mailing list