2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbvtkPolyDataToActor.cxx,v $
32 Date: $Date: 2009/05/28 08:55:44 $
33 Version: $Revision: 1.15 $
34 =========================================================================*/
44 #include "vtkProperty.h"
45 #include "vtkLinearTransform.h"
47 #include "bbvtkPolyDataToActor.h"
48 #include "bbvtkPackage.h"
52 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PolyDataToActor)
53 BBTK_BLACK_BOX_IMPLEMENTATION(PolyDataToActor,bbtk::AtomicBlackBox);
55 void PolyDataToActor::bbUserSetDefaultValues()
58 std::vector<double> colour;
59 colour.push_back(1.0);
60 colour.push_back(1.0);
61 colour.push_back(0.5);
62 bbSetInputColour(colour);
65 bbSetInputRenderer(NULL);
66 bbSetInputTransform(NULL);
68 bbSetInputRepresentation(2);
69 bbSetInputLineWidth(1);
71 polydatamapper = NULL;
76 //---------------------------------------------------------------------
77 void PolyDataToActor::bbUserInitializeProcessing()
79 polydatamapper = vtkPolyDataMapper::New();
80 vtkactor = vtkActor::New();
82 // polydatamapper->SetInput(marchingcubes->GetOutput());
83 vtkactor->SetMapper(polydatamapper);
85 polydatamapper->ScalarVisibilityOff();
86 // polydatamapper->ScalarVisibilityOn();
87 polydatamapper->ImmediateModeRenderingOn();
90 //---------------------------------------------------------------------
91 void PolyDataToActor::bbUserFinalizeProcessing()
93 if (polydatamapper!=NULL)
95 polydatamapper->Delete();
106 //---------------------------------------------------------------------
108 void PolyDataToActor::DoProcess()
110 polydatamapper->SetInput( bbGetInputIn() );
112 vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
113 vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
115 vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
116 bbGetInputColour()[1],
117 bbGetInputColour()[2] );
119 vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
121 if ( bbGetInputTransform()!=NULL )
123 vtkactor->SetUserTransform( bbGetInputTransform() );
126 bbSetOutputOut( vtkactor );
129 if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
132 bbGetInputRenderer()->AddActor( vtkactor );
135 } // EO namespace bbtk