R: [vtkusers] vtkLODActor and mouse interaction

Massimo Ivani massimo.ivani at mlsw.com
Tue Nov 9 10:42:44 EST 2004


Ty for your Help Kenneth, but I cannot use your suggestion because I’m using
vtkCom and visual basic and I cannot handle callback functions. I tried to
use ObserveEvent function with vtkLeftButtonPressEvent as argument in renwin
object but event does not fire when I press left mouse button
 any helps???
 
Thank you
 
 
Dr. Massimo Ivani
Media Lab Software
Ph. (+39) 0187517775
Fax (+39) 0187511833
 <mailto:massimo.ivani at mlsw.com> massimo.ivani at mlsw.com
 <http://www.mlsw.com> www.mlsw.com
 <http://www.implant3d.com> www.implant3d.com
  _____  

Da: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Per conto di
Moreland, Kenneth
Inviato: martedì 9 novembre 2004 16.12
A: massimo.ivani at mlsw.com; vtkusers at vtk.org
Oggetto: RE: [vtkusers] vtkLODActor and mouse interaction
 
I can think of several ways to do this, but the most straightforward way is
probably to attach an observer to the render window start event that checks
the render windows desired update rate and sets the LOD accordingly.  The
code could look something like this (I'm free handing so apologies if I make
errors.)
 
 
// Declaration of callback function.
static void SelectLODCallback(vtkObject *__renwin, unsigned long, void
*__prop)
{
  vtkRenderWindow *renwin = static_cast<vtkRenderWindow *>(__renwin);
  vtkLODProp3D *prop = static_cast<vtkLODProp3D *>(__prop);
 
  if (renwin->GetDesiredUpdateRate() > 5.0)
    {
    // Set low LOD in prop.
    }
  else
    {
    // Set high LOD in prop.
    }
}
 
...
 
// Code to set up the observer.  Assumes renwin is a vtkRenderWindow and
prop
// is the vtkLODProp3D you want to control.
vtkCallbackCommand *cbc = vtkCallbackCommand::New();
cbc->SetClientData(prop);
cbc->SetCallback(SelectLODCallback);
renwin->AddObserver(vtkCommand::StartEvent, cbc);
cbc->Delete();    // Won't actually delete since renwin holds a reference.
 
 
That's basically be all you need.  The render window interactor holds two
update rates (DesiredUpdateRate and StillUpdateRate) and should set the
render window's DesiredUpdateRate to one of these two depending on whether
interaction is happening.
 
-Ken
 
   ****      Kenneth Moreland
    ***      Sandia National Laboratories
*********** 
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      fax:   (505) 844-0833
 
-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Massimo Ivani
Sent: Tuesday, November 09, 2004 6:57 AM
To: vtkusers at vtk.org
Subject: [vtkusers] vtkLODActor and mouse interaction
Hello vtk Users,
 
I have to show medical data using vtk. I use vtkLODProp3D to add different
LOD volume. I do not want that vtk select the LOD but I want to select
myself the LOD when I rotate, zoom or pan volume. I can select the right LOD
using SetSelectedLODID but I do not know where I can intercept mouse click
to change LOD. Can I have your help?
 
Thank you. 
 
Dr. Massimo Ivani
Media Lab Software
Ph. (+39) 0187517775
Fax (+39) 0187511833
 <mailto:massimo.ivani at mlsw.com> massimo.ivani at mlsw.com
 <http://www.mlsw.com> www.mlsw.com
 <http://www.implant3d.com> www.implant3d.com
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041109/39c2ede3/attachment.htm>


More information about the vtkusers mailing list