[vtkusers] vtkLODActor and mouse interaction
Moreland, Kenneth
kmorel at sandia.gov
Tue Nov 9 10:12:11 EST 2004
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
massimo.ivani at mlsw.com <mailto:massimo.ivani at mlsw.com>
www.mlsw.com <http://www.mlsw.com>
www.implant3d.com <http://www.implant3d.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041109/447337d2/attachment.htm>
More information about the vtkusers
mailing list