]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/vtkTensorsVisu.cpp
#2501 creaVtk Bug New Normal - Clean events in Vectors and Tensors visu widgets...
[creaVtk.git] / lib / creaVtk / vtkTensorsVisu.cpp
index 53f55174ca22e1b81b76a2a52bdaa8bae0bc21fe..7f6fe1584f133499c230ca9d2ca550bebccbcc73 100644 (file)
 //------------------------------------------------------------------------
 vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase()
 {
-       ss              = vtkSphereSource::New();
-       cs              = vtkCubeSource::New(); 
-       tg              = vtkTensorGlyph::New();
-       pdn             = vtkPolyDataNormals::New();
-       pd              = vtkPolyData::New();
-       pod             = vtkPointData::New();
+       ss                                      = vtkSphereSource::New();
+       superquadratic  = vtkSuperquadricSource::New();
+       cs                                      = vtkCubeSource::New(); 
+       tg                                      = vtkTensorGlyph::New();
+       pdn                                     = vtkPolyDataNormals::New();
+       pd                                      = vtkPolyData::New();
+       pod                                     = vtkPointData::New();
 }
 
 //------------------------------------------------------------------------
@@ -51,18 +52,18 @@ void vtkTensorsVisu::Process()
 {
 printf("EED vtkTensorsVisu::Process Start\n");
 
-
-  if (_active==true){
-        std::string source="sphere";
-       if(source=="sphere")
-       {
-               tg->SetSource(ss->GetOutput());
-       }
-       else if(source=="cube")
+  if (_active==true)
+  {
+       if(GetTypeForm()==2)                                                            // source superquadratic
        {
+               superquadratic->SetThetaResolution(20);
+               superquadratic->SetPhiResolution(20);
+               tg->SetSource(superquadratic->GetOutput());
+       } else if(GetTypeForm()==1) {                                   // source sphere
                tg->SetSource(ss->GetOutput());
+       } else {                                                                                                // source cube
+               tg->SetSource(cs->GetOutput());         
        }
-       else{}
 
 
        tg->SetInput( GetDataObject() );
@@ -108,26 +109,26 @@ printf("EED vtkTensorsVisu::Process Start\n");
        _pdm->SetInput( pdn->GetOutput() );
        _pdm->ImmediateModeRenderingOn();
 
-         _pdm->ScalarVisibilityOn();
-         _pdm->SetScalarModeToUsePointFieldData();
+   _pdm->ScalarVisibilityOn();
+   _pdm->SetScalarModeToUsePointFieldData();
 
 
 //EED  _pdm->Update();
 
        _actor->SetMapper( _pdm );
-        _actor->GetProperty()->SetOpacity( GetOpacity() );
+   _actor->GetProperty()->SetOpacity( GetOpacity() );
 
        tg->ColorGlyphsOn();
-       tg->ExtractEigenvaluesOn();
+//     tg->ExtractEigenvaluesOn();
        tg->SetColorModeToEigenvalues();
 
-        _pdm->SetLookupTable( _LutEED );
-         _pdm->SelectColorArray( "Normals" );
+       _pdm->SetLookupTable( _LutEED );
+   _pdm->SelectColorArray( "Normals" );
 
 
        //int tcg = tg->GetColorGlyphs();
 //     tg->SetColorGlyphs(10);
-       //tg->SetColorModeToScalars();
+//     tg->SetColorModeToScalars();
        //tg->ThreeGlyphsOn();
 
 
@@ -145,16 +146,49 @@ printf("EED vtkTensorsVisu::Process Start\n");
 //EED  _pdm->Update(); 
 
 
+//EED1                 tg->Print( std::cout );
+//EED1         printf("EED vtkTensorsVisu::Process  ------------------------------------------\n");
+//EED1                 pd->Print( std::cout );
+
 
        tg->Update();
                        vtkPolyData     *pd             = pdn->GetOutput();
                        vtkPointData    *pointdata      = pd->GetPointData();
+
+
+//EED1         printf("EED vtkTensorsVisu::Process  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx\n");
+//EED1                 pointdata->Print( std::cout );
                        
+
+                       int aa = pd->GetNumberOfPieces ();
+                       int bb = pd->GetNumberOfVerts ();
+                       int cc = pd->GetNumberOfLines ();
+                       int dd = pd->GetNumberOfPolys ();
+                       int ee = pd->GetNumberOfStrips ();
+                       int ff = pd->GetNumberOfCells();
+
+               printf("EED vtkTensorsVisu::Process  %d %d %d %d %d %d \n", aa,bb,cc,dd,ee,ff);
+
+                       vtkPolyData *ttt = (vtkPolyData *)GetDataObject();
+                       int numPnts = ttt->GetNumberOfPoints();
+                       printf("EED vtkTensorsVisu::Process  numPnts %d \n", numPnts );
+
+
+                       vtkIdType numSourcePts, numSourceCells;
+                       vtkPoints *sourcePts;
+                       sourcePts = tg->GetSource()->GetPoints();
+                       numSourcePts = sourcePts->GetNumberOfPoints();
+                       numSourceCells = tg->GetSource()->GetNumberOfCells();
+                       printf("EED vtkTensorsVisu::Process  numSourcePts %d   numSourceCells %d\n", numSourcePts, numSourceCells);
+
+
+
                        int i,sizeDa = pointdata->GetNumberOfArrays();
                        printf("EED vtkTensorsVisu::Process  sizeDa %d \n", sizeDa );
                        for (i=0;i<sizeDa;i++)
                        {
-                               printf("EED vtkTensorsVisu::Process-name %d, %s, size=%d \n", i, pointdata->GetArrayName(i) , pointdata->GetArray(i)->GetSize() );
+                               int faces = pointdata->GetArray(i)->GetSize() / numPnts;
+                               printf("EED vtkTensorsVisu::Process-name %d, %s, size=%d   %d \n", i, pointdata->GetArrayName(i) , pointdata->GetArray(i)->GetSize(), faces );
                        }