]> Creatis software - creaVtk.git/blob - lib/creaVtk/vtkVectorsVisu.cpp
c8045e55f601799252ba875a691b48bda8573bb6
[creaVtk.git] / lib / creaVtk / vtkVectorsVisu.cpp
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Sante)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and
11 #  abiding by the rules of distribution of free software. You can  use,
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B
13 #  license as circulated by CEA, CNRS and INRIA at the following URL
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability.
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
26 */
27
28 #include "vtkVectorsVisu.h"
29
30 #include "vtkProperty.h"
31
32 //Borrame
33 #include "vtkPointData.h"
34
35
36 //------------------------------------------------------------------------------
37 vtkVectorsVisu::vtkVectorsVisu()
38   :vtkVectorsTensorsVisuBase()
39 {
40         _vtkarrowsource = vtkArrowSource::New();
41         _vtkglyph                       = vtkGlyph3D::New();
42 }
43
44
45 //------------------------------------------------------------------------------
46 vtkVectorsVisu::~vtkVectorsVisu()
47 {
48 }
49
50 //------------------------------------------------------------------------------
51 void vtkVectorsVisu::Process()
52 {
53 printf("EED vtkVectorsVisu::Process()  start\n");
54      if(_active==true)
55      {
56          _vtkglyph->SetInput( GetDataObject() );  
57          _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
58          _vtkglyph->SetScaleModeToScaleByVector();
59          _vtkglyph->SetColorModeToColorByVector();
60          _vtkglyph->SetScaleFactor( GetScaleFactor() );
61          _vtkglyph->Update();
62
63          _pdm->SetInput( _vtkglyph->GetOutput());
64
65 vtkPointData    *data   = _vtkglyph->GetOutput()->GetPointData();
66 printf("EED -------------------------------------------\n");
67 _vtkglyph->GetOutput()->Print(std::cout);
68 printf("EED -------------------------------------------\n");
69 data->Print(std::cout);
70 printf("EED -------------------------------------------\n");                    
71 int i,sizeDa = data->GetNumberOfArrays();
72 printf("EED vtkVectorsVisu::Process  sizeDa %d \n", sizeDa );
73 for (i=0;i<sizeDa;i++)
74 {
75         printf("EED vtkVectorsVisu::Process-name %d, %s \n", i, data->GetArrayName(i) );
76         data->GetArray(i)->Print(std::cout);
77         printf("EED -------------------------------------------\n");
78 }
79
80 //EED         _pdm->SetScalarRange( range );
81 //EED         vtkPolyData       *pd                     = vGlyphFlowPlane->GetOutput();
82 //EED         vtkPointData      *pointdata              = pd->GetPointData();
83 //EED         vtkDataArray      *da                     = pointdata->GetVectors();
84 //EED         vtkDataArray *nda = vtkFloatArray::New();
85 //EED         nda->DeepCopy(da);
86 //       pointdata->RemoveArray( "GlyphVector" );
87 //       bbGetInputIn()->GetPointData()->RemoveArray( "GlyphVector" );
88 //EED         pointdata->AddArray( nda );
89 //EED         bbGetInputIn()->GetPointData()->AddArray( nda );
90 //EED2         _pdm->ScalarVisibilityOn();
91          _pdm->SetScalarModeToUsePointFieldData();
92          _pdm->SetLookupTable( _LutEED );
93          _pdm->SelectColorArray( "GlyphVector" );
94
95 //       vSliceMapperVec->SetLookupTable( vGreenToRedLut );
96 //       vSliceMapperVec->SetColorModeToMapScalars();
97
98          _actor->SetMapper( _pdm );
99          _actor->GetProperty()->SetOpacity( GetOpacity() );
100     }// if _active
101
102     VisibilityActor(); 
103 printf("EED vtkVectorsVisu::Process()  end\n");
104 }
105         
106
107
108
109
110