[vtkusers] vtk and Java : problem when remove a vtkactor to avtkrenderer or add avtkrenderer to a vtkrenderwindow

Romain Ollivier Romain.Ollivier at sophia.inria.fr
Wed Jul 9 08:53:34 EDT 2003


  I use now the Lock() and UnLock() methods only to remove an actor, not to add it and now
things are working well :)

  Thank you again for your help

       Romain

Jeff Lee wrote:

> see below...
>
> Romain Ollivier wrote:
>
> >For my viewer, I use the class myVtkPanel wich extends vtkPanel with :
> >
> >  public void removeActor(vtkProp actor)
> >  {
> >    Lock();
> >    ren.RemoveActor(actor);
> >    UnLock();
> >  }
> >
> >  public void addActor(vtkProp actor)
> >  {
> >    Lock();
> >    ren.AddActor(actor);
> >    UnLock();
> >  }
> >
> >Then, I have a myVtkJPanel class, wich extends a JPanel, containing this :
> >
> >........
> >  private myVtkPanel view;
> >........
> >  public void addActor(vtkProp actor)
> >  {
> >    view.addActor(actor);
> >  }
> >
> >  public void removeActor(vtkProp actor)
> >  {
> >    view.removeActor(actor);
> >  }
> >
> >
> > My viewer use an instance of this JPanel. When I call the addActor() function in my viewer
> >constructor, I get this :
> >
> >Exception in thread "main" java.lang.IllegalMonitorStateException: current thread not owner
> >        at vtk.vtkPanel.UnLock(Native Method)
> >        at myVtkPanel.addActor(myVtkPanel.java:33)
> >        at myVtkJPanel.addActor(myVtkJPanel.java:82)
> >        at myViewer.makeDataPanel(myViewer.java:86)
> >        at myViewer.<init>(myViewer.java:62)
> >        at myViewer.main(myViewer.java:190)
> >
> >Do you know what I'm doing wrong when I use Lock() an UnLock() ?
> >
> tough to say without seeing the whole code, but I'd guess that you are
> trying to add the actor before the drawing surface has been created.
> there is no need to lock in your addActor method anyway - take it out.
> also be careful of doing things like that in a constructor unless you
> are sure that the canvas has gone through its proper initialization.
> -Jeff
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list