]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
b1d05679baff70d22551d1164534789e4890adea
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourViewPanel.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
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "wxContourViewPanel.h"
31
32 #include "wxContourMainFrame.h"
33 //----------------------------------------------------------------------------------------------------------------
34 // Other includes
35 //----------------------------------------------------------------------------------------------------------------
36 //#include "ConceptDataWrap.h"
37
38 //this should be eliminated at some point
39 //#include "wxContourEventHandler.h"
40 //----------------------------------------------------------------------------------------------------------------
41 // Class implementation
42 //----------------------------------------------------------------------------------------------------------------
43 /** @file wxContourViewPanel.cxx */
44
45 //----------------------------------------------------------------------------------------------------------------
46 // Throwed Events definition
47 //----------------------------------------------------------------------------------------------------------------
48
49 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
50
51
52         //------------------------------------------------------------------------------------------------------------
53         // Constructors & Destructors
54         //------------------------------------------------------------------------------------------------------------
55         //:wxScrolledWindow(parent, -1, pos, size, style)
56         wxContourViewPanel::wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
57         :wxPanel(parent, -1, pos, size, style)
58         {
59                 theShowingImage->GetSpacing(last_spacing);
60                 showingVID                              = theShowingImage;
61                 int gapH                                = 20;
62                 int gapV                                = 10;
63                 _verticalConceptName    = "";
64                 _horizontalConceptName  = "";
65                 createHorizontalBar(1,80);
66                 createVerticalBar(1,200);
67                 createViewPanel();
68                 _eventHandler                   = NULL;
69
70                 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4,  gapV, gapH);
71 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
72 #if wxMAJOR_VERSION <= 2
73                 panelSizer -> AddGrowableCol(2);
74                 panelSizer -> AddGrowableRow(2);
75 #else
76                 panelSizer -> AddGrowableRow(0,1);
77                 panelSizer -> AddGrowableCol(2,1);
78 #endif
79                 panelSizer->Add(_verticalBar, 0, wxEXPAND);
80                 panelSizer->AddSpacer(gapV);
81                 panelSizer->Add(theViewPanel, 1, wxEXPAND);
82                 panelSizer->AddSpacer(gapV);
83
84                 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
85 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
86 #if wxMAJOR_VERSION <= 2
87                 outSizer -> AddGrowableCol(1);
88                 outSizer -> AddGrowableRow(1);
89 #else
90                 outSizer -> AddGrowableRow(1,1);
91                 outSizer -> AddGrowableCol(0,1);
92 #endif
93                 outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP);
94                 outSizer->Add( panelSizer, 1, wxEXPAND);
95                 outSizer->AddSpacer(gapH);
96
97                 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
98                 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
99
100                 //Connecting the events to the horizontal bar
101                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
102                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
103                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
104                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
105                 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
106                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
107
108                 //Connecting the events to the vertical bar
109                 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
110                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
111                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
112                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
113                 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
114                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
115                 this->SetSizer( outSizer );
116                 this->SetAutoLayout( true );
117                 this->Layout();
118                 //SetSize(1900,1900);
119                 //theViewPanel->SetSize(800,600);
120                 //theViewPanel->GetWindow(1)->SetSize(800,600);
121                 //outSizer->Fit( this );
122                 initializeScenceManager();
123         }
124
125
126         wxContourViewPanel :: ~wxContourViewPanel()
127         {
128                 delete _sceneManager;
129         }
130
131         void wxContourViewPanel::initializeScenceManager()
132         {
133                 //_theViewPanel = theViewPanel;
134                 //_theViewPanel->setWxEventHandler( this );
135                 double spc[3];
136                 this->getSpacing(spc);
137                 _sceneManager           = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc  );
138                 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangeInstant );
139         Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateMultipleROI );
140                 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateROI );
141                 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStopCreateROI );
142                 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangedDeep );
143                 Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
144         }
145
146         wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
147                 return _sceneManager;
148         }
149
150         //------------------------------------------------------------------------------------------------------------
151         // Creational and initialization methods
152         //------------------------------------------------------------------------------------------------------------
153
154         void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
155         {
156                 _eventHandler = theEventHandler;
157         }
158
159         void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
160         {
161                 _horizontalBar = new mBarRange(this, 1500,80);
162                 _horizontalBar -> setVisibleLabels (true);
163                 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
164                 _horizontalBar -> setActiveStateTo(true);
165                 _horizontalBar -> SetActual( horzStart );
166                 _horizontalBar -> setDeviceBlitStart (10,10);
167                 _horizontalBar -> setDeviceEndMargin (10);
168         }
169
170         void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
171         {
172                 _verticalBar = new mBarRange(this, 1500,40);
173                 _verticalBar -> SetOrientation(false);
174                 _verticalBar -> setVisibleLabels (false);
175                 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
176                 _verticalBar -> setActiveStateTo(true);
177                 _verticalBar -> SetActual( vertStart );
178                 _verticalBar -> setDeviceBlitStart (10,10);
179                 _verticalBar -> setDeviceEndMargin (10);
180         }
181         //------------------------------------------------------------------------------------------------------------
182
183         void wxContourViewPanel::createViewPanel()
184         {
185                 std::vector<int> * numViews = new std::vector<int> ();
186                 numViews->push_back(0);
187                 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
188                 SetVisibleAxis(false);
189
190                 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
191
192                 theViewPanel->SetSize(800,600);
193                 theViewPanel->GetWindow(1)->SetSize(800,600);
194
195         }
196         //------------------------------------------------------------------------------------------------------------
197
198         void wxContourViewPanel::changeImage(vtkImageData* img){
199
200                 theViewPanel->SetImage(img);
201
202         }
203         wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
204         {
205                 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
206         }
207
208         //------------------------------------------------------------------------------------------------------------
209         void wxContourViewPanel::SetVisibleAxis(bool ok)
210         {
211                 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
212         }
213
214         //------------------------------------------------------------------------------------------------------------
215         int wxContourViewPanel::GetX()
216         {
217                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
218         }
219         //------------------------------------------------------------------------------------------------------------
220         int wxContourViewPanel::GetY()
221         {
222                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
223         }
224         //------------------------------------------------------------------------------------------------------------
225         int wxContourViewPanel::GetZ()
226         {
227                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
228         }
229
230         //------------------------------------------------------------------------------------------------------------
231         void wxContourViewPanel::Refresh()
232         {
233                 GetwxVtkMPR2DView()->GetRenWin()->Render();
234         }
235
236
237         //------------------------------------------------------------------------------------------------------------
238         // Methods for capturing events from the horizontal bar
239         //------------------------------------------------------------------------------------------------------------
240
241         /**
242         * Handles the event wxEVT_TSBAR from the horizontal bar
243         */
244         void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
245         {
246
247         }
248         /**
249         * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar
250         */
251         void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
252         {
253
254                 int actual = getActualHorizontal();
255
256                 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
257
258                 //JCP 26 - 11 - 08
259                 //int nxActual_h = getActualHorizontal();
260
261
262                 //if (_eventHandler!=NULL)
263                 //{
264                         //-------------------------------------------------
265                         //  Sending the event of wxINSTANT_CHANGE
266                         //-------------------------------------------------
267                 //      wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
268
269                 //      ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
270                 //      cWrap->setActualValue( nxActual_h );
271
272                 //      newevent.SetClientData( (void *)cWrap );
273                 //      _eventHandler->ProcessEvent(newevent);
274
275                 //}
276                 //JCP 26 - 11 - 08
277         }
278         /**
279         * Handles the event wxEVT_TSBAR_START from the horizontal bar
280         */
281         void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
282         {
283 //              int nxStart_h = getStartHorizontal();
284         }
285         /**
286         * Handles the event wxEVT_TSBAR_END from the horizontal bar
287         */
288         void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
289         {
290 //              int nxEnd_h = getEndHorizontal();
291         }
292         /**
293         * Handles the event wxEVT_SELECTION_END from the horizontal bar
294         */
295         void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
296         {
297
298         }
299         /**
300         * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar
301         */
302         void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
303         {
304 //              int nxStart_h = getStartHorizontal();
305 //              int nxEnd_h = getEndHorizontal();
306         }
307
308
309         //------------------------------------------------------------------------------------------------------------
310         // Methods for capturing events from the vertical bar
311         //------------------------------------------------------------------------------------------------------------
312
313         /**
314         * Handles the event wxEVT_TSBAR from the vertical bar
315         */
316         void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
317         {
318
319         }
320         /**
321         * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar
322         */
323         void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
324         {
325                 int actual = getActualVertical();
326                 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
327                 //JCP 26 - 11 - 08
328                 /*
329                 int nxActual_v = getActualVertical();
330
331                 if (_eventHandler!=NULL)
332                 {
333                         //-------------------------------------------------
334                         //  Sending the event of wxINSTANT_CHANGE
335                         //-------------------------------------------------
336                         wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
337
338                         ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
339                         cWrap->setActualValue( nxActual_v );
340
341                         newevent.SetClientData( (void *)cWrap );
342                         _eventHandler->ProcessEvent(newevent);
343                 }*/
344                 //JCP 26 - 11 - 08
345         }
346         /**
347         * Handles the event wxEVT_TSBAR_START from the vertical bar
348         */
349         void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
350         {
351 //              int nxStart_v = getStartVertical();
352         }
353         /**
354         * Handles the event wxEVT_TSBAR_END from the vertical bar
355         */
356         void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
357         {
358 //              int nxEnd_v = getEndVertical();
359         }
360         /**
361         * Handles the event wxEVT_SELECTION_END from the vertical bar
362         */
363         void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
364         {
365
366         }
367         /**
368         * Handles the event wxEVT_TSBAR_MOVED from the vertical bar
369         */
370         void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
371         {
372 //              int nxStart_v = getStartVertical();
373 //              int nxEnd_v = getEndVertical();
374         }
375
376
377         //------------------------------------------------------------------------------------------------------------
378         //  Methods for sending events
379         //------------------------------------------------------------------------------------------------------------
380
381         //------------------------------------------------------------------------------------------------------------
382         //  Attributes getters and setters
383         //------------------------------------------------------------------------------------------------------------
384
385         /**
386         * Sets the represented values of the vertical bar
387         * @param minRepresented In the minimum represented value of the bar
388         * @param maxRepresented In the maximum represented value of the bar
389         */
390         void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
391         {
392                 if( _verticalBar != NULL && _useVerticalBar )
393                 {
394                         _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
395                 }
396         }
397
398         /**
399         * Sets the represented values of the horizontal bar
400         * @param minRepresented In the minimum represented value of the bar
401         * @param maxRepresented In the maximum represented value of the bar
402         */
403         void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
404         {
405                 if( _horizontalBar != NULL && _useHorizontalBar )
406                 {
407                         _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
408                 }
409         }
410
411         /**
412         * Gets the StartVertical value
413         * @return The StartVertical
414         */
415         int wxContourViewPanel :: getStartVertical()
416         {
417                 return _verticalBar->GetActual();
418         }
419         /**
420         * Gets the EndVertical value
421         * @return The EndVertical
422         */
423         int wxContourViewPanel :: getEndVertical()
424         {
425                 return _verticalBar->GetEnd();
426         }
427         /**
428         * Gets the ActualVertical value
429         * @return The ActualVertical
430         */
431         int wxContourViewPanel :: getActualVertical()
432         {
433                 return _verticalBar->GetActual();//GetEnd();
434         }
435
436         /**
437         * Sets the StartVertical value
438         * @param nwValue The new value for the StartVertical
439         */
440         void wxContourViewPanel :: setStartVertical( int nwValue )
441         {
442                  _verticalBar->SetEnd( nwValue );
443         }
444         /**
445         * Sets the EndVertical value
446         * @param nwValue The new value for the EndVertical
447         */
448         void wxContourViewPanel :: setEndVertical( int nwValue )
449         {
450                  _verticalBar->SetEnd( nwValue );
451         }
452         /**
453         * Sets the ActualVertical value
454         * @param nwValue The new value for the ActualVertical
455         */
456         void wxContourViewPanel :: setActualVertical( int nwValue )
457         {
458                  _verticalBar->SetActual( nwValue );
459         }
460
461         /**
462         * Gets the StartHorizontal value
463         * @return The StartHorizontal
464         */
465         int wxContourViewPanel :: getStartHorizontal()
466         {
467                 return _horizontalBar->GetStart();
468         }
469         /**
470         * Gets the EndHorizontal value
471         * @return The EndHorizontal
472         */
473         int wxContourViewPanel :: getEndHorizontal()
474         {
475                 return _horizontalBar->GetEnd();
476         }
477         /**
478         * Gets the ActualHorizontal value
479         * @return The ActualHorizontal
480         */
481         int wxContourViewPanel :: getActualHorizontal()
482         {
483                 return _horizontalBar->GetActual();
484         }
485
486         /**
487         * Sets the StartHorizontal value
488         * @param nwValue The new value for the StartHorizontal
489         */
490         void wxContourViewPanel :: setStartHorizontal( int nwValue )
491         {
492                 _horizontalBar->SetStart( nwValue );
493         }
494         /**
495         * Sets the EndHorizontal value
496         * @param nwValue The new value for the EndHorizontal
497         */
498         void wxContourViewPanel :: setEndHorizontal( int nwValue )
499         {
500                 _horizontalBar->SetEnd( nwValue );
501         }
502         /**
503         * Sets the ActualHorizontal value
504         * @param nwValue The new value for the ActualHorizontal
505         */
506         void wxContourViewPanel :: setActualHorizontal( int nwValue )
507         {
508                 _horizontalBar->SetActual( nwValue );
509         }
510
511         /**
512         * Sets the horizontal concept values and name
513         * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
514         * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
515         * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
516         * @param minShowed The minShowed value of the concept for setting at the horizontal bar
517         * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
518         * @param actualShow The actualShow value of the concept for setting at the horizontal bar
519         */
520         void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
521         {
522                 setHorizontalConceptName( theHorizontalConcept );
523                 setHorizontalRepresentedValues( minRepresent, maxRepresent );
524                 setActualHorizontal( actualShow );
525                 setStartHorizontal( minShowed );
526                 setEndHorizontal( maxShowed );
527         }
528
529         /**
530         * Sets the vertical concept values and name
531         * @param theVerticalConcept The name of the concept for setting at the vertical bar
532         * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
533         * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
534         * @param minShowed The minShowed value of the concept for setting at the vertical bar
535         * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
536         * @param actualShow The actualShow value of the concept for setting at the vertical bar
537         */
538         void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
539         {
540                 setVerticalConceptName( theVerticalConcept );
541                 setVerticalRepresentedValues( minRepresent, maxRepresent );
542                 setActualVertical( actualShow );
543                 setStartVertical( minShowed );
544                 setEndVertical( maxShowed );
545         }
546
547
548         /**
549         * Sets the horizontal concept name
550         * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
551         */
552         void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
553         {
554                 _horizontalConceptName = theHorizontalConcept;
555         }
556
557         /**
558         * Gets the horizontal concept name
559         * @return _horizontalConceptName The name of the concept for setting at the horizontal bar
560         */
561         std::string wxContourViewPanel :: getHorizontalConceptName(  )
562         {
563                 return _horizontalConceptName;
564         }
565
566         /**
567         * Sets the vertical concept name
568         * @param theVerticalConcept The name of the concept for setting at the vertical bar
569         */
570         void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
571         {
572                 _verticalConceptName = theVerticalConcept;
573         }
574
575         /**
576         * Gets the vertical concept name
577         * @return _verticalConceptName The name of the concept for setting at the vertical bar
578         */
579         std::string wxContourViewPanel :: getVerticalConceptName(  )
580         {
581                 return _verticalConceptName;
582         }
583
584         //------------------------------------------------------------------------------------------------------------
585         //  Other functional methods
586         //------------------------------------------------------------------------------------------------------------
587
588         void wxContourViewPanel :: getSpacing( double * spacing  )
589         {
590                 spacing[0] = last_spacing[0];
591                 spacing[1] = last_spacing[1];
592                 spacing[2] = last_spacing[2];
593         }
594
595         wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
596         {
597                 return theViewPanel->GetwxVtkBaseView(1);
598         }
599
600         double wxContourViewPanel :: getCurrentDeep()
601         {
602 //EED 08/04/2008
603 //              return theViewPanel->GetZ(1);
604                 return theViewPanel->GetZ();
605                 //return GetZ();
606         }
607
608
609         bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
610                 return _sceneManager->isEditableCControler(theKeyName);
611         }
612
613         void wxContourViewPanel::removeFromScene(std::string theKeyName){
614
615                 _sceneManager->deleteCViewerCControler(theKeyName);
616
617
618         }
619
620         void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
621                 ConceptDataWrap * dataConcept = NULL;
622                 if ( GetId() == event.GetId() )
623                 {
624                         dataConcept = (ConceptDataWrap *)event.GetClientData();
625                         int value = dataConcept->getActualValue();
626                         //_instantPanel->setConceptValue( dataConcept->getName(), value );
627                         wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
628                 }
629                 else
630                 {
631                         dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
632                         if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
633                         {
634                                 setActualVertical( dataConcept->getActualValue());
635                                 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
636                         }
637                         else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
638                         {
639                                 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
640                         }
641                 }
642                 wxContourMainFrame::getInstance()->changeInstant();
643         }
644
645         void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
646         }
647         void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
648         }
649         void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
650         }
651         void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
652                 double val = getCurrentDeep();
653                 //setActualVertical( (int)val );
654                 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
655                 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
656
657 //              changeInstant();
658         }
659         void wxContourViewPanel::changeDeep(){
660                 double val = getCurrentDeep();
661                 setActualVertical( (int)val );
662         }
663         void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
664
665
666                 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
667 //              int elementsSelected = currentSelection.size();
668                 bool ctrlKey = _sceneManager->isCtrlPressed();
669                 char toolCommand = _sceneManager->getLastKeyCode();
670
671
672                 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
673                 {
674                         wxContourMainFrame::getInstance()->onCopy();
675                 }
676                 else if(  toolCommand == 22 && ctrlKey ) //'V' || 'v'
677                 {
678                         wxContourMainFrame::getInstance()->onPaste();
679                 }
680                 else if(  toolCommand == 8 || (toolCommand==127) ) // backspace Delete
681                 {
682                         wxContourMainFrame::getInstance()->onDeleteContour();
683                 }
684                 else if(  toolCommand == 14 && ctrlKey ) //'N' || 'n'
685                 {
686                         //toolCommand = &(CREATE_CONTOUR_KEY);
687                 }
688                 else if(  toolCommand == 15 && ctrlKey ) //'O' || 'o'
689                 {
690                         wxContourMainFrame::getInstance()->onLoad();
691                 }
692                 else if(  toolCommand == 19 && ctrlKey ) //'S' || 's'
693                 {
694                         wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
695                 }else if( toolCommand == 26 ){
696                         wxContourMainFrame::getInstance()->onUndo();
697                 }else if( toolCommand == 25 ){
698                         wxContourMainFrame::getInstance()->onRedo();
699                 }
700         }
701
702         void wxContourViewPanel::removeSceneContours()
703         {
704                 _sceneManager->removeSceneContours();
705         }
706
707         void wxContourViewPanel::addNameWrapperToScene()
708         {
709                 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
710                 for(int i = 0; i < size;i++){
711                         std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
712                         _sceneManager->addToScene(name, true, true, true, false, false );
713                 }
714         }
715
716         std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
717                 return _sceneManager->getSelectedObjects();
718         }
719
720         void wxContourViewPanel::RefreshInterface(){
721                 getWxVtkBaseView()->Refresh();
722         }
723
724         vtkImageData* wxContourViewPanel::getImageData(){
725                 return _sceneManager->GetImageData();
726         }
727
728         void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
729         {
730                 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
731         }
732
733         int wxContourViewPanel::GetImageDataSizeZ()
734         {
735                 return _sceneManager->GetImageDataSizeZ();
736         }
737
738         void wxContourViewPanel::GetImageDataRange(double *range)
739         {
740                 _sceneManager->GetImageDataRange(range);
741         }
742
743         void wxContourViewPanel::SetWidthContour(double width )
744         {
745                 _sceneManager->SetWidthContour( width );
746         }
747
748         int wxContourViewPanel::getColorWindow()
749         {
750                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
751                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
752                 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
753                 return colorwindow;
754         }
755
756         int wxContourViewPanel::getWindowLevel()
757         {
758                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
759                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
760                 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
761                 return windowlevel;
762         }
763
764         void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
765         {
766                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
767                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
768                 imageviewer->SetColorWindow(colorwindow);
769                 imageviewer->SetColorLevel(windowlevel);
770         }
771
772         void wxContourViewPanel::onInterpolation(bool interpolate)
773         {
774                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
775                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
776
777                 if (interpolate){
778                         imageviewer->GetImageActor()->InterpolateOn();
779                 } else {
780                         imageviewer->GetImageActor()->InterpolateOff();
781                 }
782         }
783
784         void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
785         {
786                 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
787         }
788
789         void wxContourViewPanel::setImageSlice(int z){
790                 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
791                 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
792                 baseview->SetActualSlice(z);
793                 RefreshInterface();
794         }
795