]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/vtkTensorsVisu.cpp
Merge remote-tracking branch 'origin/vtk7itk4' into vtk7itk4wx3
[creaVtk.git] / lib / creaVtk / vtkTensorsVisu.cpp
index 7d451f31699b4025d4f1f5f652de92e14f49bd51..9a535195eb1666e548a0173ae90c2bf13490e4c3 100644 (file)
 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();
 }
 
 //------------------------------------------------------------------------
@@ -52,30 +52,55 @@ vtkTensorsVisu::~vtkTensorsVisu()
 //------------------------------------------------------------------------
 void vtkTensorsVisu::Process()
 {
-printf("EED vtkTensorsVisu::Process Start\n");
-
   if (_active==true)
   {
        if(GetTypeForm()==2)                                                            // source superquadratic
        {
                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
        }
 
+#if VTK_MAJOR_VERSION <= 5
        tg->SetInput( GetDataObject() );
+#else
+       tg->SetInputData( GetDataObject() );
+#endif
        //              tg->ScalingOn();
        //              tg->SetScaling(25);
        tg->SetScaleFactor( GetScaleFactor() );
 
        //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
+#if VTK_MAJOR_VERSION <= 5
        pdn->SetInput(tg->GetOutput());
        _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() );
 
@@ -83,8 +108,15 @@ printf("EED vtkTensorsVisu::Process Start\n");
 //   tg->SetColorModeToScalars();
    tg->Update();
 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        pd = tg->GetOutput();
        pd->Update();
+#else
+       tg->Update();
+       pd = tg->GetOutput();
+#endif
+
        pod = pd->GetPointData();
        pod->Update();
 
@@ -103,8 +135,10 @@ printf("EED vtkTensorsVisu::Process Start\n");
        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");
@@ -113,7 +147,7 @@ printf("EED vtkTensorsVisu::Process Start\n");
                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;
@@ -121,10 +155,10 @@ printf("EED vtkTensorsVisu::Process Start\n");
                int      idEigen;
                for (iNumPts=0;iNumPts<numPnts;iNumPts++)
                {
-                       normalValue     = tensorsArray->GetTuple9(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]);
+                       normalValue = tensorsArray->GetTuple9(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]);
 
                        if ((sumEigenvalue1>=sumEigenvalue2) && (sumEigenvalue1>=sumEigenvalue3))
                        {
@@ -154,14 +188,14 @@ printf("EED vtkTensorsVisu::Process Start\n");
                        } // 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();
@@ -175,6 +209,12 @@ printf("EED vtkTensorsVisu::Process Start\n");
        _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();
@@ -187,12 +227,7 @@ printf("EED vtkTensorsVisu::Process Start\n");
 
                        }
 */
-
-
   } // _active
-
-    VisibilityActor(); 
-
-printf("EED vtkTensorsVisu::Process End.\n");
+  VisibilityActor(); 
 }