]> Creatis software - bbtk.git/blob - packages/kw/src/bbkwViewer3D.cxx
2886 BBTK Bug New Normal - Refresh vtk:VolumeRenderer box
[bbtk.git] / packages / kw / src / bbkwViewer3D.cxx
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
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 /*=========================================================================
29                                                                                 
30   Program:   bbtk
31   Module:    $RCSfile: bbkwViewer3D.cxx,v $
32   Language:  C++
33   Date:      $Date: 2012/11/16 08:51:05 $
34   Version:   $Revision: 1.2 $
35  
36 =========================================================================*/
37 /**
38  *  \file 
39  *  \brief 
40  */
41
42
43 #ifdef _USE_WXWIDGETS_
44
45
46 #include "bbkwViewer3D.h"
47 #include "bbkwPackage.h"
48
49 #include "vtkKWRenderWidget.h"
50
51 namespace bbkw
52 {
53
54   BBTK_ADD_BLACK_BOX_TO_PACKAGE(kw,kwViewer3D);
55   BBTK_BLACK_BOX_IMPLEMENTATION(kwViewer3D,bbtk::KWBlackBox);
56
57   void kwViewer3D::bbUserConstructor() 
58   { 
59     bbSetInputIn1(NULL);
60     bbSetInputIn2(NULL);
61     bbSetInputIn3(NULL);
62     bbSetInputIn4(NULL);
63     bbSetInputIn5(NULL);
64     bbSetInputObs1(NULL);
65     bbSetInputObs2(NULL);
66     bbSetInputObs3(NULL);
67     bbSetInputObs4(NULL);
68     bbSetInputObs5(NULL);
69     bbSetOutputWidget(NULL);
70   }
71   
72   void kwViewer3D::bbUserDestructor() 
73   { 
74     /*
75    vtkKWRenderWidget* w = (vtkKWRenderWidget*)bbGetOutputWidget();
76     if (w) 
77       {
78         w->Delete();
79       }
80     */
81   }
82
83   void kwViewer3D::Process() 
84   { 
85     vtkKWRenderWidget* w = (vtkKWRenderWidget*)bbGetOutputWidget();
86     if (w) 
87       {
88         if ( (bbGetInputIn1()!=NULL) &&
89              (bbGetInputStatus("In1")!=bbtk::UPTODATE))
90           {
91             w->AddViewProp(bbGetInputIn1());
92           }
93         if ( (bbGetInputIn2()!=NULL) &&
94              (bbGetInputStatus("In2")!=bbtk::UPTODATE))
95           {
96             w->AddViewProp(bbGetInputIn2());
97           }
98         if ( (bbGetInputIn3()!=NULL) &&
99              (bbGetInputStatus("In3")!=bbtk::UPTODATE))
100           {
101             w->AddViewProp(bbGetInputIn3());
102           }
103         if ( (bbGetInputIn4()!=NULL) &&
104              (bbGetInputStatus("In4")!=bbtk::UPTODATE))
105           {
106             w->AddViewProp(bbGetInputIn4());
107           }
108         if ( (bbGetInputIn5()!=NULL) &&
109              (bbGetInputStatus("In5")!=bbtk::UPTODATE))
110           {
111             w->AddViewProp(bbGetInputIn5());
112           }
113         w->ResetCamera();
114         w->Render();
115       }
116   }
117   
118
119   void kwViewer3D::CreateWidget(vtkKWFrame* parent)
120   {
121     vtkKWRenderWidget *w = vtkKWRenderWidget::New();
122     bbSetOutputWidget(w);
123     w->SetParent((vtkKWWidget*)parent);
124     w->Create();
125     w->SetRenderModeToInteractive();
126
127     Process();
128     w->Delete();
129     /*
130     vtkRenderWindowInteractor *interactor = w->GetInteractor();
131     if (interactor!=NULL)
132       {
133         if (bbGetInputObs1()!=NULL) 
134           {
135             bbGetInputObs1()->SetInteractor(interactor);
136             bbGetInputObs1()->EnabledOn();
137           }
138         if (bbGetInputObs2()!=NULL) 
139           {
140             bbGetInputObs2()->SetInteractor(interactor);
141             bbGetInputObs2()->EnabledOn();
142           }
143         if (bbGetInputObs3()!=NULL) 
144           {
145             bbGetInputObs3()->SetInteractor(interactor);
146             bbGetInputObs3()->EnabledOn();
147           }
148         if (bbGetInputObs4()!=NULL) 
149           {
150             bbGetInputObs4()->SetInteractor(interactor);
151             bbGetInputObs4()->EnabledOn();
152           }
153         if (bbGetInputObs5()!=NULL) 
154           {
155             bbGetInputObs5()->SetInteractor(interactor);
156             bbGetInputObs5()->EnabledOn();
157           }
158         bbSetOutputInteractor(  w->GetInteractor() );
159       }
160    
161
162     */
163     
164   }
165
166
167
168
169 }//namespace bbkw
170
171 #endif
172