]> Creatis software - creaVtk.git/blob - lib/creaVtk/vtkVectorsVisu.cpp
43df474428cfa2e3e5c0701424a4b178ad4da08d
[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 //------------------------------------------------------------------------------
33 vtkVectorsVisu::vtkVectorsVisu()
34   :vtkVectorsTensorsVisuBase()
35 {
36         _vtkarrowsource = vtkArrowSource::New();
37         _vtkglyph       = vtkGlyph3D::New();
38 }
39
40
41 //------------------------------------------------------------------------------
42 vtkVectorsVisu::~vtkVectorsVisu()
43 {
44 }
45
46 //------------------------------------------------------------------------------
47 void vtkVectorsVisu::Process()
48 {
49 printf("EED vtkVectorsVisu::Process()  start\n");
50      if(_active==true)
51      {
52 printf("EED vtkVectorsVisu::Process()  1\n");
53          _vtkglyph->SetInput( GetDataObject() );  
54 printf("EED vtkVectorsVisu::Process()  2\n");
55          _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
56 printf("EED vtkVectorsVisu::Process()  3\n");
57          _vtkglyph->SetScaleModeToScaleByVector();
58          _vtkglyph->SetColorModeToColorByVector();
59          _vtkglyph->SetScaleFactor( GetScaleFactor() );
60 printf("EED vtkVectorsVisu::Process()  4\n");
61          _vtkglyph->Update();
62 printf("EED vtkVectorsVisu::Process()  5\n");
63
64          _pdm->SetInput( _vtkglyph->GetOutput());
65 printf("EED vtkVectorsVisu::Process()  5.1\n");
66 //EED         _pdm->SetScalarRange( range );
67 //EED         vtkPolyData       *pd                     = vGlyphFlowPlane->GetOutput();
68 //EED         vtkPointData      *pointdata              = pd->GetPointData();
69 //EED         vtkDataArray      *da                     = pointdata->GetVectors();
70 //EED         vtkDataArray *nda = vtkFloatArray::New();
71 //EED         nda->DeepCopy(da);
72 //       pointdata->RemoveArray( "GlyphVector" );
73 //       bbGetInputIn()->GetPointData()->RemoveArray( "GlyphVector" );
74 //EED         pointdata->AddArray( nda );
75 //EED         bbGetInputIn()->GetPointData()->AddArray( nda );
76 //EED2         _pdm->ScalarVisibilityOn();
77 printf("EED vtkVectorsVisu::Process()  6\n");
78          _pdm->SetScalarModeToUsePointFieldData();
79
80          _pdm->SetLookupTable( _LutEED );
81 printf("EED vtkVectorsVisu::Process()  7\n");
82          _pdm->SelectColorArray( "GlyphVector" );
83
84 //       vSliceMapperVec->SetLookupTable( vGreenToRedLut );
85 //       vSliceMapperVec->SetColorModeToMapScalars();
86
87          _actor->SetMapper( _pdm );
88 printf("EED vtkVectorsVisu::Process()  8\n");
89          _actor->GetProperty()->SetOpacity( GetOpacity() );
90 printf ("EED vtkVectorsVisu::Process opacity:%f\n",GetOpacity()  ); 
91     }// if _active
92
93 printf("EED vtkVectorsVisu::Process()  9\n");
94     VisibilityActor(); 
95 printf("EED vtkVectorsVisu::Process()  end\n");
96 }
97         
98
99
100
101
102