From: Eduardo DAVILA Date: Fri, 29 Dec 2017 14:10:10 +0000 (+0100) Subject: #3100 creaVtk Feature New Normal - Vectors Visu refresh X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a342cde9f80ff07e8ec22e555a5bf6d1b72752d8;p=creaVtk.git #3100 creaVtk Feature New Normal - Vectors Visu refresh --- diff --git a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp index ee7fc49..5f6eeed 100644 --- a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp +++ b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp @@ -196,21 +196,21 @@ void vtkLookupTableDirectionVector::PrintSelf(ostream& os, vtkIndent indent) vtkVectorsTensorsVisuBase::vtkVectorsTensorsVisuBase() { - _firsttime = true; + _firsttime = true; _active = false; _scalefactor= 1; - _opacity = 1; + _opacity = 1; _dataobject = NULL; _renderer = NULL; - _typeForm = 0; + _typeForm = 0; _LutEED = vtkLookupTableDirectionVector::New(); -// _LutEED->SetVectorMode(0); -//_LutEED->SetVectorModeToMagnitude(); -//_LutEED->SetVectorModeToComponent(); -_LutEED->SetVectorModeToRGBColors(); + //_LutEED->SetVectorMode(0); + //_LutEED->SetVectorModeToMagnitude(); + //_LutEED->SetVectorModeToComponent(); + _LutEED->SetVectorModeToRGBColors(); - _pdm = vtkPolyDataMapper::New(); + _pdm = vtkPolyDataMapper::New(); _actor = vtkActor::New(); _actorAdded = false; } diff --git a/lib/creaVtk/vtkVectorsVisu.cpp b/lib/creaVtk/vtkVectorsVisu.cpp index af6fe0d..5b50b2a 100644 --- a/lib/creaVtk/vtkVectorsVisu.cpp +++ b/lib/creaVtk/vtkVectorsVisu.cpp @@ -37,9 +37,20 @@ vtkVectorsVisu::vtkVectorsVisu() :vtkVectorsTensorsVisuBase() { - _vtkarrowsource = vtkArrowSource::New(); - _vtklinesource = vtkLineSource::New(); + _vtkarrowsource = vtkArrowSource::New(); _vtkglyph = vtkGlyph3D::New(); + _vtklinesource = vtkLineSource::New(); + + double point1[3]; + double point2[3]; + point1[0]=1; + point1[1]=0; + point1[2]=0; + point2[0]=-1; + point2[1]=0; + point2[2]=0; + _vtklinesource->SetPoint1( point1 ); + _vtklinesource->SetPoint2( point2 ); } @@ -51,56 +62,31 @@ vtkVectorsVisu::~vtkVectorsVisu() //------------------------------------------------------------------------------ void vtkVectorsVisu::Process() { -printf("EED vtkVectorsVisu::Process() start\n"); if(_active==true) { _vtkglyph->SetInput( GetDataObject() ); - if(GetTypeForm()==1) // source Arrow { _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); } else { // source Line _vtkglyph->SetSource( _vtklinesource->GetOutput() ); } - _vtkglyph->SetScaleModeToScaleByVector(); _vtkglyph->SetColorModeToColorByVector(); _vtkglyph->SetScaleFactor( GetScaleFactor() ); _vtkglyph->Update(); - _pdm->SetInput( _vtkglyph->GetOutput()); - vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); //printf("EED -------------------------------------------\n"); //_vtkglyph->GetOutput()->Print(std::cout); //printf("EED -------------------------------------------\n"); //data->Print(std::cout); -printf("EED -------------------------------------------\n"); int i,sizeDa = data->GetNumberOfArrays(); -printf("EED vtkVectorsVisu::Process sizeDa %d \n", sizeDa ); for (i=0;iGetArrayName(i) ); data->GetArray(i)->Print(std::cout); - printf("EED -------------------------------------------\n"); } -//EED _pdm->SetScalarRange( range ); -//EED vtkPolyData *pd = vGlyphFlowPlane->GetOutput(); -//EED vtkPointData *pointdata = pd->GetPointData(); -//EED vtkDataArray *da = pointdata->GetVectors(); -//EED vtkDataArray *nda = vtkFloatArray::New(); -//EED nda->DeepCopy(da); -// pointdata->RemoveArray( "GlyphVector" ); -// bbGetInputIn()->GetPointData()->RemoveArray( "GlyphVector" ); -//EED pointdata->AddArray( nda ); -//EED bbGetInputIn()->GetPointData()->AddArray( nda ); -//EED2 _pdm->ScalarVisibilityOn(); - - - - - _pdm->ScalarVisibilityOn(); _pdm->SetColorModeToMapScalars(); //_pdm->SetColorModeToDefault(); @@ -126,7 +112,6 @@ for (i=0;i