]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/vtkVectorsVisu.cpp
#3100 creaVtk Feature New Normal - Vectors Visu refresh
[creaVtk.git] / lib / creaVtk / vtkVectorsVisu.cpp
index c8045e55f601799252ba875a691b48bda8573bb6..5b50b2ae0395e506e8e40c51243479be963eb3d8 100644 (file)
 vtkVectorsVisu::vtkVectorsVisu()
   :vtkVectorsTensorsVisuBase()
 {
-       _vtkarrowsource = vtkArrowSource::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 );
 }
 
 
@@ -50,45 +62,45 @@ vtkVectorsVisu::~vtkVectorsVisu()
 //------------------------------------------------------------------------------
 void vtkVectorsVisu::Process()
 {
-printf("EED vtkVectorsVisu::Process()  start\n");
      if(_active==true)
      {
          _vtkglyph->SetInput( GetDataObject() );  
-         _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
+                       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");                   
+//printf("EED -------------------------------------------\n");
+//_vtkglyph->GetOutput()->Print(std::cout);
+//printf("EED -------------------------------------------\n");
+//data->Print(std::cout);
 int i,sizeDa = data->GetNumberOfArrays();
-printf("EED vtkVectorsVisu::Process  sizeDa %d \n", sizeDa );
 for (i=0;i<sizeDa;i++)
 {
-       printf("EED vtkVectorsVisu::Process-name %d, %s \n", i, data->GetArrayName(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->SetScalarModeToUsePointFieldData();
+       _pdm->ScalarVisibilityOn();
+       _pdm->SetColorModeToMapScalars();
+       //_pdm->SetColorModeToDefault();
+       // _pdm->SetColorModeToDirectScalars();  // NOT compile
+       _pdm->SetScalarModeToUsePointFieldData();
+       _pdm->ImmediateModeRenderingOn();
+
+       _LutEED->SetVectorModeToComponent();
+       //_LutEED->SetVectorModeToRGBColors();
+       //_LutEED->SetVectorModeToMagnitud();
+
+
+
+//         _pdm->SetScalarModeToUsePointFieldData();
          _pdm->SetLookupTable( _LutEED );
          _pdm->SelectColorArray( "GlyphVector" );
 
@@ -100,7 +112,6 @@ for (i=0;i<sizeDa;i++)
     }// if _active
 
     VisibilityActor(); 
-printf("EED vtkVectorsVisu::Process()  end\n");
 }