X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaVtk%2FvtkVectorsVisu.cpp;h=2b4128d9cb3491d86d29b000fd1adc1e838327b6;hb=6c621b712c4f3ba585d24a2ce98ddc52abb19cb9;hp=376d4036211699121b49e0d31a4b75de98b1f118;hpb=dbe9fa3941c9e891ca5fbb5e0070ac08d53d4e7a;p=creaVtk.git diff --git a/lib/creaVtk/vtkVectorsVisu.cpp b/lib/creaVtk/vtkVectorsVisu.cpp index 376d403..2b4128d 100644 --- a/lib/creaVtk/vtkVectorsVisu.cpp +++ b/lib/creaVtk/vtkVectorsVisu.cpp @@ -38,8 +38,9 @@ vtkVectorsVisu::vtkVectorsVisu() :vtkVectorsTensorsVisuBase() { _vtkarrowsource = vtkArrowSource::New(); - _vtkglyph = vtkGlyph3D::New(); - _vtklinesource = vtkLineSource::New(); + _vtkglyph = NULL; + _vtklinesource = vtkLineSource ::New(); + _trans = vtkTransform ::New(); double point1[3]; double point2[3]; @@ -64,6 +65,20 @@ void vtkVectorsVisu::Process() { if(_active==true) { + if (_vtkglyph==NULL) + { + if (GetOrientation()==-1) + { + _vtkglyph = vtkGlyph3D::New(); + } // _orientation + if ((GetOrientation()>=0) && (GetOrientation()<=2)) + { + _vtkglyph = vtkGlyph3D::New(); +// _vtkglyph = vtkGlyph2D::New(); + } // _orientation + } // _vtkglyph NULL + + #if VTK_MAJOR_VERSION <= 5 _vtkglyph->SetInput( GetDataObject() ); #else @@ -101,11 +116,11 @@ vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); //_vtkglyph->GetOutput()->Print(std::cout); //printf("EED -------------------------------------------\n"); //data->Print(std::cout); -int i,sizeDa = data->GetNumberOfArrays(); -for (i=0;iGetArray(i)->Print(std::cout); -} +//int i,sizeDa = data->GetNumberOfArrays(); +//for (i=0;iGetArray(i)->Print(std::cout); +//} _pdm->ScalarVisibilityOn(); _pdm->SetColorModeToMapScalars(); @@ -130,6 +145,34 @@ for (i=0;iUpdate(); #endif + + // Orientation -1 3D OK + + // Orientation 0 2D yz + if (GetOrientation()==0) + { + _trans->Identity(); + _trans->Translate(900,0,0); + _actor->SetUserTransform(_trans); + } + + + // Orientation 1 2D xz + if (GetOrientation()==1) + { + _trans->Identity(); + _trans->Translate(0,-900,0); + _actor->SetUserTransform(_trans); + } + + // Orientation 2 2D xy + if (GetOrientation()==2) + { + _trans->Identity(); + _trans->Translate(0,0,-900); + _actor->SetUserTransform(_trans); + } + _actor->SetMapper( _pdm ); _actor->GetProperty()->SetOpacity( GetOpacity() ); }// if _active