02.05.2013 Views

Primjena biblioteke VTK u vizualizaciji znanstvenih podataka - Pmf

Primjena biblioteke VTK u vizualizaciji znanstvenih podataka - Pmf

Primjena biblioteke VTK u vizualizaciji znanstvenih podataka - Pmf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

scalarBar->SetTextPositionToPrecedeScalarBar();<br />

ren->AddActor(scalarBar);<br />

scalarBar->Delete();<br />

scalarColor->Delete();<br />

//render window<br />

vtkRenderWindow *renWin = vtkRenderWindow::New();<br />

renWin->AddRenderer(ren);<br />

renWin->SetSize(800, 600);<br />

ren->Delete();<br />

//window interactor<br />

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br />

iren->SetRenderWindow(renWin);<br />

vtkInteractorStyleTrackballCamera *style=<br />

vtkInteractorStyleTrackballCamera::New();<br />

iren->SetInteractorStyle(style);<br />

style->Delete();<br />

vtkImplicitPlaneWidget *planeWidget=vtkImplicitPlaneWidget::New();<br />

if(command->isCut())<br />

{<br />

//plane widget<br />

planeWidget->SetInteractor(iren);<br />

planeWidget->SetPlaceFactor(1.01);<br />

planeWidget->DrawPlaneOff();<br />

planeWidget->GetOutlineProperty()->SetColor(0,0,0);<br />

planeWidget->OutlineTranslationOff();<br />

planeWidget->PlaceWidget(dataBounds);<br />

planeWidget->SetOrigin(reader->GetOutput()->GetCenter());<br />

planeWidget->GetPlane(plane);<br />

planeWidget->EnabledOn();<br />

vtkMyCallback *mc=vtkMyCallback::New();<br />

mc->setPlane(plane);<br />

mc->setWidget(planeWidget);<br />

planeWidget->AddObserver(vtkCommand::InteractionEvent, mc);<br />

//text - podaci o ravnini<br />

vtkTextActor *text=vtkTextActor::New();<br />

mc->setText(text);<br />

text->GetTextProperty()->SetColor(0,0,0);<br />

text->GetTextProperty()->SetFontFamilyToCourier();<br />

text->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();<br />

text->GetPositionCoordinate()->SetValue(0.01, 0.02);<br />

ren->AddActor(text);<br />

text->Delete();<br />

mc->Delete();<br />

}<br />

reader->Delete();<br />

iren->Initialize();<br />

std::string name;<br />

39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!