From: Eduardo DAVILA Date: Fri, 10 Sep 2021 13:12:29 +0000 (+0200) Subject: #3470 merge vtk8itk5wx3-mingw64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8b897e95b16fec9d4da9e687b750101f6f16e173;p=creaVtk.git #3470 merge vtk8itk5wx3-mingw64 --- 8b897e95b16fec9d4da9e687b750101f6f16e173 diff --cc lib/creaVtk/vtkVectorsVisu.cpp index 7fe9861,248420a..51392f7 --- a/lib/creaVtk/vtkVectorsVisu.cpp +++ b/lib/creaVtk/vtkVectorsVisu.cpp @@@ -62,79 -102,172 +102,199 @@@ vtkVectorsVisu::~vtkVectorsVisu( //------------------------------------------------------------------------------ void vtkVectorsVisu::Process() { + 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(_active==true) { - #if VTK_MAJOR_VERSION <= 5 - _vtkglyph->SetInput( GetDataObject() ); - #else - _vtkglyph->SetInputData( GetDataObject() ); - #endif - if(GetTypeForm()==1) // source Arrow + + if (GetDataObject()!=NULL) + { + #if VTK_MAJOR_VERSION <= 5 + _vtkglyph->SetInput( GetDataObject() ); + #else + _vtkglyph->SetInputData( GetDataObject() ); + #endif + if(GetTypeForm()==1) // source Arrow + { + #if VTK_MAJOR_VERSION <= 5 + _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); + #else + _vtkarrowsource->Update(); + _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() ); + #endif + } else { // source Line + #if VTK_MAJOR_VERSION <= 5 + _vtkglyph->SetSource( _vtklineGlyphPolyData ); + #else + _vtkglyph->SetSourceData( _vtklineGlyphPolyData ); + #endif + } + _vtkglyph->SetScaleModeToScaleByVector(); + + + if (_externalLut==NULL) { - #if VTK_MAJOR_VERSION <= 5 - _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); - #else - _vtkarrowsource->Update(); - _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() ); - #endif - } else { // source Line - #if VTK_MAJOR_VERSION <= 5 - _vtkglyph->SetSource( _vtklinesource->GetOutput() ); - #else - _vtklinesource->Update(); - _vtkglyph->SetSourceData( _vtklinesource->GetOutput() ); - #endif - } - _vtkglyph->SetScaleModeToScaleByVector(); - _vtkglyph->SetColorModeToColorByVector(); - _vtkglyph->SetScaleFactor( GetScaleFactor() ); - _vtkglyph->Update(); + _vtkglyph->SetColorModeToColorByVector(); + } else { + _vtkglyph->SetColorModeToColorByScalar(); + } // if _externalLut - #if VTK_MAJOR_VERSION <= 5 - _pdm->SetInput( _vtkglyph->GetOutput()); - #else - _pdm->SetInputData( _vtkglyph->GetOutput()); - #endif + _vtkglyph->SetScaleFactor( GetScaleFactor() ); + _vtkglyph->Update(); - vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); - //printf("EED -------------------------------------------\n"); - //_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); - } + #if VTK_MAJOR_VERSION <= 5 + _pdm->SetInput( _vtkglyph->GetOutput()); + #else + _pdm->SetInputData( _vtkglyph->GetOutput()); + #endif + + vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); + //printf("EED -------------------------------------------\n"); + //_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); + //} + + if (_externalLut==NULL) + { + _pdm->ScalarVisibilityOn(); + _pdm->SetColorModeToMapScalars(); + // _pdm->SetColorModeToDefault(); + // _pdm->SetColorModeToDirectScalars(); // NOT compile + _pdm->SetScalarModeToUsePointFieldData(); + // _pdm->ImmediateModeRenderingOn(); // obsolete + _LutEED->SetVectorModeToComponent(); + //_LutEED->SetVectorModeToRGBColors(); + //_LutEED->SetVectorModeToMagnitud(); + // _pdm->SetScalarModeToUsePointFieldData(); + _pdm->SetLookupTable( _LutEED ); + _pdm->SelectColorArray( "GlyphVector" ); + } else { + data->SetActiveScalars("angle"); + + _pdm->ScalarVisibilityOn(); + double scalarRange[2]; + scalarRange[0]=0; + scalarRange[1]=40; + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + _pdm->SetScalarRange(scalarRange); + _pdm->SetColorModeToMapScalars(); + // _pdm->SetColorModeToDefault(); + // _pdm->SetColorModeToDirectScalars(); // NOT compile + // _pdm->SetScalarModeToUsePointFieldData(); + // _pdm->ImmediateModeRenderingOn(); // obsolete + _pdm->SetLookupTable( _externalLut ); + _pdm->SelectColorArray( "angle" ); + } // if _externalLut + + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + + /* + _vtkglyph->Update(); + vtkPointData *pointdata=_vtkglyph->GetOutput()->GetPointData(); + int i,size=pointdata->GetNumberOfArrays(); + for (i=0;iGetArray(i); + printf(" vtkVectorsVisu::Process array name %d:<%s> size:%d\n", i, array->GetName(), array->GetSize() ); + } + */ + + + // vSliceMapperVec->SetLookupTable( vGreenToRedLut ); + // vSliceMapperVec->SetColorModeToMapScalars(); + + #if VTK_MAJOR_VERSION <= 5 + // .. + #else + _pdm->Update(); + #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() ); + } else { + printf("EED Warnning! vtkVectorsVisu::Process GetDataObject() is EMPTY\n"); + }// if GetDataObject()!=NULL + _pdm->ScalarVisibilityOn(); + _pdm->SetColorModeToMapScalars(); + //_pdm->SetColorModeToDefault(); + // _pdm->SetColorModeToDirectScalars(); // NOT compile + _pdm->SetScalarModeToUsePointFieldData(); + +//EED2021-09-03 Deprecated. Removed in vtk 8.1 +// _pdm->ImmediateModeRenderingOn(); + + _LutEED->SetVectorModeToComponent(); + //_LutEED->SetVectorModeToRGBColors(); + //_LutEED->SetVectorModeToMagnitud(); + +// _pdm->SetScalarModeToUsePointFieldData(); + _pdm->SetLookupTable( _LutEED ); + _pdm->SelectColorArray( "GlyphVector" ); + +// vSliceMapperVec->SetLookupTable( vGreenToRedLut ); +// vSliceMapperVec->SetColorModeToMapScalars(); + +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + _pdm->Update(); +#endif + _actor->SetMapper( _pdm ); + _actor->GetProperty()->SetOpacity( GetOpacity() ); - }// if _active + } else { + _vtkglyph->SetInputData( NULL ); + _vtkglyph->Update(); + }// if _active VisibilityActor(); }