X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaVtk%2FvtkTensorsVisu.cpp;h=182f1d734cefcb6145d9b87b5849cceab0e3c117;hb=aeb2d4a02b09ac7fff049aad92f9ed559cbf0f47;hp=81bcef7f573aeb36caf95b38eed7f3bd24439963;hpb=ae7fdf94ccaa1c21be9e2d1a4775253a6ca08670;p=creaVtk.git diff --git a/lib/creaVtk/vtkTensorsVisu.cpp b/lib/creaVtk/vtkTensorsVisu.cpp index 81bcef7..182f1d7 100644 --- a/lib/creaVtk/vtkTensorsVisu.cpp +++ b/lib/creaVtk/vtkTensorsVisu.cpp @@ -37,7 +37,9 @@ vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase() ss = vtkSphereSource::New(); superquadratic = vtkSuperquadricSource::New(); cs = vtkCubeSource::New(); - tg = vtkTensorGlyph::New(); + + tg = NULL; + pdn = vtkPolyDataNormals::New(); pd = vtkPolyData::New(); pod = vtkPointData::New(); @@ -52,28 +54,32 @@ vtkTensorsVisu::~vtkTensorsVisu() //------------------------------------------------------------------------ void vtkTensorsVisu::Process() { -printf("EED vtkTensorsVisu::Process() start\n"); if (_active==true) { if(GetTypeForm()==2) // source superquadratic { + if (tg==NULL) { tg = vtkTensorGlyph::New(); } + superquadratic->SetThetaResolution(20); superquadratic->SetPhiResolution(20); #if VTK_MAJOR_VERSION <= 5 tg->SetSource(superquadratic->GetOutput()); #else + superquadratic->Update(); tg->SetSourceData(superquadratic->GetOutput()); #endif } else if(GetTypeForm()==1) { // source sphere #if VTK_MAJOR_VERSION <= 5 tg->SetSource(ss->GetOutput()); #else + ss->Update(); tg->SetSourceData(ss->GetOutput()); #endif } else { // source cube #if VTK_MAJOR_VERSION <= 5 tg->SetSource(cs->GetOutput()); #else + cs->Update(); tg->SetSourceData(cs->GetOutput()); #endif } @@ -87,9 +93,6 @@ printf("EED vtkTensorsVisu::Process() start\n"); // tg->SetScaling(25); tg->SetScaleFactor( GetScaleFactor() ); -printf("EED vtkTensorsVisu::Process() 1\n"); - - //The normals are needed to generate the right colors and if // not used some of the glyphs are black. //EED 2017-01-01 Migration VTK7 @@ -97,30 +100,18 @@ printf("EED vtkTensorsVisu::Process() 1\n"); pdn->SetInput(tg->GetOutput()); _pdm->SetInput( pdn->GetOutput() ); #else -printf("EED vtkTensorsVisu::Process() 1.1\n"); pdn->SetInputData(tg->GetOutput()); -printf("EED vtkTensorsVisu::Process() 1.2\n"); + pdn->Update(); _pdm->SetInputData( pdn->GetOutput() ); _pdm->Update(); #endif -printf("EED vtkTensorsVisu::Process() 1.3\n"); _actor->SetMapper( _pdm ); -printf("EED vtkTensorsVisu::Process() 1.4\n"); _actor->GetProperty()->SetOpacity( GetOpacity() ); - - - -printf("EED vtkTensorsVisu::Process() 1.5\n"); tg->SetColorModeToEigenvalues(); // tg->SetColorModeToScalars(); -printf("EED vtkTensorsVisu::Process() 1.6\n"); tg->Update(); -printf("EED vtkTensorsVisu::Process() 1.7\n"); - - - //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 pd = tg->GetOutput(); @@ -131,9 +122,7 @@ printf("EED vtkTensorsVisu::Process() 1.7\n"); #endif pod = pd->GetPointData(); -printf("EED vtkTensorsVisu::Process() 1.8\n"); pod->Update(); -printf("EED vtkTensorsVisu::Process() 1.9\n"); tg->Update(); vtkPolyData *pd_pdn = pdn->GetOutput(); @@ -142,7 +131,6 @@ printf("EED vtkTensorsVisu::Process() 1.9\n"); vtkPolyData *pd_tg = tg->GetOutput(); vtkPointData *pointdata_tg = pd_tg->GetPointData(); -printf("EED vtkTensorsVisu::Process() 1.20\n"); vtkPolyData *pd_do = (vtkPolyData*)GetDataObject(); vtkPointData *pointdata_do = pd_do->GetPointData(); @@ -151,18 +139,12 @@ printf("EED vtkTensorsVisu::Process() 1.20\n"); vtkIdType numSourcePts; // vtkIdType numSourceCells; -printf("EED vtkTensorsVisu::Process() 1.22\n"); vtkPoints *sourcePts = tg->GetSource()->GetPoints(); -printf("EED vtkTensorsVisu::Process() 1.23\n"); numSourcePts = sourcePts->GetNumberOfPoints(); // numSourceCells = tg->GetSource()->GetNumberOfCells(); - -printf("EED vtkTensorsVisu::Process() 2\n"); - - vtkDataArray *tensorsArray = pointdata_do->GetArray("tensors"); if (tensorsArray) { @@ -218,18 +200,14 @@ printf("EED vtkTensorsVisu::Process() 2\n"); tg->Update(); } // if tensorsArray - - - - -printf("EED vtkTensorsVisu::Process() 3\n"); - _pdm->ScalarVisibilityOn(); _pdm->SetColorModeToMapScalars(); //_pdm->SetColorModeToDefault(); // _pdm->SetColorModeToDirectScalars(); // NOT compile _pdm->SetScalarModeToUsePointFieldData(); - _pdm->ImmediateModeRenderingOn(); + +//EED2021-09-03 Deprecated. Removed in vtk 8.1 +// _pdm->ImmediateModeRenderingOn(); _LutEED->SetVectorModeToComponent(); //_LutEED->SetVectorModeToRGBColors(); @@ -255,15 +233,7 @@ printf("EED vtkTensorsVisu::Process() 3\n"); } */ - - } // _active -printf("EED vtkTensorsVisu::Process() 4\n"); - - VisibilityActor(); - -printf("EED vtkTensorsVisu::Process() END\n"); - - + VisibilityActor(); }