[vtkusers] :( about picking...
alletto at dei.unipd.it
alletto at dei.unipd.it
Sat May 22 14:11:24 EDT 2004
Hi all,
I have modified the example cone6.cxx by
adding 4 lines of code... but it does'nt work well..
nothing happens..
Why? Does anybody know anything about it?
#include "vtkConeSource.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCamera.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkCommand.h"
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkIoStream.h"
#include "vtkPointPicker.h"
class vtkMyCallback : public vtkCommand
{
public:
static vtkMyCallback *New()
{ return new vtkMyCallback; }
void Delete()
{ delete this; }
virtual void Execute(vtkObject *caller, unsigned long, void*)
{
cout << "ok?";
//vtkTransform *t = vtkTransform::New();
//vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
//widget->GetTransform(t);
//widget->GetProp3D()->SetUserTransform(t);
}
};
int main( int argc, char *argv[] )
{
vtkConeSource *cone = vtkConeSource::New();
cone->SetHeight( 3.0 );
cone->SetRadius( 1.0 );
cone->SetResolution( 10 );
vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInput( cone->GetOutput() );
vtkActor *coneActor = vtkActor::New();
coneActor->SetMapper( coneMapper );
vtkRenderer *ren1= vtkRenderer::New();
ren1->AddActor( coneActor );
ren1->SetBackground( 0.1, 0.2, 0.4 );
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer( ren1 );
renWin->SetSize( 300, 300 );
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkInteractorStyleTrackballCamera *style =
vtkInteractorStyleTrackballCamera::New();
iren->SetInteractorStyle(style);
vtkPointPicker *picker = vtkPointPicker::New(); //here...
vtkMyCallback *callback = vtkMyCallback::New();
iren->SetPicker(picker);
iren->AddObserver(vtkCommand::EndPickEvent, callback);
iren->Initialize();
iren->Start();
cone->Delete();
callback->Delete();
ren1->Delete();
renWin->Delete();
iren->Delete();
picker->Delete();
style->Delete();
return 0;
}
Thanks a lot.
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
More information about the vtkusers
mailing list