X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaVtk%2FvtkTensorsVisu.cpp;h=9a535195eb1666e548a0173ae90c2bf13490e4c3;hb=3582c0f9b8380fde739856aa6a188da3262cf03b;hp=f1a73ec92eb835c40dd4697fd3f583a5ce349131;hpb=ef9f90810fcc3800acac54a104f14ff505135fd3;p=creaVtk.git diff --git a/lib/creaVtk/vtkTensorsVisu.cpp b/lib/creaVtk/vtkTensorsVisu.cpp index f1a73ec..9a53519 100644 --- a/lib/creaVtk/vtkTensorsVisu.cpp +++ b/lib/creaVtk/vtkTensorsVisu.cpp @@ -35,12 +35,12 @@ vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase() { ss = vtkSphereSource::New(); - superquadratic = vtkSuperquadricSource::New(); + superquadratic = vtkSuperquadricSource::New(); cs = vtkCubeSource::New(); tg = vtkTensorGlyph::New(); - pdn = vtkPolyDataNormals::New(); + pdn = vtkPolyDataNormals::New(); pd = vtkPolyData::New(); - pod = vtkPointData::New(); + pod = vtkPointData::New(); } //------------------------------------------------------------------------ @@ -61,18 +61,21 @@ void vtkTensorsVisu::Process() #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 } @@ -94,7 +97,9 @@ void vtkTensorsVisu::Process() _pdm->SetInput( pdn->GetOutput() ); #else pdn->SetInputData(tg->GetOutput()); + pdn->Update(); _pdm->SetInputData( pdn->GetOutput() ); + _pdm->Update(); #endif _actor->SetMapper( _pdm ); _actor->GetProperty()->SetOpacity( GetOpacity() ); @@ -130,8 +135,10 @@ void vtkTensorsVisu::Process() vtkIdType numSourcePts; // vtkIdType numSourceCells; - vtkPoints *sourcePts = tg->GetSource()->GetPoints(); - numSourcePts = sourcePts->GetNumberOfPoints(); + vtkPoints *sourcePts = tg->GetSource()->GetPoints(); + + + numSourcePts = sourcePts->GetNumberOfPoints(); // numSourceCells = tg->GetSource()->GetNumberOfCells(); vtkDataArray *tensorsArray = pointdata_do->GetArray("tensors"); @@ -140,7 +147,7 @@ void vtkTensorsVisu::Process() vtkDoubleArray *newScalarArray = vtkDoubleArray::New(); newScalarArray->SetName( "NormalsEED" ); newScalarArray->SetNumberOfComponents(3); - int iNumPts,iNumSourcePts; + int iNumPts,iNumSourcePts; int iNormalsEED=0; double *normalValue; double sumEigenvalue,sumEigenvalue1,sumEigenvalue2,sumEigenvalue3; @@ -149,9 +156,9 @@ void vtkTensorsVisu::Process() for (iNumPts=0;iNumPtsGetTuple9(iNumPts); - sumEigenvalue1 = sqrt (normalValue[0]*normalValue[0] + normalValue[1]*normalValue[1] + normalValue[2]*normalValue[2]); - sumEigenvalue2 = sqrt (normalValue[3]*normalValue[3] + normalValue[4]*normalValue[4] + normalValue[5]*normalValue[5]); - sumEigenvalue3 = sqrt (normalValue[6]*normalValue[6] + normalValue[7]*normalValue[7] + normalValue[8]*normalValue[8]); + sumEigenvalue1 = sqrt (normalValue[0]*normalValue[0] + normalValue[1]*normalValue[1] + normalValue[2]*normalValue[2]); + sumEigenvalue2 = sqrt (normalValue[3]*normalValue[3] + normalValue[4]*normalValue[4] + normalValue[5]*normalValue[5]); + sumEigenvalue3 = sqrt (normalValue[6]*normalValue[6] + normalValue[7]*normalValue[7] + normalValue[8]*normalValue[8]); if ((sumEigenvalue1>=sumEigenvalue2) && (sumEigenvalue1>=sumEigenvalue3)) { @@ -181,14 +188,14 @@ void vtkTensorsVisu::Process() } // for iNumSourcePts } // for iNumPts + + pointdata_tg->RemoveArray( "NormalsEED" ); pointdata_tg->AddArray( newScalarArray ); // pointdata_pdn->Update(); tg->Update(); } // if tensorsArray - - _pdm->ScalarVisibilityOn(); _pdm->SetColorModeToMapScalars(); //_pdm->SetColorModeToDefault(); @@ -202,6 +209,12 @@ void vtkTensorsVisu::Process() _pdm->SetLookupTable( _LutEED ); _pdm->SelectColorArray( "NormalsEED" ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + //... +#else + _pdm->Update(); +#endif /* int i,sizeDa = pointdata_tg->GetNumberOfArrays(); @@ -214,11 +227,7 @@ void vtkTensorsVisu::Process() } */ - - } // _active - - VisibilityActor(); - + VisibilityActor(); }