From: apo Date: Fri, 30 Nov 2007 14:54:13 +0000 (+0000) Subject: To use more convinent VTK interactor style X-Git-Tag: mergefrom_MERGE_MULTIPR_EVOLUTION_07-Dec-07~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd87aa782af2b15b5a4bf3cb61059a4dcd686ef5;p=modules%2Fvisu.git To use more convinent VTK interactor style --- 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; } }