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