ss = vtkSphereSource::New();
superquadratic = vtkSuperquadricSource::New();
cs = vtkCubeSource::New();
- tg = vtkTensorGlyph::New();
+
+ tg = NULL;
+
pdn = vtkPolyDataNormals::New();
pd = vtkPolyData::New();
pod = vtkPointData::New();
//------------------------------------------------------------------------
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
}
// 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
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();
#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();
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();
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)
{
tg->Update();
} // if tensorsArray
-
-
-
-
-printf("EED vtkTensorsVisu::Process() 3\n");
-
_pdm->ScalarVisibilityOn();
_pdm->SetColorModeToMapScalars();
//_pdm->SetColorModeToDefault();
}
*/
-
-
} // _active
-printf("EED vtkTensorsVisu::Process() 4\n");
-
- VisibilityActor();
-
-printf("EED vtkTensorsVisu::Process() END\n");
-
-
+ VisibilityActor();
}