]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuShowNPoints.cxx
0163609438d8352c4f86c9e5a8c475c917c5adee
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuShowNPoints.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "bbmaracasvisuShowNPoints.h"
27 #include "bbcreaMaracasVisuPackage.h"
28
29
30 namespace bbcreaMaracasVisu
31 {
32
33
34 //------------------------------------------------------------------------
35 //------------------------------------------------------------------------
36 //------------------------------------------------------------------------
37 //------------------------------------------------------------------------
38 WidgetShowNPointsBox::WidgetShowNPointsBox(wxWindow *parent,  bbcreaMaracasVisu::ShowNPoints *box, int type)
39     : WidgetShowNPoints( parent, type)
40 {
41         mbbShowNPoints=box;
42 }
43
44 //------------------------------------------------------------------------
45 WidgetShowNPointsBox::~WidgetShowNPointsBox()
46 {
47 }
48
49
50 //------------------------------------------------------------------------
51 void WidgetShowNPointsBox::UpdatePoints(wxCommandEvent &event)
52 {
53         WidgetShowNPoints::UpdatePoints(event);
54         //Difference in Radio for text placement
55 //      double radio=GetModelShowNPoints()->GetRadio();
56 //      this->mopacity = sdrOpacity->GetValue()/100.0;
57 //      GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
58 //      radio = sdrRadio->GetValue();
59         //NTU refresh the inputs
60         mbbShowNPoints->bbSetInputOpacity( GetOpacity() );
61         mbbShowNPoints->bbSetInputRadio( GetRadio() );
62         // EED 
63 //      RefreshPoints();
64 }
65
66
67 //------------------------------------------------------------------------
68 void WidgetShowNPointsBox::SetOutputBox()
69 {
70         WidgetShowNPoints::SetOutputBox();
71
72 //      wxString strTmp;
73 //      strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() );
74 //      txtNrPoints->SetLabel(  strTmp );
75
76         //--BBTK
77     mbbShowNPoints->bbSetOutputlstPointsX( GetLstPointsX() );
78     mbbShowNPoints->bbSetOutputlstPointsY( GetLstPointsY() );
79     mbbShowNPoints->bbSetOutputlstPointsZ( GetLstPointsZ() );
80     mbbShowNPoints->bbSetOutputlstLabels( GetLstLabels() );
81     mbbShowNPoints->bbSetOutputlstIndexs( GetLstIndexs() );
82     mbbShowNPoints->bbSetOutputlstSelectedIndexs( GetLstSelectedIndexs() );
83     //    mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
84     //    mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
85     //    mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
86     //    mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
87         mbbShowNPoints->bbSignalOutputModification();
88 }
89
90
91
92 //------------------------------------------------------------------------
93 //------------------------------------------------------------------------
94 //------------------------------------------------------------------------
95 //------------------------------------------------------------------------
96
97
98
99
100 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints)
101 BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox);
102
103 //-----------------------------------------------------------------
104 void ShowNPoints::Process()
105 {
106         if (mwxwidget!=NULL)
107         {
108                 mwxwidget->SetRenderer( bbGetInputRenderer() );
109                 mwxwidget->SetReferencePoint( bbGetInputIn() );
110                 mwxwidget->SetImage( bbGetInputImage() );
111                 mwxwidget->SetColour( bbGetInputColour() );
112 //              mwxwidget->SetOpacity( bbGetInputOpacity() );
113                 mwxwidget->SetRadio( bbGetInputRadio() );
114         if ( backOpacity!=bbGetInputOpacity() )
115         {
116             backOpacity = bbGetInputOpacity();
117             mwxwidget->SetOpacity( bbGetInputOpacity() );
118         } // if backOpacity
119         
120 //        if (firsttime==true)
121 //        {
122 //            firsttime=false;
123             if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==false )
124             {
125                 mwxwidget->DetectCollectionActive();
126             }
127             if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true )
128             {
129                 mwxwidget->GetModelShowNPoints()->SetFirstTime(false);
130                 mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() ,  bbGetInputInitLstIndexs() );
131             }
132 //        } // firsttime OJO machete Eduardo pour ANDREAS a verificar
133
134         mwxwidget->AutoAddPoints();
135         mwxwidget->TrackingPoint();
136
137         bbSetOutputlstPointsX( mwxwidget->GetLstPointsX()               );
138         bbSetOutputlstPointsY( mwxwidget->GetLstPointsY()               );
139         bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ()               );
140         bbSetOutputlstLabels( mwxwidget->GetLstLabels()                 );
141         bbSetOutputlstIndexs( mwxwidget->GetLstIndexs()                 );
142         bbSetOutputlstSelectedIndexs( mwxwidget->GetLstSelectedIndexs() );
143         bbSetOutputWidgetShowNPoints( (WidgetShowNPoints*)mwxwidget );
144
145         } // mwxwidget
146     
147 }
148
149 //-----------------------------------------------------------------
150 void ShowNPoints::CreateWidget(wxWindow* parent)
151 {
152         mwxwidget = new WidgetShowNPointsBox( parent, this, bbGetInputType() );
153     bbSetOutputWidget( mwxwidget );
154 }
155
156 //-----------------------------------------------------------------
157 void ShowNPoints::bbUserSetDefaultValues()
158 {
159     firsttime=true;
160     backOpacity = -1;
161         mwxwidget = NULL;
162         bbSetInputRadio(10);
163         bbSetInputOpacity(1);
164         std::vector<double> colour;
165         colour.push_back(1.0);
166         colour.push_back(1.0);
167         colour.push_back(0.0);
168         bbSetInputColour(colour);
169         bbSetInputImage(NULL);
170         bbSetInputType(0);
171         bbSetInputRenderer(NULL);
172         bbSetOutputWidgetShowNPoints(NULL);
173 }
174
175 //------------------  -----------------------------------------------
176         void ShowNPoints::bbUserInitializeProcessing()
177         {
178         }
179
180 //-----------------------------------------------------------------
181         void ShowNPoints::bbUserFinalizeProcessing()
182         {
183         }
184
185 //-----------------------------------------------------------------
186
187 }
188 // EO namespace bbcreaMaracasVisu