From bd87aa782af2b15b5a4bf3cb61059a4dcd686ef5 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 30 Nov 2007 14:54:13 +0000 Subject: [PATCH] To use more convinent VTK interactor style --- src/PIPELINE/VISUPipeLine.cxx | 43 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 100ad4b0..6cfa78f4 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -40,11 +40,12 @@ #include "VISU_Convertor.hxx" #include "VISU_ConvertorUtils.hxx" -typedef VISU_ScalarMapOnDeformedShapePL TPresent; +typedef VISU_ScalarMapPL TPresent; #include #include +#include #include #include #include @@ -165,12 +166,20 @@ main(int argc, char** argv) { try{ if(argc > 1){ - vtkRenderWindow *renWin = vtkRenderWindow::New(); - vtkRenderer *ren = vtkRenderer::New(); - renWin->AddRenderer(ren); - ren->GetActiveCamera()->ParallelProjectionOn(); - vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); - iren->SetRenderWindow(renWin); + vtkRenderWindow *aWindow = vtkRenderWindow::New(); + vtkRenderer *aRenderer = vtkRenderer::New(); + + aWindow->AddRenderer(aRenderer); + aRenderer->GetActiveCamera()->ParallelProjectionOn(); + + vtkRenderWindowInteractor *anInteractor = vtkRenderWindowInteractor::New(); + anInteractor->SetRenderWindow(aWindow); + aWindow->Delete(); + + vtkInteractorStyle* aStyle = vtkInteractorStyleTrackballCamera::New(); + anInteractor->SetInteractorStyle(aStyle); + aStyle->Delete(); + VISU_Convertor* aConvertor = CreateConvertor(argv[1]); aConvertor->BuildEntities(); aConvertor->BuildGroups(); @@ -196,12 +205,12 @@ main(int argc, char** argv) vtkActor* aActor = vtkActor::New(); aActor->SetMapper(aPresent->GetMapper()); aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME); - //ren->ResetCameraClippingRange(); + //aRenderer->ResetCameraClippingRange(); - ren->AddActor(aActor); + aRenderer->AddActor(aActor); - renWin->Render(); - iren->Start(); + aWindow->Render(); + anInteractor->Start(); return 0; } //Import fields @@ -223,13 +232,13 @@ main(int argc, char** argv) VISU_ColoredPL* aPresent = NULL; if(anEntity != VISU::NODE_ENTITY){ + continue; aPresent = CreateColoredPL(aConvertor, aMeshName, anEntity, aFieldName, aTimeStamp); }else{ - continue; aPresent = CreateColoredPL(aConvertor, aMeshName, anEntity, @@ -243,13 +252,13 @@ main(int argc, char** argv) VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New(); aScalarBar->SetLookupTable(aPresent->GetBarTable()); - ren->AddActor(anActor); - ren->AddActor2D(aScalarBar); + aRenderer->AddActor(anActor); + aRenderer->AddActor2D(aScalarBar); - renWin->Render(); - ren->ResetCamera(); + aWindow->Render(); + aRenderer->ResetCamera(); - iren->Start(); + anInteractor->Start(); return 0; } } -- 2.39.2